天天看点

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

之前买了个荔枝派,全志的A3S芯片。折腾了两天,写一下编译和SD烧录的过程。

目录

1.直接烧录镜像文件

2.uboot编译

3.kernel编译

4.rootfs编译

5.烧录

6.串口登录

1.直接烧录镜像文件

百度到了一堆的资料,下面是网盘链接

链接:https://pan.baidu.com/s/1x75Uqnxl6bmBCYDN3NUdJg

提取码:ohzx

复制这段内容后打开百度网盘手机App,操作更方便哦

这里面有现成的镜像文件,想直接体验的,可以用这个玩玩

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

下载之后,将压缩包解压;

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

还要下载两个软件

首先是格式化软件,用来格式化U盘的

https://www.sdcard.org/downloads/formatter/

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

然后是镜像烧录软件

http://www.onlinedown.net/soft/110173.htm

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

打开第一个软件

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

然后就可以使用这个镜像了。

这里演示一个debian系统

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

后面不细说了,和本文关系不大

2.uboot编译

可以用下面的方式,也可以加群,去群文件找我下载好的东西。

安装交叉编译器

网盘地址:http://pan.baidu.com/s/1hsf22fq

国外用户:https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/

wget https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf.tar.xz
tar xvf gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf.tar.xz
mv gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf /opt/
vim /etc/bash.bashrc
# add: PATH="$PATH:/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin"
source /etc/bash.bashrc
arm-linux-gnueabihf-gcc -v
sudo apt-get install device-tree-compiler
           

下载编译Uboot

git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-current
#or git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-spi-experimental
cd u-boot
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_800x480LCD_defconfig
#or make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero480x272LCD_defconfig
#or make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_defconfig
make ARCH=arm menuconfig
time make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 2>&1 | tee build.log
           

修改 include/configs/sun8i.h, 使u-boot可以直接从tf卡启动:

#define CONFIG_BOOTCOMMAND "setenv bootm_boot_mode sec; " \

"load mmc 0:1 0x41000000 zImage; " \

"load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb; " \

"bootz 0x41000000 - 0x41800000;"

#define CONFIG_BOOTARGS "console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw vt.global_cursor_default=0"

编译完成后,在当前目录下生成了u-boot-sunxi-with-spl.bin,可以烧录到8K偏移处启动。

3.kernel编译

网盘地址:http://pan.baidu.com/s/1hsf22fq

国外用户:https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/

wget https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf.tar.xz
tar xvf gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf.tar.xz
mv gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf /opt/
vim /etc/bash.bashrc
# add: PATH="$PATH:/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin"
arm-linux-gnueabihf-gcc -v
           

下载编译linux源码

(默认是zero-4.10.y分支):

git clone https://github.com/Lichee-Pi/linux.git
cd linux
make ARCH=arm licheepi_zero_defconfig
make ARCH=arm menuconfig   #add bluethooth, etc.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 INSTALL_MOD_PATH=out modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 INSTALL_MOD_PATH=out modules_install
           

编译完成后,zImage在arch/arm/boot/下,驱动模块在out/下

4.rootfs编译

make menuconfig

make

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

5.烧录

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

将SD卡挂载到虚拟机

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

重新分区

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

注意别把自己硬盘格式化了

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

卸载并且删除所有分区

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

写Uboot:sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8

我把编译出来东西全放一起了,懒得再次去编译,文件系统搞一次要好久,截图的时候文件系统还在编译中

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

直接拷贝kernel

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

解压文件系统

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录

弹出 sd卡

6.串口登录

这里要留意下,板子用的是串口0,不是串口I1,板子上串口1和串口2放在一起,之前一直忽略了串口0,导致一直以为设备没启动

荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
荔枝派 zero(全志V3S)-编译及SD烧录1.直接烧录镜像文件2.uboot编译3.kernel编译4.rootfs编译5.烧录6.串口登录
  • <li class="tool-item tool-active is-like "><a href="javascript:;" target="_blank" rel="external nofollow"  target="_blank" rel="external nofollow" ><svg class="icon" aria-hidden="true">
                            <use xlink:href="#csdnc-thumbsup" target="_blank" rel="external nofollow" ></use>
                        </svg><span class="name">点赞</span>
                        <span class="count"></span>
                        </a></li>
                        <li class="tool-item tool-active is-collection "><a href="javascript:;" target="_blank" rel="external nofollow"  target="_blank" rel="external nofollow"  data-report-click='{"mod":"popu_824"}'><svg class="icon" aria-hidden="true">