This SBC can run both mainline and device-specific kernel. Mainline kernel allows you to run X but it can have bugs due to early state of panfrost support for this GPU. Also, there is no sound support yet.
This SBC has a switch to change its boot sequence: it can be booted either from SPI flash or from eMMC/SD. If you prefer the first case, you don’t need to worry about u-boot
UART tty address depends on kernel used: /dev/ttyAML0 for mainline and /dev/ttyS0 for Hardkernel. Baud rate is 115200.
There are currently no open-source tools for creating bootable u-boot image. SoC is not yet supported in ATF either. ALARM provides packages u-boot binary with a script to flash this image
Odroid N2 can use either SPI flash or eMMC/SD as boot device. The former uses petitboot image which allows you to choose kernel, ramdisk and device tree blob and boots them uses kexec. In the latter case you should use MBR partition table to not interfere with u-boot.
After creating partitions mount them and unpack rootfs archive.
U-boot searches for boot script (boot.scr) on partitions it can read from (FAT32, ext2 / 3 / 4). Depending on kernel you use you should create different scripts.
This is default choice. You should create u-boot images for kernel and ramdisk:
mkimage -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -d Image uImage
mkimage -A arm -T ramdisk -d initramfs-linux.img initramfs-linux.uimg
The script boot.cmd should look like the following:
setenv bootargs "console=ttyAML0,115200n8 root=/dev/<partname> rw rootwait clk_ignore_unused"
load mmc 1:1 ${kernel_addr_r} /uImage
load mmc 1:1 ${ramdisk_addr_r} /initramfs-linux.uimg
load mmc 1:1 ${fdt_addr_r} /dtbs/amlogic/meson-g12b-odroid-n2.dtb
bootm ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
Make sure you have added clk_ignore_unused parameter and used bootm command. After creating this file, create script by running:
mkimage -A arm -T script -d boot.cmd boot.scr
After creating all files you should be able to boot your board
Since kernel 5.8 booting with legacy u-boot image fails. Instead you should use FIT image created with the following command:
mkimage -A arm64 -T kernel -O linux -f auto -C none -a 0x1080000 -e 0x1080000 -d /boot/Image -b /boot/dtbs/amlogic/meson-g12b-odroid-n2.dtb -i /boot/initramfs-linux.img kernel.itb
For some reason this command demands write permissions on these source files however it doesn’t change them. This image contains all files needed for boot process so your boot.cmd should look like following:
load mmc 1:1 ${kernel_addr_r} /kernel.itb
setenv bootargs "console=ttyAML0,115200n8 root=/dev/<partname> rw rootwait clk_ignore_unused"
bootm ${kernel_addr_r}
boot.scr is created with same command as in previous section.
In this case you you should create only ramdisk u-boot image:
mkimage -A arm -T ramdisk -d initramfs-linux-n2.img initramfs-linux-n2.uimg
The script should look as follows:
setenv bootargs "console=ttyS0,115200n8 root=/dev/<partname> rw rootwait"
load mmc 1:1 ${kernel_addr_r} /Image
load mmc 1:1 ${ramdisk_addr_r} /initramfs-linux-n2.uimg
load mmc 1:1 ${fdt_addr_r} /dtbs-n2/amlogic/meson64_odroidn2.dtb
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
Use same command as in previous section to create u-boot script. Note that in this case booti command is used.