// 写在家目录下面的 .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