ODROID-C4

U-boot

U-boot

U-boot 必須在 x86 Linux PC 上交叉編譯。

Essential packages

你必須安裝一些必要的包來構建 u-boot。

輸入以下命令。

下面列出的一些軟件包可能不是必需的,但值得安裝,因為在構建內核時也會使用這些軟件包。

				
					$ sudo apt install  git lzop build-essential gcc  bc libncurses5-dev libc6-i386 lib32stdc++ 6 zlib1g:i386

				
			

工具鏈

點擊下方網指下載工具鏈來構建 U-boot。

下載完成後,將 tarball 解壓縮到/opt/toolchains/

				
					$ sudo mkdir -p /opt/toolchains
$ sudo tar xvf gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz -C /opt/toolchains/
$ sudo tar xvf gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz -C /opt/toolchains/
				
			

要將工具鏈路徑添加到 PATH,請將以下行貼上到 $HOME/.bashrc

				
					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
				
			

如果您再次登錄或導入以應用此更改,則可以應用更改,再次登錄或使用 source 命令評估 $HOME/.bashrc

				
					$ source ~/.bashrc
				
			

您可以在檢查工具鏈版本的同時檢查上面安裝的工具鍊是否正常工作。如果你能在行尾找到 gcc version 4.8.3 20140904 (prerelease),說明工具鏈已經安裝好了。

				
					$ aarch64-none-elf-gcc -v
Using built-in specs.
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
Target: aarch64-none-elf
Configured with: /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
Thread model: single
gcc version 4.8.3 20131111 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10) 
				
			
				
					$ ./arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=./arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux/bin/../libexec/gcc/arm-none-eabi/4.8.3/lto-wrapper
Target: arm-none-eabi
Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/src/gcc-linaro-4.8-2014.04/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-eabi --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/install --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/install/arm-none-eabi --without-headers --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --disable-__cxa_atexit --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-none-eabi-linux/.build/arm-none-eabi/build/static --enable-lto --enable-linker-build-id --enable-libmudflap --disable-libgomp --enable-libssp --disable-libstdcxx-pch --enable-multilib --enable-languages=c,c++,fortran --with-multilib-list=aprofile
Thread model: single
gcc version 4.8.3 20140401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04)
				
			

校驗和編譯

您可以從 Hardkernel’s Github 檢查 U-boot 原始碼樹。

				
					$ git clone https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01

				
			

在編譯 U-boot 之前,您必須使用以下命令配置 ODROID-C4。

				
					$ cd u-boot 
$ make odroidc4_defconfig
				
			

最後可以開始編譯U-boot。

				
					$ make

				
			

安裝

直接安裝到存儲卡

提供了腳本sd_fuse/sd_fusing.sh,它可以幫助您將引導加載程序安裝到您的空白卡 eMMC 或 MicroSD 中。

  1. 將卡插入 USB 讀卡器並連接到桌面的 USB 主機端口。
  2. 檢查 USB 讀卡器的設備路徑。
  3. 使用sd_fuse/sd_fusing.sh安裝引導加載程序二進製文件。
				
					$ cd sd_fuse
$ ./sd_fusing.sh <device/path/of/your/card>
				
			

使用 fastboot 安裝

如果你已經可以啟動你的ODROID-C4並且想要安裝一個由你構建的新 u-boot.bin。Fastboot 可幫助您將 u-boot.bin安裝到您的主板中。

				
					$ sudo fastboot flash bootloader sd_fuse/u-boot.bin

				
			

如果安裝完成,您需要使用 fastboot重新啟動 ODROID-C4。

				
					$ sudo fastboot reboot

				
			

如何在用戶空間檢查 U-Boot 版本

				
					$ grep -a -r -E -o "2015.01.{0,50}" sd_fuse/u-boot.bin | grep -a "(" | cut -d' ' -f1
2015.01-01980-gce36c0a

				
			

此頁資訊皆從 ORDOID Wiki 進行翻譯,並經由 CC BY-SA 3.0 進行分享。