Lichee Nano初体验

一. 交叉编译工具

    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. 网络配置

 

 

 

 参考文献:https://www.freesion.com/article/98502336/

 参考文献:https://www.cnblogs.com/linux-37ge/p/12688735.html

posted @ 2020-06-01 00:03  三七鸽  阅读(1624)  评论(0编辑  收藏  举报