NixOS on ARM/ODROID-C2: Difference between revisions

From NixOS Wiki
imported>Grahamc
Roughly document installing to the odroid c2
imported>Makefu
cleanup
Line 9: Line 9:
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.
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.


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-18.09-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 46:
</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 77: Line 76:
== Resources ==
== Resources ==


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

Revision as of 09:35, 6 January 2019

Status

ODROID-C2 support is being worked on by @grahamc. Mainline kernel from NixOS has been reported as working[1]. A non-specified build from mainline u-boot also has been reported to work.

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, 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.

  1. Download the sd-image from Hydra at https://hydra.nixos.org/job/nixos/release-18.09-aarch64/nixos.sd_image.aarch64-linux/latest
  2. Copy it to the SD card
  3. Mount first partition to /mnt with sudo mount /dev/mmcblk0p1 /mnt
  4. 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

it will look something like this:

$ cat  /mnt/extlinux/extlinux.conf
# Generated file, all changes will be lost on nixos-rebuild!

# Change this to e.g. nixos-42 to temporarily boot to an older configuration.
DEFAULT nixos-default

MENU TITLE ------------------------------------------------------------
TIMEOUT 30

LABEL nixos-default
  MENU LABEL NixOS - Default
  LINUX ../nixos/gz1chw67hj8fj2b3xdrkv1nxrv8jvdzv-linux-4.19.13-Image
  INITRD ../nixos/4gifkl2yv2g58nxmf6z68y42s70xrsg0-initrd-initrd
  FDTDIR ../nixos/gz1chw67hj8fj2b3xdrkv1nxrv8jvdzv-linux-4.19.13-dtbs
  APPEND systemConfig=/nix/store/...-nixos-system-nixos-xxx.xxx.xxx.xxx init=/nix/store/...-nixos-system-nixos-xx.xx.xxxx.xxx init loglevel=7 cma=32M console=ttyAML0,115200n8

and then boot the sdcard.

Once booted, partition your on-board emmc like:

Device         Boot    Start      End  Sectors  Size Id Type
/dev/mmcblk0p1          2048   264191   262144  128M  c W95 FAT32 (LBA)
/dev/mmcblk0p2 *      264192 50595839 50331648   24G 83 Linux
/dev/mmcblk0p3      50595840 61071359 10475520    5G 83 Linux

note **p2** is bootable.

$ mkfs.ext4 /dev/mmcblk0p2
$ mkswap /dev/mmcblk0p3
$ swapon /dev/mmcblk0p3
$ mount /dev/mmcblk0p2 /mnt
$ nixos-generate-config /mnt
$ nixos-install
$ reboot

Serial console

I used minicom to access the serial:

$ cat /etc/minirc.odroid-c2 
# Machine-generated file - use "minicom -s" to change parameters.
pu port             /dev/ttyUSB0
pu lock             /var/lock
pu rtscts           No

then run sudo minicom to access the serial console.


Resources