sites

parazyd.cf website
git clone git://parazyd.org/sites.git
Log | Files | Refs

commit 373a9b1c939ae8dc8f6582209942453837696af8
parent bfe582374d3031adca7efaa59322785f18b3f605
Author: parazyd <parazyd@dyne.org>
Date:   Tue, 10 Oct 2017 19:52:41 +0200

add odroidc2-mainline.html.md

Diffstat:
Mconfig.mk | 3++-
Mdoc/index.html.md | 1+
Adoc/odroidc2-mainline.html.md | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 110 insertions(+), 1 deletion(-)

diff --git a/config.mk b/config.mk @@ -10,4 +10,5 @@ PAGES = \ projects.html \ \ doc/index.html \ - doc/arm-ramdisk.html + doc/arm-ramdisk.html \ + doc/odroidc2-mainline.html diff --git a/doc/index.html.md b/doc/index.html.md @@ -1,5 +1,6 @@ Knowledgebase ============= +* [Mainline U-Boot on Odroid C2](odroidc2-mainline.html) * [Setting up a sunxi board with a ramdisk and ATA over Ethernet rootfs boot](arm-ramdisk.html) diff --git a/doc/odroidc2-mainline.html.md b/doc/odroidc2-mainline.html.md @@ -0,0 +1,107 @@ +Mainline U-Boot on Odroid C2 +============================ + +Booting mainline u-boot on the Odroid C2 is fairly trivial, but +unfortunately, we still require the binary blobs provided by hardkernel. +This short guide should list all the steps needed in one place, for easy +future reference. + + +ARM64 Toolchain +--------------- + +I used a linaro aarch64 toolchain found at +[https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/](https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/). + +Download it, extract it, and export `$PATH` and `$compiler` for easy use +later on. + + # mkdir odroidc2 && cd odroidc2 + # wget ... + # tar xf ... + # export PATH="/path/to/toolchain/bin:$PATH" + # export compiler="aarch64-linux-gnu-" + + +Compiling mainline u-boot +------------------------- + +After extracting and preparing the env, we need to compile mainline +u-boot. We can grab the official git repo: + + # git clone git://git.denx.de/u-boot + +Go inside the repo, and compile it. + + # make ARCH=arm CROSS_COMPILE=$compiler odroid-c2_defconfig + # make ARCH=arm CROSS_COMPILE=$compiler -j4 + # mv u-boot.img ../ && cd .. + +This will provide us with `u-boot.img` we'll use later on. + + +Providing hardkernel's binary blobs +----------------------------------- + +Let's grab a tarball of hardkernel's u-boot repository. A tested +revision is `205c7b3259559283161703a1a200b787c2c445a5`. We will also +need `meson-tools` - where we find `amlbootsig`. + + # wget -O hardkernel-uboot.tgz https://github.com/hardkernel/u-boot/archive/205c7b3259559283161703a1a200b787c2c445a5.tar.gz + # tar xf hardkernel-uboot.tgz + # mv u-boot-205c7b3259559283161703a1a200b787c2c445a5 hardkernel-uboot + # git clone https://github.com/afaerber/meson-tools + # cd meson-tools + # make + # cd ../hardkernel-uboot + +Now we have to compile and use the `fip_create` program to prepare our +.bin files. + + # make -C tools/fip_create + # tools/fip_create/fip_create --bl30 fip/gxb/bl30.bin --bl301 fip/gxb/bl301.bin --bl31 fip/gxb/bl31.bin --bl33 ../u-boot.bin fip.bin + # cat fip/gxb/bl2.package fip.bin > boot_new.bin + # ../meson-tools/amlbootsig boot_new.bin u-boot.img + # dd if=u-boot.img of=../u-boot.gxbb bs=512 skip=96 + # cp sd_fuse/bl1.bin.hardkernel ../ + # cd .. + +Now we have it ready, and we can proceed with the final step: + + +Flashing this stuff to a microsd card +------------------------------------- + +We should be in the directory where `bl1.bin.hardkernel` and +`u-boot.gxbb` are. To "flash" this on our microsd card we will simply +use `dd`, like always. + + # dd if=bl1.bin.hardkernel of=/dev/mmcblk0 conv=fsync bs=1 count=422 + # dd if=bl1.bin.hardkernel of=/dev/mmcblk0 conf=fsync bs=512 skip=1 seek=1 + # dd if=u-boot.gxbb of=/dev/mmcblk0 conf=fsync bs=512 seek=97 + # sync; sync; sync + +If this went well, all that is left is providing a `boot.scr` + + +boot.scr +-------- + +**boot.cmd**: + + setenv bootargs console=ttyS0,115200 console=ttyAML0,115200n8 init=/init root=/dev/mmcblk0p2 rw rootwait + setenv initrd_high "0xffffffff" + setenv fdt_high "0xffffffff" + load mmc 0 0x43000000 ${fdtfile} || load mmc 0 0x43000000 boot/${fdtfile} + load mmc 0 0x41000000 Image || load mmc 0 0x41000000 boot/Image + #load mmc 0 0x50000000 uInitrd + #booti 0x41000000 0x50000000 0x43000000 + booti 0x41000000 0x43000000 + +Create `boot.scr` out of it: + + # mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.cmd boot.scr + +Copy the .dtb from your linux sources. It's found in arch/arm64/boot/dts: +`meson-gxbb-odroidc2.dtb`. Of course, remember to copy your `Image` as +well.