// 寫在家目錄下面的 .bashrc 里面export KERNEL_PATH=~/aplex/kernel3.2.0 // kernel 路徑export UBOOT_PATH=~/aplex/uboot2011.09 // u-boot 路勁export ROOTFS_PATH=~/aplex/filesystemexport TOOLFS_PATH=~/aplex/toolsexport ARCH=arm // 設置平臺類型export CROSS_COMPILE=arm-linux-gnueabihf- // 設置交叉編譯器前綴export PATH=$PATH:~/aplex/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin // 配置交叉編譯器加入環境變量export APLEX_PATH=~/image
cd $UBOOT_PATHmake O=out ok335x// 編譯完成之后你會在 out 目錄下找到 MLO 以及 u-boot.img, 將這兩個文件放在 等下制作好的 SD 卡boot 分區下
cd $KERNEL_PATHmake aplex_defconfigmake uImage -j4// 編譯完成之后會在 arch/arm/boot/ 下面生成 uImage 文件, 等下也將這個文件放在 SD 卡 boot 分區下
cd $ROOTFS_PATHmkubiimg.sh// mkubiimg.sh 是生成 ubi 文件系統的腳本// 工具的安裝請參考 : http://www.cnblogs.com/chenfulin5/p/7975633.html// ubi 文件系統的制作請參考: http://www.cnblogs.com/chenfulin5/p/8024016.htmlmkubiimg.sh 腳本如下: sudo mkfs.ubifs -q -r rootfs_v2 -m 2048 -e 126976 -c 4040 -o ubifs.img -F #制做 rootfs_v2 目錄下面的文件系統為 ubifs.imgecho mkfs.ubifs over!sudo ubinize -o ubi.img -m 2048 -p 128KiB ubinize.cfg # 壓縮 ubifs.img 為 ubi.imgecho ubinize over!synccp ubi.img $APLEX_PATH -rf # 將ubi.img 拷貝到 ~/image 下面echo make file system ok !
將 SD 卡插入電腦, 如下操作

sudo fdisk /dev/sdc # sdc 是 SD卡的節點Command (m for help): d # 刪除分區Selected partition 1 # 刪除第一個分區Command (m for help): n # 添加分區Partition type:p primary (0 primary, 0 extended, 4 free)e extendedSelect (default p): p # 主分區Partition number (1-4, default 1): 1 # 第一個分區First sector (2048-15126527, default 2048): Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-15126527, default 15126527): Using default value 15126527Command (m for help): t # 改變分區格式Selected partition 1Hex code (type L to list codes): e # 選擇FAT16格式Changed system type of partition 1 to e (W95 FAT16 (LBA))Command (m for help): a # 設置為 boot 分區Partition number (1-4): 1Command (m for help): p # 顯示Disk /dev/sdc: 7744 MB, 7744782336 bytes32 heads, 12 sectors/track, 39392 cylinders, total 15126528 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x5fb59036Device Boot Start End Blocks Id System/dev/sdc1 * 2048 15126527 7562240 e W95 FAT16 (LBA)Command (m for help): w # 保存
mkfs.vfat -n "boot" -F 16 /dev/sdc1
sudo mount /dev/sdc1 /mntcp u-boot.img MLO uImage ubi.img /mnt -rfsyncsudo umount /mnt