1. 准备工作
1) 安装Ubuntu14.04LTS(长支持版本),如果用虚拟机请安装vmware14(别的虚拟机都不推荐,泪的教训),&nBSP; 然后安装 vmware tools(不是必须,但是方便文件共享)
2) 安装arm linux 硬件浮点数工具链, 因为V3s支持VFPv4 浮点单元: sudo apt-get install gcc-arm-linux-gnueabihf
3) 安装git源码管理软件: sudo apt-get install git
4) 其他支撑软件 sudo apt-get install device-tree-compiler (.......................)
2. u-boot
首先获取u-boot源码:git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-current
如果你需要支持spi flash:git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-spi-experimental
cd u-boot
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- MAKE LicheePi_Zero_800x480LCD_defconfig (群主网店5寸屏)
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make LicheePi_Zero_480x272LCD_defconfig (通用4.3寸屏)
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make LicheePi_Zero_defconfig (默认)
ARCH=arm make menuconfig
执行编译:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make
多核编译,避免CPU其他内核打酱油, J后的参数是参与编译的cpu个数:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -J3
3.编译 sunxi-tools
sudo apt-get install libusb-1.0-0-dev
cd tool/sunxi-tools
make
4.生成boot.scr文件
新建一个文件 boot.cmd
写入:
setenv bootargs console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw
setenv bootm_boot_mode sec
setenv machid 1029
load mmc 0:1 0x41000000 uImage
load mmc 0:1 0x41d00000 script.bin
bootm 0x41000000
保存
mkimage -C none -A arm -T script -d boot.cmd boot.scr
5.生成 script.bin文件
使用我提供的sys_config.fex
../sunxi-tools/fex2bin sys_config.fex > ../pub/boot/script.bin
6.编译内核
使用我提供的 lichee_BSP_config 说明一下 这里修改了内核支持网口 支持ext4文件系统 就直接给出我配置好的。
cd linux-3.4
cp lichee_BSP_config .config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage -j16
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j16 INSTALL_MOD_PATH=out modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j16 INSTALL_MOD_PATH=out modules_install
这时 我们要用的 uImage 在 arch/arm/boot/uImage
7.文件系统:
1). 下载最新的Buildroot稳定版本
官方网站:https://buildroot.org/download.html
长支持版本:buildroot-2017.02.7.tar.gz
最新稳定版:buildroot-2017.08.1.tar.gz
2). 配置buildroot 参数,make menuconfig;make
同主线文件系统 的生成办法
8.打包
烧录TF卡启动盘:
1) 删除TF卡所有分区
2) 将Uboot写入到sd卡8k偏移处(必须8K偏移, brom龟腚的)。
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
3) 建立第一个分区,前面空出8MB 大小32M(可以随意填写), 格式FAT16, 把uImage,boot.src,script.bin,拷贝到 这个分区
4) 建立第二个分区,用尽剩余空间,格式ext4, 把buildroot产生的rootfs.tar解压到该分区根目录
tar xvf output/images/rootfs.tar -C /挂载的tf卡第二个分区目录
以上资料我使用度盘分享(提供内核的源码和编译好的内核)
链接: https://pan.baidu.com/s/1ghlIl5D
密码:
游客,如果您要查看本帖隐藏内容请回复