NixOS on ARM/ODROID-C2: Difference between revisions

imported>Grahamc
Roughly document installing to the odroid c2
m fix 500 url with alternate download and update instructions
 
(11 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{ARM/breadcrumb}}
{{ARM/breadcrumb}}
<div class="infobox">
{|class="table"
!colspan="2" class="title"|Hardkernel ODROID-C2
|-
|colspan="2"|[[File:ODROID-C2.jpg|frameless|256px|An ODROID-C2.]]
|-
!Manufacturer
|Hardkernel
|-
!Architecture
|AArch64
|-
!Bootloader
| Upstream U-Boot
|-
!Boot options
|SD, eMMC
|}
</div>
{{outdated|The information is likely outdated, but it is likely the ODROID-C2 works well.}}
== Status ==
== Status ==


ODROID-C2 support is being worked on by '''@grahamc'''. Mainline kernel from NixOS has been reported as working<ref>https://logs.nix.samueldr.com/nixos-aarch64/2018-01-25#863144;</ref>. A non-specified build from mainline u-boot also has been reported to work.
Mainline kernel from NixOS has been reported as working<ref>https://logs.nix.samueldr.com/nixos-aarch64/2018-01-25#863144;</ref>. A non-specified build from mainline u-boot also has been reported to work.


== Board-specific installation notes ==
== Board-specific installation notes ==


Note this assumes u-boot is in partition 1 of your board's connected eMMC. If you haven't done that yet, you can build it with nix and then write it this fusing script (using an emmc/usb adapter) [http://mirror.archlinuxarm.org/aarch64/alarm/uboot-odroid-c2-mainline-2019.07-1-aarch64.pkg.tar.xz download and extract] (replace /dev/sdX with the device for the eMMC):


Note this assumes u-boot is in partition 1 of your board's connected eMMC. If you haven't done that yet, read the backlog from https://logs.nix.samueldr.com/nixos-aarch64/2018-11-21#1738333; and also https://github.com/NixOS/nixpkgs/compare/master...samueldr:u-boot/odroid-c2.
<syntaxhighlight lang=bash>
nix-build '<nixpkgs>' -A pkgsCross.aarch64-multiplatform.ubootOdroidC2
cd result
bash /path/to/extracted/boot/sd_fusing.sh /dev/sdX
</syntaxhighlight>


1. Download the sd-image from Hydra at https://hydra.nixos.org/job/nixos/release-18.09-aarch64/nixos.sd_image.aarch64-linux/latest
# Download the sd-image from Hydra at https://hydra.nixos.org/job/nixos/release-22.05-aarch64/nixos.sd_image.aarch64-linux/latest
2. Copy it to the SD card
# Copy it to the SD card
3. Mount first partition to /mnt with sudo mount /dev/mmcblk0p1 /mnt
# Mount first partition to /mnt with <code>sudo mount /dev/mmcblk0p1 /mnt</code>
4. Edit /mnt/extlinux/extlinux.conf and delete all the console=tty.... arguments in the APPEND line
# Edit /mnt/extlinux/extlinux.conf and delete all the console=tty.... arguments in the APPEND line
5. Add console=ttyAML0,115200n8 to the end of the APPEND line  
# Add <code>console=ttyAML0,115200n8</code> to the end of the APPEND line  


it will look something like this:
it will look something like this:


<syntaxhighlight>
<syntaxhighlight lang=bash>
[grahamc@Morbo:~]$
$ cat  /mnt/extlinux/extlinux.conf
[grahamc@Morbo:~]$ cat  /mnt/extlinux/extlinux.conf
# Generated file, all changes will be lost on nixos-rebuild!
# Generated file, all changes will be lost on nixos-rebuild!


Line 47: Line 72:
</syntaxhighlight>
</syntaxhighlight>


note p2 is bootable.
note **p2** is bootable.


<syntaxhighlight>
<syntaxhighlight lang=console>
$ mkfs.ext4 /dev/mmcblk0p2
$ mkfs.ext4 /dev/mmcblk0p2
$ mkswap /dev/mmcblk0p3
$ mkswap /dev/mmcblk0p3
Line 61: Line 86:
== Serial console ==
== Serial console ==


I used minicom to access the serial:
I used minicom to access the serial console:


<syntaxhighlight>
<syntaxhighlight>
Line 71: Line 96:
</syntaxhighlight>
</syntaxhighlight>


then run <code>sudo minicom</code> to access the serial console.
then run <code>sudo minicom</code> to access the console.
 
==Xorg==
 
Nixos 20.03 should install all modules needed for this to work but at least two changes should be made to the xorg configuration:
 
<pre>
services.xserver.videoDrivers = [ "modesetting"  ];
  services.xserver.extraConfig = ''
    Section "OutputClass"
        Identifier "Meson"
        MatchDriver "meson"
        Driver "modesetting"
        Option "PrimaryGPU" "true"
    EndSection
  '';
</pre>
 
The HW cursor support was very laggy when tried on 20.03 so enabling the software cursor may be desired:


<hr />
<pre>
services.xserver.deviceSection = "Option \"SWcursor\" \"on\"";
</pre>


== Resources ==
== Resources ==


Product page with spec sheet: [https://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438]
* [https://www.hardkernel.com/shop/odroid-c2/ Official product page]
* NixOS Image Build for [https://github.com/georgewhewell/nixos-nanopim3/blob/master/hardware/boards/odroid-c2.nix Odroid-C2 by George Whewell]