代码参考https://github.com/colourfate/x210_bsp/
他的是linux_4.10(dtb为 s5pv210-x210..dtb)我打算用linux4.19.114(dtb为 s5pv210-smdkv210.dtb) ,所以修改build.sh
5 MFLAG="ARCH=arm CROSS_COMPILE=/home/rlk/Downloads/arm-linux-gnueabihf_6.5/bin/arm-linux-gnueabihf-"
6 #MFLAG="ARCH=arm CROSS_COMPILE=$BASEPATH/toolchain/4.9.3/bin/arm-linux-"
7 #MFLAG="ARCH=arm CROSS_COMPILE=arm-linux-"
8 UBOOTDIR=u-boot-2017.09
9 LINUXDIR=linux-4.19.114
10 ROOTFSDIR=buildroot-2018.08
12 # sd卡设备文件
13 SDDEV=/dev/sdb
14 BL1POS=1 # BL1从1扇区开始
15 UBOOTPOS=49 # uboot从49扇区开始
16 # sd卡挂载点
SDDIR=/media/rlk/16930e10-5629-4824-9786-fdc160e6e9b2/
20 if [ $# == 0 ]; then
21 echo -e "\n------------------------uboot------------------------\n"
22 cd $UBOOTDIR
23 make x210_defconfig $MFLAG
24 make $MFLAG
25 cd sd_fusing/
26 make
27 ./mkx210 ../u-boot.bin 210.bin
28 cd $BASEPATH
29 cp $UBOOTDIR/u-boot.bin $UBOOTDIR/sd_fusing/210.bin outpu
32 BOOTDIR=arch/arm/boot
33 cd $LINUXDIR
34 make s5pv210_defconfig $MFLAG
35 rm $BOOTDIR/uImage
36 make uImage s5pv210-smdkv210.dtb LOADADDR=0x30007FC0 $MFLAG
37 cp $BOOTDIR/uImage $BOOTDIR/dts/s5pv210-smdkv210.dtb $BASEPATH/output
38 cd $BASEPATH
39
40 # FIXME: build root的工具链需要单独配置
42 cd $ROOTFSDIR
43 make x210_defconfig
44 BR2_TOOLCHAIN_EXTERNAL_PATH=/home/rlk/Downloads/arm-linux-gnueabihf_6.5/bin/
46 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX=arm-linux-gnueabihf-
47 make ARCH=arm CROSS_COMPILE=/home/rlk/Downloads/arm-linux-gnueabihf_6.5/bin/arm-linux-gnueabihf-
48 cp output/images/rootfs.tar $BASEPATH/output
49 cd $BASEPATH
menuconfig截图:
如果buildroot最后生不出rootfs.rar可以不管直接去buildroot/output/target/拷贝到sd卡里的rootfs
uboot启动后参数配置(对应s5pv210-smdkv210.dtb的配置为root=/dev/mmcblk2p1,很奇怪,这里mmcblk2,内核看到的mmc编号2与uboot看到不一样1;但是若用s5pv210-x210.dtb,则配置为root=/dev/mmcblk1p1)
x210#setenv bootargs "noinitrd console=ttySAC2,115200 root=/dev/mmcblk2p1 rw init=/linuxrc rootfstype=ext4"
x210#ext4load mmc 1:1 0x30007FC0 uImage;(在uboot来看sd卡为编号为1,uImage在1分区)
x210#ext4load mmc 1:1 0x30000000 s5pv210-smdkv210.dtb
x210#fdt addr 30000000 ;bootm 30007FC0 - 30000000
注意uboot环境变量:
bootargs=root=/dev/mtdblock8 rootfstype=ext4 ${console} ${meminfo} ${mtdparts}
bootblock=9
bootchart=set opts init=/sbin/bootchartd; run bootcmd
bootcmd=run mmcboot
bootk=run loaduimage;bootm 0x30007FC0
cpu=armv7
fdtfile=s5pc1xxc110-x210.dtb
flashboot=set bootargs root=/dev/mtdblock{bootblock} rootfstype={rootfstype} ${opts} ${lcdinfo} ${console} ${meminfo} ${mtdparts}; run bootk
loaduimage=ext4load mmc {mmcdev}:{mmcbootpart} 0x30007FC0 uImage
meminfo=mem=80M mem=256M@0x40000000 mem=128M@0x50000000
mmcboot=set bootargs root=/dev/mmcblk{mmcdev}p{mmcrootpart} rootfstype=${rootfstype} ${opts} ${lcdinfo} ${console} ${meminfo} ${mtdparts}; run bootk
mmcbootpart=1 //cbootpart我这里也放在1分区,里面有uImage,dtd
mmcdev=1 //在uboot来看sd卡为编号为1
mmcrootpart=1 //rootfs我这里也放在1分区
sd卡内容$ ls
bin etc lib32 lost+found mnt proc rootfs.tar s5pv210-smdkv210.dtb sbin tmp uImage_4.19 var dev lib linuxrc media opt root run s5pv210-x210.dtb sys uImage usr zImage_4.19