Imx283Uboot2017+Linux3/4/5系统内核移植序言
用的周立功的EasyArm283,实习的时侯买的,仍然没咋弄,前几天忽然听到了想玩一下(虽然近来仍然再画板子,想玩一下软件了哈哈),觉得2.34的内核有点老所以就移植了4.13,虽然就是搬砖哈哈,主要记录下坑把
开始
工具链:arm-fsl-linux-gnueabi-arm-linux-gnueabihf-
编译Linux
首先到linux找到官方demo的config文件,之后这儿是mxs_defconfig,将其拷贝到linux源码根目录下:
先更改MakeFile,添加如下:
ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf-
执行:
makemxs_defconfig
之后makemenuconfig选择自己配置项,这儿看网上和自己选择linux内核移植教程,这儿调试的时侯可以直接定死kernel启动参数,从nfs启动,调试便捷。
之后makezImagedtbs-j8
假如用uImage这儿要加上启动地址makeuImageLOADADDR=42000000-j8
编译Uboot
其次编译Uboot,这儿的先讲一下他的Nandflash下载原理,先用usb传输一个稳定的linux镜像到ddr之后执行,之后通过usb传输指令,板子上linux执行,把镜像,rootfs,dts讲到nandflash上,所以nandflash的分区跟你的官方镜像一样,这儿看官方的uboot2009中的uboot/include/configs/mx28-evk.h分区如下:
仿造这个更改uboot2017/8/9等吧,总之你移植哪个版本uboot就更改那种的这个文件wps for linux,另外启动指令改了如下:
里面注释的原先官方的,如今更改成自己的,继续更改启动参数,由于我们文件系统位置变了,所以更改如下:
之后复制配置文件,路径如下,这儿复制nand版本,由于从nand启动
之后make-j8linux内核移植教程,注意之前要更改Makefile配置ARCH=armCROSS_COMPILE=arm-linux-gnueabi-
打包uboot、zImage、rootfs
把uboot和zImage复制到imx_xXX_bootlets文件夹下边,之后执行./build
之后把linux的dtb,和刚刚生成的一堆文件复制自己的文件夹下边备用,这儿贴图:
最后还差一个文件系统,这儿要配置一个环境多的太麻烦了,所以直接用周立功的,环境都不用配置了,哈哈,复制imx28xxx_rootfs.tar.bz2,之后解压,更改/etc/inittab,把ttyAM0更改为ttyAMA0,am0是显示屏,ama0是并口,如下:
之后更改/etc/hostname文件,将板子更改成自己想要的名子!
之后更改issue,这儿更改称自己想要的开机复印信息,我的是佛祖哈哈!
下载
之后把文件系统复制到自己备用文件夹上面鸟哥的linux私房菜,复制到win10主机上的MGTool的files中,这儿不会去看周立功的教程,用飞思卡尔工具USB下载,这儿给上下载配置文件,如下:
<LIST name="NAND uboot-kernel-rootfs-dtb(128MB)" desc="Install on singlechip NAND">
<CMD type="boot" body="Recovery" file="imx28_BootCfg.sb" if="HabDisable">Enable unencrypted boot modes.</CMD>
<CMD type="boot" body="Recovery" file="imx28_BootCfg_ivt.sb" if="HabEnable">Enable unencrypted boot modes.</CMD>
<CMD type="wait" body="ResetToRecovery" timeout="3">Waiting for Reset to Recovery.</CMD>
<CMD type="boot" body="Recovery" file="updater.sb" timeout="60" if="HabDisable">Booting update firmware.</CMD>
<CMD type="boot" body="Recovery" file="updater_ivt.sb" timeout="60" if="HabEnable">Booting update firmware.</CMD>
<CMD type="find" body="Updater" timeout="180"/>
<CMD type="push" body="mknod class/mtd,mtd0,/dev/mtd0" timeout="180" />
<CMD type="push" body="mknod class/mtd,mtd1,/dev/mtd1" timeout="180" />
<CMD type="push" body="mknod class/mtd,mtd2,/dev/mtd2" timeout="180" />
<CMD type="push" body="mknod class/mtd,mtd3,/dev/mtd3" timeout="180" />
<CMD type="push" body="mknod class/mtd,mtd4,/dev/mtd4" timeout="180" />
<CMD type="push" body="mknod class/mtd,mtd5,/dev/mtd5" timeout="180" />
<CMD type="push" body="mknod class/mtd,mtd6,/dev/mtd6" timeout="180" />
<CMD type="push" body="mknod class/misc,ubi_ctrl,/dev/ubi_ctrl"/>
<CMD type="push" body="$ flash_eraseall /dev/mtd0">Erasing partition0</CMD>
<CMD type="push" body="$ flash_eraseall /dev/mtd1">Erasing partition1</CMD>
<CMD type="push" body="$ flash_eraseall /dev/mtd2">Erasing partition2</CMD>
<CMD type="push" body="$ flash_eraseall /dev/mtd3">Erasing partition3</CMD>
<CMD type="push" body="$ flash_eraseall /dev/mtd4">Erasing partition4</CMD>
<CMD type="push" body="$ flash_eraseall /dev/mtd5">Erasing partition5</CMD>
<CMD type="push" body="$ flash_eraseall /dev/mtd6">Erasing partition5</CMD>
<CMD type="push" body="send" file="files/imx28_ivt_uboot.sb">Sending uboot</CMD>
<CMD type="push" body="$ kobs-ng init -v $FILE">Flashing uboot firmware</CMD>
<CMD type="push" body="$ flash_erase /dev/mtd0 0x800000 32">Erasing 0x800000 32</CMD>
<CMD type="push" body="send" file="files/imx28-evk.dtb">Sending dtb</CMD>
<CMD type="push" body="$ mtdwrite -d /dev/mtd0 -f $FILE -a 0x800000">Flashing dtb firmware</CMD>
<CMD type="push" body="$ flash_erase /dev/mtd0 0x400000 32">Erasing 0x00400000 32</CMD>
<CMD type="push" body="send" file="files/zImage">Sending zImage</CMD>
<CMD type="push" body="$ mtdwrite -d /dev/mtd0 -f $FILE -a 0x400000">Flashing zImage firmware</CMD>
<CMD type="push" body="$ ubiattach /dev/ubi_ctrl -m 5 -d 0">Attaching UBI partition</CMD>
<CMD type="push" body="mknod class/ubi,ubi0,/dev/ubi0"/>
<CMD type="push" body="$ ubimkvol /dev/ubi0 -n 0 -N filesystem -m">Creating UBI volumes</CMD>
<CMD type="push" body="$ mkdir -p /mnt/ubi0; mount -t ubifs ubi0_0 /mnt/ubi0" />
<CMD type="push" body="pipe tar -jxv -C /mnt/ubi0" timeout="180" file="files/rootfs.tar.bz2">Transfer rootfs</CMD>
<CMD type="push" body="frf">Finish Flashing rootfs</CMD>
<CMD type="push" body="$ umount /mnt/ubi0">Unmounting</CMD>
<CMD type="push" body="$ echo Update Complete!">Done</CMD>
</LIST>
下载完毕开机
之后下载完毕开机,复印消息如下:
可以看出uboot2017和linux4.13启动啦,屏幕的小企鹅也出现了,之后登录:
由于用的zlg的文件系统,更改了一下,哈哈,但可以看见这儿linux内核早已是4.13哈哈,注意里面的lrz、lsz是并口传输文件的app,自己编译的,之后,执行zlg的界面程序如下:
里面我瞎敲得,此时qt的启动界面出现了,ok大功告成
结束语
尽管成功,而且虽然中间大约四五天把,踩坑,学习,踩坑,学习,总算成功啦。
又下雨了,真棒!