lichee编译u-boot(Allwinner A80)

来源:互联网 发布:一级建造师网络 编辑:程序博客网 时间:2024/05/16 23:57

在下面这个文件中定制u-boot的命令

brandy/u-boot-2011.09/include/configs/sun9iw1p1.h

添加lib

vi brandy/u-boot-2011.09/Makefile

编译u-boot

cd brandy/u-boot-2011.09/make sun9iw1p1_configmake

 

产生u-boot文件

ll tools/pack/chips/sun9iw1p1/bin/boot0_nand_sun9iw1p1.binboot0_sdcard_sun9iw1p1.binfes1_sun9iw1p1.binu-boot-sun9iw1p1.bin

 

uboot相关的config默认是在tools/pack/chips/sun9iw1p1/configs/cubieboard4下

env.cfg                    ---env分区内容,保存uboot命令的一些环境变量

sys_partition.fex   ----用pack脚本打包时的分区布局

sys_config.fex       ----u-boot硬件参数

更新boot0

boot0有两种,从sd卡启动用boot0_sdcard.fex, 从nand启动用boot0_nand.fex

cd ${LICHEE_ROOT}/tools/pack#copy boot0cp -fv chips/sun9iw1p1/bin/boot0_nand_sun9iw1p1.bin out/boot0_nand.fexcp -fv chips/sun9iw1p1/bin/boot0_sdcard_sun9iw1p1.bin out/boot0_sdcard.fexcp -fv chips/sun9iw1p1/bin/fes1_sun9iw1p1.bin out/fes1.fexunix2dos out/sys_config.fex#compile fex filepctools/linux/mod_update/script out/sys_config.fex#patch boot0pctools/linux/mod_update/update_boot0 out/boot0_sdcard.fex out/sys_config.bin SDMMC_CARDpctools/linux/mod_update/update_boot0 out/boot0_nand.fex out/sys_config.bin NANDpctools/linux/mod_update/update_fes1 out/fes1.fex out/sys_config.bin

 

把boot0烧写到卡上

dd if=boot0_sdcard.fex of=/dev/sdc bs=1k seek=8dd if=boot0_sdcard.fex of=/dev/nand bs=1k seek=8

 

更新u-boot

cd ${LICHEE_ROOT}/tool/packcp -fv chips/sun9iw1p1/configs/optimus/sys_config.fex out/sys_config.fexcp -fv chips/sun9iw1p1/bin/u-boot-sun9iw1p1.bin out/u-boot.fexunix2dos out/sys_config.fexpctools/linux/mod_update/script out/sys_config.fexpctools/linux/mod_update/update_uboot out/u-boot.fex out/sys_config.bin

 

把u-boot烧写到卡上

dd if=u-boot.fex of=/dev/sdc bs=1k seek=19096

这样,板子上电启动后就能进到u-boot的命令行界面了,可以从串口上读取并显示

 

接着,再制作一个启动分区,不用太大,注意启始扇区从2048开始,大小的话32MB足够了

Command (m for help): pDisk /dev/sdc: 7.4 GiB, 7948206080 bytes, 15523840 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x00000000Command (m for help): nPartition type   p   primary (0 primary, 0 extended, 4 free)   e   extended (container for logical partitions)Select (default p): pPartition number (1-4, default 1): First sector (2048-15523839, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-15523839, default 15523839): +32MCreated a new partition 1 of type 'Linux' and of size 32 MiB.Command (m for help): tSelected partition 1Partition type (type L to list all types): cChanged type of partition 'Linux' to 'W95 FAT32 (LBA)'.Command (m for help): pDisk /dev/sdc: 7.4 GiB, 7948206080 bytes, 15523840 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x00000000Device     Boot Start   End Sectors Size Id Type/dev/sdc1        2048 67583   65536  32M  c W95 FAT32 (LBA)


格式化成fat16,卷标名为boot

mkfs.vfat -n boot /dev/sdc1

把把linux内核uImage放到该分区中就可以从u-boot加载

 

查看env

cubieboard4#printenv baudrate=115200boot_fastboot=fastbootboot_normal=sunxi_flash read 40007800 boot;bootm 40007800boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800bootargs=console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 init=/init loglevel=8 partitions=bootcmd=run setargs_mmc boot_normalbootdelay=3console=ttyS0,115200ethact=eth0init=/initloglevel=8mmc_root=/dev/mmcblk0p2nand_root=/dev/nanddsetargs_mmc=setenv bootargs console=${console} root=${mmc_root} rootfstype=ext4 init=${init} loglevel=${loglevel} partitions=${partitions}setargs_nand=setenv bootargs console=${console} root=${nand_root} rootfstype=ext4 init=${init} loglevel=${loglevel} partitions=${partitions}stderr=serialstdin=serialstdout=serialEnvironment size: 767/131068 bytes


操作fat分区

cubieboard4#fatinfo mmc 0:1Interface:  MMC  Device 0: Vendor: MID 000003 PSN 2a1d0c8e Rev: PRV 8.0 Prod: PNM SU08G            Type: Removable Hard Disk            Capacity: 7580.0 MB = 7.4 GB (15523840 x 512)Partition 1: Filesystem: FAT16 "boot       "
cubieboard4#fatls mmc 0:1   2817256   uimage 1 file(s), 0 dir(s)

 

加载kernel

fatload mmc 0:1 40007800 uimagecubieboard4#bootm 40007800 ## Booting kernel from Legacy Image at 40007800 ...   Image Name:   Linux-3.4.39   Image Type:   ARM Linux Kernel Image (uncompressed)   Data Size:    2817192 Bytes = 2.7 MiB   Load Address: 20008000   Entry Point:  20008000   Verifying Checksum ... OK   Loading Kernel Image ... OKOK[    336.190][mmc]: MMC Device 2 not found[    336.193][mmc]:  mmc  not find, so not exit[    336.198]Starting kernel ...Uncompressing Linux... done, booting the kernel.

 

0 0
原创粉丝点击