sites

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

odroidc2-mainline.html.md (3721B)


      1 Mainline U-Boot on Odroid C2
      2 ============================
      3 
      4 Booting mainline u-boot on the Odroid C2 is fairly trivial, but
      5 unfortunately, we still require the binary blobs provided by hardkernel.
      6 This short guide should list all the steps needed in one place, for easy
      7 future reference.
      8 
      9 With Linux 4.14, USB support seems broken, Gbit ethernet is okay.
     10 
     11 
     12 ARM64 Toolchain
     13 ---------------
     14 
     15 I used a linaro aarch64 toolchain found at
     16 [https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/](https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/).
     17 
     18 Download it, extract it, and export **$PATH** and **$compiler** for easy
     19 use later on.
     20 
     21 	# mkdir odroidc2 && cd odroidc2
     22 	# wget ...
     23 	# tar xf ...
     24 	# export PATH="/path/to/toolchain/bin:$PATH"
     25 	# export compiler="aarch64-linux-gnu-"
     26 
     27 
     28 Compiling mainline u-boot
     29 -------------------------
     30 
     31 After extracting and preparing the env, we need to compile mainline
     32 u-boot. We can grab the official git repo:
     33 
     34 	# git clone git://git.denx.de/u-boot
     35 
     36 Go inside the repo, and compile it.
     37 
     38 	# make ARCH=arm CROSS_COMPILE=$compiler odroid-c2_defconfig
     39 	# make ARCH=arm CROSS_COMPILE=$compiler -j4
     40 	# mv u-boot.bin ../ && cd ..
     41 
     42 This will provide us with **u-boot.bin** we'll use later on.
     43 
     44 
     45 Providing hardkernel's binary blobs
     46 -----------------------------------
     47 
     48 Let's grab a tarball of hardkernel's u-boot repository. A tested
     49 revision is **205c7b3259559283161703a1a200b787c2c445a5**. We will also
     50 need **meson-tools** - where we find **amlbootsig**.
     51 
     52 	# wget -O hardkernel-uboot.tgz https://github.com/hardkernel/u-boot/archive/205c7b3259559283161703a1a200b787c2c445a5.tar.gz
     53 	# tar xf hardkernel-uboot.tgz
     54 	# mv u-boot-205c7b3259559283161703a1a200b787c2c445a5 hardkernel-uboot
     55 	# git clone https://github.com/afaerber/meson-tools
     56 	# cd meson-tools
     57 	# make
     58 	# cd ../hardkernel-uboot
     59 
     60 Now we have to compile and use the **fip_create** program to prepare our
     61 .bin files.
     62 
     63 	# make -C tools/fip_create
     64 	# 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
     65 	# cat fip/gxb/bl2.package fip.bin > boot_new.bin
     66 	# ../meson-tools/amlbootsig boot_new.bin u-boot.img
     67 	# dd if=u-boot.img of=../u-boot.gxbb bs=512 skip=96
     68 	# cp sd_fuse/bl1.bin.hardkernel ../
     69 	# cd ..
     70 
     71 Now we have it ready, and we can proceed with the final step:
     72 
     73 
     74 Flashing this stuff to a microsd card
     75 -------------------------------------
     76 
     77 We should be in the directory where **bl1.bin.hardkernel** and
     78 **u-boot.gxbb** are. To "flash" this on our microsd card we will simply
     79 use **dd**, like always.
     80 
     81 	# dd if=bl1.bin.hardkernel of=/dev/mmcblk0 conv=fsync bs=1 count=422
     82 	# dd if=bl1.bin.hardkernel of=/dev/mmcblk0 conv=fsync bs=512 skip=1 seek=1
     83 	# dd if=u-boot.gxbb of=/dev/mmcblk0 conv=fsync bs=512 seek=97
     84 	# sync; sync; sync
     85 
     86 If this went well, all that is left is providing a **boot.scr**
     87 
     88 
     89 boot.scr
     90 --------
     91 
     92 **boot.cmd**:
     93 
     94 	setenv bootargs console=ttyAML0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait
     95 	#setenv initrd_high "0xffffffff"
     96 	#setenv fdt_high "0xffffffff"
     97 	load mmc 0 0x43000000 ${fdtfile} || load mmc 0 0x43000000 boot/${fdtfile}
     98 	load mmc 0 0x41000000 Image || load mmc  0 0x41000000 boot/Image
     99 	#load mmc 0 0x50000000 uInitrd
    100 	#booti 0x41000000 0x50000000 0x43000000
    101 	booti 0x41000000 - 0x43000000
    102 
    103 Create **boot.scr** out of it:
    104 
    105 	# mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.cmd boot.scr
    106 
    107 Copy the .dtb from your linux sources. It's found in
    108 arch/arm64/boot/dts: **meson-gxbb-odroidc2.dtb**. The u-boot looks for
    109 it in a directory called **amlogic** on the first partition. Of course,
    110 remember to copy your **Image** as well.