紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
[开源硬件探索]LiCheePI NANO
-
核心镜像
docker run --rm -it -v /dev:/dev --privileged fishros2/licheepi /bin/bash
基本流程
1.编译uboot
cd u-boot/ git checkout nano-v2018.01 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- licheepi_nano_spiflash_defconfig # ====配置==== make ARCH=arm menuconfig 取消勾选 [] Enable a default value for bootcmd 勾选 [v] Enable boot arguments; 在下方一项中填入 bootargs 参数: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2 # =====配置/workspace/u-boot/include/configs/suniv.h====== /* * Configuration settings for new Allwinner F-series (suniv) CPU * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_H #define __CONFIG_H #define CONFIG_SUNXI_USB_PHYS 1 /* * Include common sunxi configuration where most the settings are */ #include <configs/sunxi-common.h> #define CONFIG_BOOTCOMMAND "sf probe 0 50000000; " \ "sf read 0x80C00000 0x100000 0x4000; " \ "sf read 0x80008000 0x110000 0x400000; " \ "bootz 0x80008000 - 0x80C00000" #endif /* __CONFIG_H */ # ----配置 /workspace/u-boot1/drivers/mtd/spi/spi_flash_ids.c # LINE@175 {"xt25f128b", INFO(0x0b4018, 0x0, 64 * 1024, 256, RD_FULL | WR_QPP | SECT_4K) }, make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j12
结果如下
2.编译linux内核
git clone --depth=1 -b master https://gitee.com/LicheePiNano/Linux.git cd Linux make ARCH=arm f1c100s_nano_linux_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j12 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j12 INSTALL_MOD_PATH=out modules_install
3.编译根文件系统
wget https://buildroot.org/downloads/buildroot-2021.02.4.tar.gz tar xvf buildroot-2021.02.4.tar.gz cd buildroot-2021.02.4/ make menuconfig 配置:https://wiki.sipeed.com/soft/Lichee/zh/Nano-Doc-Backup/build_sys/rootfs.html
4.合并
#!/bin/sh UBOOT_FILE=./u-boot/u-boot-sunxi-with-spl.bin DTB_FILE=./Linux/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb KERNEL_FILE=./Linux/arch/arm/boot/zImage ROOTFS_FILE=./buildroot-2021.02.4/output/images/rootfs.tar MOD_FILE=./Linux/out/lib/modules/4.15.0-rc8-licheepi-nano+ dd if=/dev/zero of=flashimg.bin bs=1M count=16 &&\ dd if=$UBOOT_FILE of=flashimg.bin bs=1K conv=notrunc &&\ dd if=$DTB_FILE of=flashimg.bin bs=1K seek=1024 conv=notrunc &&\ dd if=$KERNEL_FILE of=flashimg.bin bs=1K seek=1088 conv=notrunc &&\ mkdir rootfs tar -xvf $ROOTFS_FILE -C ./rootfs &&\ cp -r $MOD_FILE rootfs/lib/modules/ &&\ #为根文件系统制作jffs2镜像包 #--pad参数指定 jffs2大小 #由此计算得到 0x1000000(16M)-0x10000(64K)-0x100000(1M)-0x400000(4M)=0xAF0000 mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o jffs2.img &&\ dd if=jffs2.img of=flashimg.bin bs=1K seek=5184 conv=notrunc &&\ rm -rf rootfs &&\ rm jffs2.img
5.下载
开机任意输入,进入uboot,清除原有uboot sf probe 0 sf erase 0 0x100000 reset --- wget https://ghproxy.com/https://github.com/linux-sunxi/sunxi-tools/raw/master/bin/fel-sdboot.sunxi dd if=fel-sdboot.sunxi of=/dev/sda bs=1024 seek=8
sudo sunxi-fel -p spiflash-write 0 flashimg.bin
Docker构建
使用docker创建uboot、xboot、sunxi-tools环境.
docker run -it --privileged -v /dev:/dev fishros2/licheepi /bin/bash
Dockerfile
FROM ubuntu:16.04 # ENV https_proxy=http://192.168.1.107:7890 # ENV http_proxy=http://192.168.1.107:7890 # ENV all_proxy=socks5://192.168.1.107:7890 RUN apt update \ && apt install wget python3-yaml -y \ # 安装melodic && echo "chooses:\n" > fish_install.yaml \ && echo "- {choose: 5, desc: '一键安装:ROS(支持ROS和ROS2,树莓派Jetson)'}\n" >> fish_install.yaml \ && echo "- {choose: 2, desc: 更换源继续安装}\n" >> fish_install.yaml \ && echo "- {choose: 2, desc: 清理三方源}\n" >> fish_install.yaml \ && wget http://fishros.com/install -O fishros && /bin/bash fishros \ && wget http://fishros.com/install -O fishros && /bin/bash fishros \ # 进行最后的清理 && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && apt-get clean && apt autoclean RUN apt update && \ apt install gcc make cmake rsync wget unzip build-essential git bc swig libncurses-dev libpython3-dev libssl-dev -y # python3-distutils android-tools-mkbootimg RUN wget http://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/arm-linux-gnueabi/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz && \ tar -vxJf gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz RUN sudo cp -r ./gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi /opt/ && \ echo 'PATH="$PATH:/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin"' >> /etc/bash.bashrc RUN apt install git -y && \ git clone https://gitee.com/LicheePiNano/u-boot.git /workspace/u-boot && \ cd /workspace/u-boot && \ git checkout nano-lcd800480 RUN apt install python2.7 python-dev -y WORKDIR /workspace #========================================uboot======================================================== # 此处告知make采用arm-linux-gnueabi下的所有交叉编译工具,目标架构为Arm,设定各项默认配置为 nano 的spiflash支持版 # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- f1c100s_nano_uboot_defconfig # 若不带spi-flash的板子,请换成 licheepi_nano_defconfig # make ARCH=arm menuconfig # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8 #========================================sunxi-tools==================================================== RUN sudo apt-get install pkg-config libusb-1.0-0-dev -y && \ git clone -b f1c100s-spiflash https://github.com/Icenowy/sunxi-tools.git && \ cd sunxi-tools && \ make && sudo make install #========================================xboot======================================================== RUN git clone https://github.91chi.fun/https://github.com/xboot/xboot.git RUN apt install cpio -y && \ cd xboot && \ make CROSS_COMPILE=/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- PLATFORM=arm32-f1c100s # docker run -it fishros2/licheepi /bin/bash #https://wiki.sipeed.com/soft/Lichee/zh/Nano-Doc-Backup/get_started/first_eat.html#%E4%B8%8B%E8%BD%BD%E5%B7%A5%E5%85%B7-sunxi-tools-%E5%AE%89%E8%A3%85