下面记录了如何搭建嵌入开发环境,如何编译uboot、kernel、和文件系统,如何烧写镜像以及如何配置uboot环境变量。
阅读注意:记录中(Base框中的内容)一些操作故意被添加,为了展示文件内容,故意调用cat(Ubuntu)或者type(window)命令;为了展示文件夹下的列表,故意用ls或者dir列出文件夹下的文件。记录中xiptech@ubuntu:~$前缀的为Ubuntu下的操作,X6818#前缀的为开发板uboot操作。为了表明后面的操作是在什么平台,我还加了“下面进行xxx操作”的转场描述。
准备工作
下面进行window操作
1、vm安装ubuntu 15.04 x64
2、共享一个window目录到ubuntu
window分享的目录E:\SVNFile\9dx6818Studio
映射到ubuntuxiptech@ubuntu:/mnt/hgfs/Share$ pwd
/mnt/hgfs/Share
下面进行ubuntu操作
3、ubuntu下添加一个工作目录xiptech@ubuntu:~$ mkdir 9dx6818
4、将9dx6818共享到window
通过ui操作共享:在9dx6818文件夹上右键Local Network Share
或者直接修改smb.conf共享:xiptech@ubuntu:sudo gedit /etc/samba/smb.conf
文末尾添加[ubuntu_9dx6818]
comment = 9dx6818 studio on ubuntu
path = /home/xiptech/9dx6818
browseable = yes
writable = yes
public = yes
guest ok = yes
重启samba服务xiptech@ubuntu:sudo /etc/init.d/smbd restart
下面进行window操作
5、建立网络映射
u-boot编译
下面进行ubuntu操作
1、源码拷贝解压
x6818_linux_160719.tar.bz2解压到/home/xiptech/9dx6818/
编译
u-boot配置说明:
/home/xiptech/9dx6818/x6818_linux_160719/uboot下有几个配置
nsih.txt: uboot实际编译的文件,默认为 ibox6818 卡片电脑 2GB 配置文件;
nsih-2G16b-800M.txt: x6818 开发板 2GB DDR3 的配置文件;
nsih-1G16b-800M.txt: x6818 开发板配置文件;
nsih-2G8b-800M.txt: ibox6818 2GB DDR3 的配置文件;
所以我们的开发版用的是nsih-1G16b-800M.txt,写一个编译脚本mk_x6818_board.sh并执行编译xiptech@ubuntu:~/9dx6818/x6818_linux_160719$ cat mk_x6818_board.sh
echo "config ddr3=1G16b-800M"
cp uboot/nsih-1G16b-800M.txt uboot/nsih.txt
./mk -u
xiptech@ubuntu:~/9dx6818/x6818_linux_160719$ ./mk_x6818_board.sh
输出xiptech@ubuntu:~/9dx6818/x6818_linux_160719/out/release$ ls *bin
ubootpak.bin
内核编译
编译xiptech@ubuntu:~/9dx6818/x6818_linux_160719$ ./mk -k
输出xiptech@ubuntu:~/9dx6818/x6818_linux_160719/out/release$ ls *img
boot.img
文件系统编译
安装依赖软件xiptech@ubuntu:sudo apt-get install texinfo
xiptech@ubuntu:sudo apt-get install git
xiptech@ubuntu:sudo apt-get install lib32stdc++-4.9-dev
xiptech@ubuntu:sudo apt-get install lib32z1
打开文件buildroot/output/build/host-ncurses-5.9/include/curses.h找到extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
将这句注释删除掉:/* generated */
编译xiptech@ubuntu:~/9dx6818/x6818_linux_160719$ ./mk -b
输出xiptech@ubuntu:~/9dx6818/x6818_linux_160719/out/release$ ls *rootfs*
qt-rootfs.img
...额!文件系统build3个钟头...
fastboot烧写镜像
1、连接串口和usb
开发版操作SecureCRT连接开发版调试串口(default:115200、右边那个串口),使用安卓数据线连接电脑usb和开发版OTG接口
下面进行windows操作
2、安装fastboot工具
安装到E:\SVNFile\9dx6818Studio\utils\fastbootE:\SVNFile\9dx6818Studio\utils\fastboot 的目录
2017/09/01 15:27
2017/09/01 15:27
2013/02/12 08:08 815,104 adb.exe
2013/02/12 08:08 96,256 AdbWinApi.dll
2013/02/12 08:08 60,928 AdbWinUsbApi.dl
2011/03/24 15:17 1,787,392 ApkInstaller.ex
2011/06/09 11:20 404 ApkInstaller.in
2013/02/12 08:08 157,184 fastboot.exe
2010/10/23 16:04 63 license
下面进行开发板操作
3、开发板重启并敲回车进入u-boot
4、进入fastboot模式X6818# fastboot
Fastboot Partitions:
mmc.2: ubootpak, img : 0x200, 0x78000
mmc.2: 2ndboot, img : 0x200, 0x4000
mmc.2: bootloader, img : 0x8000, 0x70000
mmc.2: boot, fs : 0x100000, 0x4000000
mmc.2: system, fs : 0x4100000, 0x2f200000
mmc.2: cache, fs : 0x33300000, 0x1ac00000
mmc.2: misc, fs : 0x4e000000, 0x800000
mmc.2: recovery, fs : 0x4e900000, 0x1600000
mmc.2: userdata, fs : 0x50000000, 0x0
Support fstype : 2nd boot factory raw fat ext4 emmc nand ubi ubifs
Reserved part : partmap mem env cmd
DONE: Logo bmp 311 by 300 (3bpp), len=280854
DRAW: 0x47000000 -> 0x46000000
Load USB Driver: android
Core usb device tie configuration done
OTG cable Connected!
------------------------------------------
下面进行window操作
5、镜像准备
将需要烧写的镜像拷贝到E:\SVNFile\9dx6818Studio\upgrade目录E:\SVNFile\9dx6818Studio\upgrade 的目录
2017/08/28 15:00 16,998,632 boot.img
2017/08/28 17:36 536,870,912 qt-rootfs.img
2017/08/28 15:00 303,544 ubootpak.bin
6、烧写
添加三个脚本用于发起烧写,直接双击执行脚本烧写E:\SVNFile\9dx6818Studio\upgrade>type upgrade_ubootpak.cmd
fastboot flash ubootpak ubootpak.bin
pause
E:\SVNFile\9dx6818Studio\upgrade>type upgrade_boot.cmd
fastboot flash boot boot.img
pause
E:\SVNFile\9dx6818Studio\upgrade>type "upgrade_qt-rootfs .cmd"
fastboot flash system qt-rootfs.img
pause
下面进行开发板操作
7、u-boot环境变量配置X6818# setenv bootcmd "ext4load mmc 2:1 0x48000000 uImage;bootm 0x48000000"
X6818# setenv bootargs "lcd=wy070ml tp=gslx680-linux root=/dev/mmcblk0p2 rw rootfstype=ext4"
X6818# setenv ubootpak 1
X6818# setenv boot 1
X6818# setenv system 1
X6818# setenv userdata 0
X6818# setenv cache 0
X6818# save