--- wikisrc/ports/evbarm/odroid-c1.mdwn 2015/10/28 18:05:41 1.20 +++ wikisrc/ports/evbarm/odroid-c1.mdwn 2017/04/12 23:56:35 1.28 @@ -1,4 +1,4 @@ -[[!meta title="NetBSD/evbarm on Hardkernel ODROID-C1"]] +[[!meta title="NetBSD/evbarm on Hardkernel ODROID-C1 and ODROID-C1+"]] [ODROID-C1](http://www.hardkernel.com/main/products/prdt_info.php?g_code=G141578608433&tab_idx=1) was a $35 quad-core SBC from Hardkernel. ODROID-C1 support was introduced in NetBSD 7.0. It has been succeeded by the [ODROID-C1+](http://www.hardkernel.com/main/products/prdt_info.php?g_code=G143703355573), which is supported by the same NetBSD kernel. @@ -10,8 +10,8 @@ - SMP supported - PL310 L2 cache controller - GIC - - A5 watchdog timer - A5 global timer + - Watchdog timer - "SDHC" and "SDIO" SD/MMC controllers (DMA) - Serial console - Framebuffer console @@ -28,12 +28,33 @@ - I2C - Audio -# Installation +# Installation (NetBSD -current after 20170412) * Start with an ARMv7 image from *evbarm-earmv7hf/binary/gzimg/* such as *armv7.img* * Build U-Boot for ODROID-C1 * Pre-built binaries here: -* Note the location and size of the FFS partition in the * armv7.img* disklabel: +* Write the bootloader to the empty space at the start of the base image: +[[!template id=programlisting text=""" +# dd if=bl1.bin.hardkernel of=armv7.img bs=1 count=442 conv=notrunc +# dd if=bl1.bin.hardkernel of=armv7.img bs=512 skip=1 seek=1 conv=notrunc +# dd if=u-boot.bin of=armv7.img bs=512 seek=64 conv=notrunc +"""]] +* Write the image to an SD card. +* Edit *boot.ini* on the MS-DOS partition. Note that the default boot.ini has `console=fb` in `bootargs`, which you should remove if you want serial console: +[[!template id=programlisting text=""" +ODROIDC-UBOOT-CONFIG + +setenv bootargs "root=ld0a awge0.mac-address=${ethaddr} console=fb" +setenv bootcmd "fatload mmc 0:1 0x21000000 netbsd-ODROID-C1.ub; bootm 0x21000000" +run bootcmd +"""]] + +# Installation (NetBSD 7.0/7.1) + +* Start with an ARMv7 image from *evbarm-earmv7hf/binary/gzimg/* such as *armv7.img* +* Build U-Boot for ODROID-C1 + * Pre-built binaries here: +* Note the location and size of the FFS partition in the *armv7.img* disklabel: [[!template id=programlisting text=""" # $TOOLDIR/bin/nbdisklabel -M evbarm -B le armv7.img ... @@ -67,15 +88,15 @@ Which partition do you want to change?: Should we write new partition table? [n] y """]] * Write the image to an SD card. -* Copy the kernel (netbsd.ub) for your board to the root of the MS-DOS partition on the SD card. -* Create or edit *boot.ini* on the MS-DOS partition: +* Edit *boot.ini* on the MS-DOS partition. Note that the default boot.ini has `console=fb` in `bootargs`, which you should remove if you want serial console: [[!template id=programlisting text=""" ODROIDC-UBOOT-CONFIG -setenv bootargs "root=ld0f awge0.mac-address=${ethaddr}" +setenv bootargs "root=ld0f awge0.mac-address=${ethaddr} console=fb" setenv bootcmd "fatload mmc 0:1 0x21000000 netbsd.ub; bootm 0x21000000" run bootcmd -"""]] +"""]] + * On first boot, it will stop because of the wrong device in /etc/fstab. Take this opportunity to grow the root file-system: [[!template id=programlisting text=""" # fdisk -u ld0 @@ -166,6 +187,54 @@ gpioctl gpio4 sys_led off gpioctl gpio4 sys_led toggle """]] +# U-Boot Environment + +To read/write U-Boot environment variables from NetBSD, download and compile the following program: + +# Automatically booting a backup kernel + +*These instructions assume the kernels live on eMMC. Adjust devices accordingly for SD card setup.* + +To setup an ODROID-C1 to fall back to a recovery kernel in the event of a boot failure, install the recovery kernel as /boot/onetbsd.ub. + +Create /boot/boot.ini as follows: +[[!template id=programlisting text=""" +ODROIDC-UBOOT-CONFIG +setenv bootargs "root=ld0f awge0.mac-address=${ethaddr}" +fatload mmc 0:1 0x22000000 boot.scr +source 0x22000000 +"""]] + +Create /boot/boot.txt: +[[!template id=programlisting text=""" +# regenerate with: +# mkubootimage -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/odroidc1 boot" boot.txt boot.scr + +setenv rescue_kernel "onetbsd.ub" +setenv kernel "netbsd.ub" + +if test ${boot_rescue} = false; then + setenv boot_rescue true + saveenv + fatload mmc 0:1 0x21000000 ${kernel} + mw.l c1109900 0f08ffff # arm watchdog + bootm 0x21000000 +else + fatload mmc 0:1 0x21000000 ${rescue_kernel} + bootm 0x21000000 +fi +"""]] + +Generate boot.scr from boot.txt: +[[!template id=programlisting text=""" +mkubootimage -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/odroidc1 boot" /boot/boot.txt /boot/boot.scr +"""]] + +Install the **uenv** tool from above and add the following to root's crontab: +[[!template id=programlisting text=""" +@reboot /usr/local/sbin/uenv ld0 boot_rescue false +"""]] + # Documentation Amlogic S805 datasheet: @@ -184,3 +253,4 @@ From [ODROID Forum](http://forum.odroid. 3.3V LVTTL """]] +