一. 交叉編譯工具
1.1. 由於FC100S不帶硬件浮點,所以需要下載arm-linux-gnueabi版本(不能下載arm-linux-gnueabihf)
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz tar xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz
1.2. 添加到環境變量
臨時方法:
PATH="$PATH:(你的路徑)/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin
永久方法:
打開文件
sudo vim /etc/profile
在最后一行添加
export PATH=$PATH:(你的路徑)/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/
source /etc/profile #立即生效
1.3. 查看版本
arm-linux-gnueabi-gcc -v
一. uboot
1.1. uboot主線下載
1.1.1. lichee zero和nano在一個主線上,只是不同分支而已
git clone https://github.com/Lichee-Pi/u-boot.git -b nano-v2018.01
1.2. 編譯
1.2.1. load config
# 此處告知make采用arm-linux-gnueabi下的所有交叉編譯工具,目標架構為Arm,設定各項默認配置為 nano 的spiflash支持版 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- licheepi_nano_spiflash_defconfig # 若不帶spi-flash的板子,請換成 licheepi_nano_defconfig
1.2.2. 可視化配置
make ARCH=arm menuconfig
1.2.3. make 編譯
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
1.2.3.1. 如出現如下錯誤:
解決辦法:sudo apt install swig
1.3.2. 編譯完成后,在當前目錄下生成了u-boot-sunxi-with-spl.bin,可以燒錄到TF卡8K偏移處啟動
二. kernal
2.1. kernal主線
2.1.1. lichee zero和nano在一個主線上,只是不同分支而已
git clone https://github.com/Lichee-Pi/linux.git -b nano-5.2-tf
2.2. 編譯
2.2.1. load .config
2.2.1.1. 下載.config
wget http://nano.lichee.pro/_static/step_by_step/lichee_nano_linux.config
2.2.1.2. 修改下載的配置文件名為.config
mv lichee_nano_linux.config ./config
2.2.1.3. 為了日后方便我把.config生成lichee_nano_5.2_defconfig。以后就所以lichee_nano_5.2_defconfig作為默認配置文件
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- savedefconfig mv arch/arm/configs/defconfig arch/arm/configs/lichee_nano_5.2_defconfig
2.2.2. 可視化配置
make ARCH=arm menuconfig
2.2.3. make 編譯
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
a. 編譯完成后,zImage在arch/arm/boot/下,dtb在arch/arm/boot/dts/下
三. rootfs
3.1. buildroot
3.1.1. 下載
wget https://buildroot.org/downloads/buildroot-2020.05.tar.gz
3.1.2. buildroot 配置
a. make menuconfig
Target options -- Target Architecture (ARM (little endian)) -- Target Variant arm926t Toolchain
-- Toolchain type (External toolchain)
-- (補充你的交叉編譯工具路徑xxx)Toolchain path
-- ($(ARCH)-linux-gnueabi) Toolchain prefix #設置編譯器前綴
-- External toolchain gcc version (7.x) ---> #選擇交叉工具版本
-- External toolchain kernel headers series (4.10.x) ---> #選擇kernal header 版本
-- C library (musl) # 使用musl減小最終體積
-- Toolchain has SSP support? System configuration
-- /dev management (Dynamic using devtmpfs + eudev) -- Use syslinks to /usr .... # 啟用/bin, /sbin, /lib的鏈接 -- Enable root login # 啟用root登錄 -- Run a getty after boot # 啟用登錄密碼輸入窗口 -- remount root filesystem # 重新掛載根文件系統到可讀寫 -- Install Timezone info # 安裝時區信息。我的程序需要所以就打開了這個玩意 -- timezone list (asia) -- default local time (Asia/Shanghai) Target Packages -- mount/umount # 如果要用overlayfs,那就要用這個掛載
3.2. debain
下載路徑一:debootstrap --foreign --verbose --arch=armel stretch rootfs http://ftp2.cn.debian.org/debian 下載路徑二:debootstrap --foreign --verbose --arch=armel stretch rootfs https://mirrors.tuna.tsinghua.edu.cn/debian/ //清華大學開源軟件鏡,下載速度快
3.2.1. 關於eabi,armel, armhf,arm64 之間的區別
eabi:embedded applicaion binary interface,嵌入式二進制接口
armel:arm eabi little endian的縮寫,軟件浮點。
armhf:arm hard float的縮寫,硬件浮點。
arm64:64位的arm默認就是hf的,因此不需要hf的后綴。
3.3.x 網絡配置
參考:https://www.cnblogs.com/linux-37ge/p/12853968.html 4.3. 網絡配置