am335x uboot, kernel 編譯
阿新 • • 發佈:2018-01-15
mkf byte ice number .html pat markdown 變量 技術分享
一、設置環境變量
// 寫在家目錄下面的 .bashrc 裏面 export KERNEL_PATH=~/aplex/kernel3.2.0 // kernel 路徑 export UBOOT_PATH=~/aplex/uboot2011.09 // u-boot 路勁 export ROOTFS_PATH=~/aplex/filesystem export TOOLFS_PATH=~/aplex/tools export ARCH=arm // 設置平臺類型 export CROSS_COMPILE=arm-linux-gnueabihf- // 設置交叉編譯器前綴
二、 u-boot 編譯
cd $UBOOT_PATH make O=out ok335x // 編譯完成之後你會在 out 目錄下找到 MLO 以及 u-boot.img, 將這兩個文件放在 等下制作好的 SD 卡boot 分區下
三、 kernel 編譯
cd $KERNEL_PATH make aplex_defconfig make uImage -j4 // 編譯完成之後會在 arch/arm/boot/ 下面生成 uImage 文件, 等下也將這個文件放在 SD 卡 boot 分區下
四、文件系統生成
cd $ROOTFS_PATH mkubiimg.sh // mkubiimg.sh 是生成 ubi 文件系統的腳本 // 工具的安裝請參考 : http://www.cnblogs.com/chenfulin5/p/7975633.html // ubi 文件系統的制作請參考: http://www.cnblogs.com/chenfulin5/p/8024016.html mkubiimg.sh 腳本如下: sudo mkfs.ubifs -q -r rootfs_v2 -m 2048 -e 126976 -c 4040 -o ubifs.img -F #制做 rootfs_v2 目錄下面的文件系統為 ubifs.img echo mkfs.ubifs over! sudo ubinize -o ubi.img -m 2048
五、SD 的制作
將 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 extended Select (default p): p # 主分區 Partition number (1-4, default 1): 1 # 第一個分區 First sector (2048-15126527, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-15126527, default 15126527): Using default value 15126527 Command (m for help): t # 改變分區格式 Selected partition 1 Hex 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): 1 Command (m for help): p # 顯示 Disk /dev/sdc: 7744 MB, 7744782336 bytes 32 heads, 12 sectors/track, 39392 cylinders, total 15126528 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x5fb59036 Device 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
六、最後將上述文件放到 /dev/sdc1
sudo mount /dev/sdc1 /mnt cp u-boot.img MLO uImage ubi.img /mnt -rf sync sudo umount /mnt
am335x uboot, kernel 編譯