§2023-08-26
-
[Compile u-boot for odroid-hc4](https://u-boot.readthedocs.io/en/latest/board/amlogic/odroid-hc4.html?highlight=odroid-hc4
-
compile natively@manjaroArchlinux failed
-
cross compile on a surfacePro, OK!
git clone https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01
mv u-boot u-boot-odroid-hc4
alexlai@SurfacePro:~/build$ export ARCH=arm64
export CROSS_COMPILE=aarch64-none-elf-
export PATH=/opt/toolchains/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux/bin:$PATH
alexlai@SurfacePro:~/build$ aarch64-none-elf-gcc -v
組み込み spec を使用しています。
COLLECT_GCC=aarch64-none-elf-gcc
COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin/../libexec/gcc/aarch64-none-elf/4.8.3/lto-wrapper
ターゲット: aarch64-none-elf
configure 設定: /cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/src/gcc-linaro-4.8-2013.11/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=aarch64-none-elf --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/install --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/install/aarch64-none-elf --without-headers --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --with-arch=armv8-a --disable-__cxa_atexit --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/aarch64-none-elf-linux/.build/aarch64-none-elf/build/static --enable-lto --enable-linker-build-id --disable-libmudflap --disable-libgomp --disable-libssp --disable-libstdcxx-pch --enable-multiarch --disable-multilib --enable-languages=c,c++,fortran
スレッドモデル: single
gcc バージョン 4.8.3 20131111 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10)
make odroidc4_defconfig
make
...
Building /home/alexlai/build/u-boot-odrid-hc4/build/fip/fip.bin...
Amlogic img found, use new FIP structure!
Creating "/home/alexlai/build/u-boot-odrid-hc4/build/fip/fip.bin"
Firmware Image Package ToC:
---------------------------
- SCP Firmware BL3-0: offset=0x4000, size=0xD400
- EL3 Runtime Firmware BL3-1: offset=0x14000, size=0x2B000
- Non-Trusted Firmware BL3-3: offset=0x40000, size=0xB4C60
---------------------------
# build final bootloader
Building /home/alexlai/build/u-boot-odrid-hc4/sd_fuse/u-boot.bin...
/home/alexlai/build/u-boot-odrid-hc4/sd_fuse/u-boot.bin is updated.
alexlai@SurfacePro:~/build/u-boot-odrid-hc4$ ls sd_fuse/
sd_fusing.sh u-boot.bin u-boot.bin.sd.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl
Then
alexlai@192.168.48.131's password:
sd_fusing.sh 100% 517 190.0KB/s 00:00
u-boot.bin 100% 855KB 10.2MB/s 00:00
u-boot.bin.sd.bin 100% 856KB 10.0MB/s 00:00
u-boot.bin.usb.bl2 100% 64KB 6.2MB/s 00:00
u-boot.bin.usb.tpl
(chroot) hc4Gentoo /usr/src/u-boot-odroid-hc4 # ./sd_fusing.sh /dev/sda
1710+1 records in
1710+1 records out
875888 bytes (876 kB, 855 KiB) copied, 0.0252879 s, 34.6 MB/s
eject: /dev/sda: is not hot-pluggable device
Finished.
-
prepare boot partition
-
(chroot) hc4Gentoo /usr/src/u-boot-odroid-hc4 # mount /dev/sda1 /mnt (chroot) hc4Gentoo /usr/src/u-boot-odroid-hc4 # mount /dev/mmcblk0p1 /opt (chroot) hc4Gentoo /usr/src/u-boot-odroid-hc4 # ls /opt Image Image.gz boot.ini dtbs initramfs-linux.img initramfs-linux.uimg u-boot.bin (chroot) hc4Gentoo /usr/src/u-boot-odroid-hc4 # cd ../linux-6.1.46-gentoo/ (chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # ls arch/arm64/boot/ Image Image.gz Makefile dts install.sh (chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # cp -v arch/arm64/boot/Image* /mnt 'arch/arm64/boot/Image' -> '/mnt/Image' 'arch/arm64/boot/Image.gz' -> '/mnt/Image.gz'
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # mkdir -p /mnt/dts/amlogic (chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # cp -v arch/arm64/boot/dts/amlogic/* /mnt/dts/amlogic/
3. initramfs-linux.img initramfs-linux.uimg
emerge dracut
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # dracut --kver 6.1.46-gentoo --force dracut: Executing: /usr/bin/dracut --kver 6.1.46-gentoo --force dracut: dracut module 'dash' will not be installed, because command 'dash' could not be found! dracut: dracut module 'mksh' will not be installed, because command 'mksh' could not be found! dracut: dracut module 'systemd-integritysetup' will not be installed, because command '/lib/systemd/systemd-integritysetup' could not be found! dracut: dracut module 'systemd-integritysetup' will not be installed, because command '/lib/systemd/system-generators/systemd-integritysetup-generator' could not be found! dracut: dracut module 'systemd-veritysetup' will not be installed, because command '/lib/systemd/systemd-veritysetup' could not be found! dracut: dracut module 'systemd-veritysetup' will not be installed, because command '/lib/systemd/system-generators/systemd-veritysetup-generator' could not be found! dracut: dracut module 'modsign' will not be installed, because command 'keyctl' could not be found! dracut: dracut module 'busybox' will not be installed, because command 'busybox' could not be found! dracut: dracut module 'dbus-broker' will not be installed, because command 'dbus-broker' could not be found! dracut: dracut module 'rngd' will not be installed, because command 'rngd' could not be found! dracut: dracut module 'connman' will not be installed, because command 'connmand' could not be found! dracut: dracut module 'connman' will not be installed, because command 'connmanctl' could not be found! dracut: dracut module 'connman' will not be installed, because command 'connmand-wait-online' could not be found! dracut: dracut module 'network-legacy' will not be installed, because command 'dhclient' could not be found! dracut: dracut module 'network-wicked' will not be installed, because command 'wicked' could not be found! dracut: 62bluetooth: Could not find any command of '/usr/lib/bluetooth/bluetoothd /usr/libexec/bluetooth/bluetoothd'! dracut: dracut module 'lvmmerge' will not be installed, because command 'lvm' could not be found! dracut: dracut module 'lvmthinpool-monitor' will not be installed, because command 'lvm' could not be found! dracut: dracut module 'btrfs' will not be installed, because command 'btrfs' could not be found! dracut: 90crypt: Could not find any command of '/lib/systemd/systemd-cryptsetup cryptsetup'! dracut: dracut module 'dm' will not be installed, because command 'dmsetup' could not be found! dracut: dracut module 'dmraid' will not be installed, because command 'dmraid' could not be found! dracut: dracut module 'dmsquash-live-ntfs' will not be installed, because command 'ntfs-3g' could not be found! dracut: dracut module 'lvm' will not be installed, because command 'lvm' could not be found! dracut: dracut module 'mdraid' will not be installed, because command 'mdadm' could not be found! dracut: dracut module 'multipath' will not be installed, because command 'multipath' could not be found! dracut: dracut module 'pcsc' will not be installed, because command 'pcscd' could not be found! dracut: dracut module 'tpm2-tss' will not be installed, because command 'tpm2' could not be found! dracut: dracut module 'cifs' will not be installed, because command 'mount.cifs' could not be found! dracut: dracut module 'fcoe' will not be installed, because command 'dcbtool' could not be found! dracut: dracut module 'fcoe' will not be installed, because command 'fipvlan' could not be found! dracut: dracut module 'fcoe' will not be installed, because command 'lldpad' could not be found! dracut: dracut module 'fcoe' will not be installed, because command 'fcoemon' could not be found! dracut: dracut module 'fcoe' will not be installed, because command 'fcoeadm' could not be found! dracut: dracut module 'fcoe-uefi' will not be installed, because command 'dcbtool' could not be found! dracut: dracut module 'fcoe-uefi' will not be installed, because command 'fipvlan' could not be found! dracut: dracut module 'fcoe-uefi' will not be installed, because command 'lldpad' could not be found! dracut: dracut module 'iscsi' will not be installed, because command 'iscsi-iname' could not be found! dracut: dracut module 'iscsi' will not be installed, because command 'iscsiadm' could not be found! dracut: dracut module 'iscsi' will not be installed, because command 'iscsid' could not be found! dracut: dracut module 'nbd' will not be installed, because command 'nbd-client' could not be found! dracut: 95nfs: Could not find any command of 'rpcbind portmap'! dracut: dracut module 'nvmf' will not be installed, because command 'nvme' could not be found! dracut: dracut module 'biosdevname' will not be installed, because command 'biosdevname' could not be found! dracut: dracut module 'memstrack' will not be installed, because command 'memstrack' could not be found! dracut: memstrack is not available dracut: If you need to use rd.memdebug>=4, please install memstrack and procps-ng dracut: dracut module 'squash' will not be installed, because command 'mksquashfs' could not be found! dracut: dracut module 'squash' will not be installed, because command 'unsquashfs' could not be found! dracut: *** Including module: systemd *** dracut: *** Including module: systemd-initrd *** dracut: *** Including module: i18n *** dracut: *** Including module: kernel-modules *** dracut: *** Including module: kernel-modules-extra *** dracut: *** Including module: nvdimm *** dracut: *** Including module: qemu *** dracut: *** Including module: qemu-net *** dracut: *** Including module: lunmask *** dracut: *** Including module: resume *** dracut: *** Including module: rootfs-block *** dracut: *** Including module: terminfo *** dracut: *** Including module: udev-rules *** dracut: Skipping udev rule: 40-redhat.rules dracut: Skipping udev rule: 50-firmware.rules dracut: Skipping udev rule: 50-udev.rules dracut: Skipping udev rule: 91-permissions.rules dracut: Skipping udev rule: 80-drivers-modprobe.rules dracut: *** Including module: virtiofs *** dracut: *** Including module: dracut-systemd *** dracut: *** Including module: usrmount *** dracut: *** Including module: base *** dracut: *** Including module: fs-lib *** dracut: *** Including module: shutdown *** dracut: *** Including modules done *** dracut: *** Installing kernel module dependencies *** dracut: *** Installing kernel module dependencies done *** dracut: *** Resolving executable dependencies *** dracut: *** Resolving executable dependencies done *** dracut: *** Hardlinking files *** dracut: Mode: real dracut: Method: sha256 dracut: Files: 1161 dracut: Linked: 4 files dracut: Compared: 0 xattrs dracut: Compared: 447 files dracut: Saved: 6.9 KiB dracut: Duration: 0.023814 seconds dracut: *** Hardlinking files done *** dracut: *** Generating early-microcode cpio image *** dracut: *** Store current command line parameters *** dracut: *** Stripping files *** dracut: *** Stripping files done *** dracut: *** Creating image file '/boot/initramfs-6.1.46-gentoo.img' *** dracut: dracut: using auto-determined compression method 'gzip' dracut: *** Creating initramfs image file '/boot/initramfs-6.1.46-gentoo.img' done ***
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # ls /boot/
initramfs-6.1.46-gentoo.img
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # ls /mnt
Image Image.gz dts
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # cp -v in
include/ init/
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # cp -v /boot/initramfs-6.1.46-gentoo.img /mnt/
'/boot/initramfs-6.1.46-gentoo.img' -> '/mnt/initramfs-6.1.46-gentoo.img'
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # ls /mnt
Image Image.gz dts initramfs-6.1.46-gentoo.img
4. boot.ini
(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # cp -v /opt/boot.ini /mnt/ (chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # blkid /dev/mmcblk0p1: SEC_TYPE="msdos" LABEL_FATBOOT="BOOT_MNJRO" LABEL="BOOT_MNJRO" UUID="DDBA-9480" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="6319cfe2-01" /dev/mmcblk0p2: LABEL="ROOT_MNJRO" UUID="c116cbd4-ed1c-408d-88c7-6901ccb65d60" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6319cfe2-02" /dev/sda4: PARTUUID="69ed71c7-04" /dev/sda2: UUID="f4e47b4d-3ecc-4e27-83ec-4b9aafa71882" TYPE="swap" PARTUUID="69ed71c7-02" /dev/sda3: UUID="0eec5082-3336-4c1d-be70-2a9e34a8fd2d" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="69ed71c7-03" /dev/sda1: SEC_TYPE="msdos" UUID="B568-C606" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="69ed71c7-01" /dev/zram0: LABEL="zram0" UUID="17deeae7-182e-4d10-ae7f-9314089b786a" TYPE="swap"
- boot.ini
ODROIDC4-UBOOT-CONFIG
Default Console Device Setting
setenv condev "console=ttyAML0,115200n8" # on both
setenv bootlabel
setenv bootlabel "2023-08-26 From Manjaro-arm-installer To Gentoo"
Boot Args
setenv bootargs "root=PARTUUID=69ed71c7-03 rootwait rw ${condev} ${amlogic} no_console_suspend fsck.repair=yes net.ifnames=0 clk_ignore_unused quiet splash plymouth>
Set load addresses
setenv dtb_loadaddr "0x20000000" setenv loadaddr "0x1080000" setenv initrd_loadaddr "0x4080000"
Load kernel, dtb and initrd
load mmc ${devno}:1 ${loadaddr} /Image load mmc ${devno}:1 ${dtb_loadaddr} /dtbs/amlogic/meson-sm1-odroid-hc4.dtb load mmc ${devno}:1 ${initrd_loadaddr} /initramfs-linux.uimg #fdt addr ${dtb_loadaddr}
boot
booti ${loadaddr} ${initrd_loadaddr} ${dtb_loadaddr}
(chroot) hc4Gentoo /mnt # ls Image Image.gz boot.ini dts initramfs-6.1.46-gentoo.img initramfs.img (chroot) hc4Gentoo /mnt # mkimage -A arm -O linux -T ramdisk -C none -a 0x4080000 -e 0x1080000 -n "Initramfs Image" -d initramfs.img initramfs.img.uimg Image Name: Initramfs Image Created: Sat Aug 26 05:19:36 2023 Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 17641867 Bytes = 17228.39 KiB = 16.82 MiB Load Address: 04080000 Entry Point: 01080000 (chroot) hc4Gentoo /mnt # ls -l total 87112 -rwxr-xr-x 1 root root 26821120 Aug 26 04:42 Image -rwxr-xr-x 1 root root 9415577 Aug 26 04:42 Image.gz -rwxr-xr-x 1 root root 809 Aug 26 05:14 boot.ini drwxr-xr-x 3 root root 8192 Aug 26 04:44 dts -rwxr-xr-x 1 root root 17641867 Aug 26 05:03 initramfs-6.1.46-gentoo.img -rwxr-xr-x 1 root root 17641867 Aug 26 05:18 initramfs.img -rwxr-xr-x 1 root root 17641931 Aug 26 05:19 initramfs.img.uimg
(chroot) hc4Gentoo /mnt # ls Image Image.gz boot.ini dts initramfs-6.1.46-gentoo.img initramfs.img initramfs.img.uimg (chroot) hc4Gentoo /mnt # mv initramfs.img.uimg initramfs-linux.uimg <-- used by boot.ini
mkimage -A arm -O linux -T ramdisk -C none -a 0x4080000 -e 0x1080000 -n "Initramfs Image" -d initramfs.img initramfs.img.uimg