select_chip_info
这个函数个人感觉不怎么重要,所以代码就不贴了,它的作用也是从.config读取一些信息,然后给以下变量赋值
RKCHIP_LABEL、RKCHIP_LOADER、RKCHIP_TRUST
fixup_platform_configure
这个函数也没什么意思,也是在赋值
PLATFORM_RSA="--rsa 3"
PLATFORM_UBOOT_IMG_SIZE="--size 1024 2"
PLATFORM_TRUST_IMG_SIZE="--size 1024 2"
sub_commands
说实话我没看懂他要干啥
make
make CROSS_COMPILE=${TOOLCHAIN_GCC} all --jobs=${JOB} ${OUTOPT}
这个其实就没啥好说的了,那个jobs是编译所用的线程数,output应该是生成文件的路径,默认是空的
最终是生成u-boot.img u-boot-dtb.img u-boot.bin u-boot-dtb.bin等文件
pack_uboot_image
打包uboot前,先检查u-boot.bin的大小,超过10M,就报错了
# Check file size
UBOOT_KB=`ls -l u-boot.bin | awk '{print $5}'`
if [ "$PLATFORM_UBOOT_IMG_SIZE" = "" ]; then
UBOOT_MAX_KB=1046528
else
UBOOT_MAX_KB=`echo $PLATFORM_UBOOT_IMG_SIZE | awk '{print strtonum($2)}'`
UBOOT_MAX_KB=$(((UBOOT_MAX_KB-HEAD_KB)*1024))
fi
if [ $UBOOT_KB -gt $UBOOT_MAX_KB ]; then
echo
echo "ERROR: pack uboot failed! u-boot.bin actual: $UBOOT_KB bytes, max limit: $UBOOT_MAX_KB bytes"
exit 1
fi
最终在当前目录下,生成了uboot.img,并删除了其它的img结尾的中间文件
# Pack image
UBOOT_LOAD_ADDR=`sed -n "/CONFIG_SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" ${OUTDIR}/include/autoconf.mk|tr -d 'r'`
if [ ! $UBOOT_LOAD_ADDR ]; then
UBOOT_LOAD_ADDR=`sed -n "/CONFIG_SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" ${OUTDIR}/.config|tr -d 'r'`
fi
${RKTOOLS}/loaderimage --pack --uboot ${OUTDIR}/u-boot.bin uboot.img ${UBOOT_LOAD_ADDR} ${PLATFORM_UBOOT_IMG_SIZE}
# Delete u-boot.img and u-boot-dtb.img, which makes users not be confused with final uboot.img
if [ -f ${OUTDIR}/u-boot.img ]; then
rm ${OUTDIR}/u-boot.img
fi
if [ -f ${OUTDIR}/u-boot-dtb.img ]; then
rm ${OUTDIR}/u-boot-dtb.img
fi
echo "pack uboot okay! Input: ${OUTDIR}/u-boot.bin"
pack_loader_image
这一步最终生成这个文件rk1808_loader_v1.04.105.bin,并拷贝到当前目录下
pack_trust_image
这一步生成trust.img,这是arm搞的一个跟安全有关的东西Trustzone,大致是为了保护内存中的数据不被别人窃取之类的
finish
最后一步就是打印一点信息,就ok了
总结
从结果来看,执行make.sh一共得到了以下几个东西
uboot.img
rk1808_loader_v1.04.105.bin
trust.img
我们烧录的时候,是在顶层目录的rockdev去取镜像文件,在linux下,可以很清晰得看到链接的关系,所生成的这三个文件,都会被链接到
boot.img -> ../kernel/boot.img
MiniLoaderAll.bin -> ../u-boot/rk1808_loader_v1.04.105.bin
misc.img -> ../device/rockchip/rockimg/wipe_all-misc.img
oem.img
parameter.txt -> ../device/rockchip/rk1808/parameter-buildroot.txt
recovery.img -> ../buildroot/output/rockchip_rk1808_recovery/images/recovery.img
rootfs.ext4 -> ../buildroot/output/rockchip_rk1808/images/rootfs.ext2
rootfs.img -> ../buildroot/output/rockchip_rk1808/images/rootfs.ext2
trust.img -> ../u-boot/trust.img
uboot.img -> ../u-boot/uboot.img
update.img
userdata.img
除此之外,如果希望自己修改一些uboot的内容,可以通过类似内核的make menuconfig取修改.config文件,不过注意修改完了,一定要记得将该文件写回原来的位置,就是那个默认的deconfig所在的位置,否则每次编译,当前目录下的.config都会被configs目录下的xxx_deconfig覆盖掉。
select_chip_info
这个函数个人感觉不怎么重要,所以代码就不贴了,它的作用也是从.config读取一些信息,然后给以下变量赋值
RKCHIP_LABEL、RKCHIP_LOADER、RKCHIP_TRUST
fixup_platform_configure
这个函数也没什么意思,也是在赋值
PLATFORM_RSA="--rsa 3"
PLATFORM_UBOOT_IMG_SIZE="--size 1024 2"
PLATFORM_TRUST_IMG_SIZE="--size 1024 2"
sub_commands
说实话我没看懂他要干啥
make
make CROSS_COMPILE=${TOOLCHAIN_GCC} all --jobs=${JOB} ${OUTOPT}
这个其实就没啥好说的了,那个jobs是编译所用的线程数,output应该是生成文件的路径,默认是空的
最终是生成u-boot.img u-boot-dtb.img u-boot.bin u-boot-dtb.bin等文件
pack_uboot_image
打包uboot前,先检查u-boot.bin的大小,超过10M,就报错了
# Check file size
UBOOT_KB=`ls -l u-boot.bin | awk '{print $5}'`
if [ "$PLATFORM_UBOOT_IMG_SIZE" = "" ]; then
UBOOT_MAX_KB=1046528
else
UBOOT_MAX_KB=`echo $PLATFORM_UBOOT_IMG_SIZE | awk '{print strtonum($2)}'`
UBOOT_MAX_KB=$(((UBOOT_MAX_KB-HEAD_KB)*1024))
fi
if [ $UBOOT_KB -gt $UBOOT_MAX_KB ]; then
echo
echo "ERROR: pack uboot failed! u-boot.bin actual: $UBOOT_KB bytes, max limit: $UBOOT_MAX_KB bytes"
exit 1
fi
最终在当前目录下,生成了uboot.img,并删除了其它的img结尾的中间文件
# Pack image
UBOOT_LOAD_ADDR=`sed -n "/CONFIG_SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" ${OUTDIR}/include/autoconf.mk|tr -d 'r'`
if [ ! $UBOOT_LOAD_ADDR ]; then
UBOOT_LOAD_ADDR=`sed -n "/CONFIG_SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" ${OUTDIR}/.config|tr -d 'r'`
fi
${RKTOOLS}/loaderimage --pack --uboot ${OUTDIR}/u-boot.bin uboot.img ${UBOOT_LOAD_ADDR} ${PLATFORM_UBOOT_IMG_SIZE}
# Delete u-boot.img and u-boot-dtb.img, which makes users not be confused with final uboot.img
if [ -f ${OUTDIR}/u-boot.img ]; then
rm ${OUTDIR}/u-boot.img
fi
if [ -f ${OUTDIR}/u-boot-dtb.img ]; then
rm ${OUTDIR}/u-boot-dtb.img
fi
echo "pack uboot okay! Input: ${OUTDIR}/u-boot.bin"
pack_loader_image
这一步最终生成这个文件rk1808_loader_v1.04.105.bin,并拷贝到当前目录下
pack_trust_image
这一步生成trust.img,这是arm搞的一个跟安全有关的东西Trustzone,大致是为了保护内存中的数据不被别人窃取之类的
finish
最后一步就是打印一点信息,就ok了
总结
从结果来看,执行make.sh一共得到了以下几个东西
uboot.img
rk1808_loader_v1.04.105.bin
trust.img
我们烧录的时候,是在顶层目录的rockdev去取镜像文件,在linux下,可以很清晰得看到链接的关系,所生成的这三个文件,都会被链接到
boot.img -> ../kernel/boot.img
MiniLoaderAll.bin -> ../u-boot/rk1808_loader_v1.04.105.bin
misc.img -> ../device/rockchip/rockimg/wipe_all-misc.img
oem.img
parameter.txt -> ../device/rockchip/rk1808/parameter-buildroot.txt
recovery.img -> ../buildroot/output/rockchip_rk1808_recovery/images/recovery.img
rootfs.ext4 -> ../buildroot/output/rockchip_rk1808/images/rootfs.ext2
rootfs.img -> ../buildroot/output/rockchip_rk1808/images/rootfs.ext2
trust.img -> ../u-boot/trust.img
uboot.img -> ../u-boot/uboot.img
update.img
userdata.img
除此之外,如果希望自己修改一些uboot的内容,可以通过类似内核的make menuconfig取修改.config文件,不过注意修改完了,一定要记得将该文件写回原来的位置,就是那个默认的deconfig所在的位置,否则每次编译,当前目录下的.config都会被configs目录下的xxx_deconfig覆盖掉。
举报