#*********************************************************************************
#* post-image.sh hacking
#* 说明:
#* 分析i.MX6 post-images.sh合成SD card工作原理。
#*
#* -- 深圳 宝安西乡 曾剑锋
#********************************************************************************/ # 一、参考文档:
# . Linux mktemp命令
# http://www.runoob.com/linux/linux-comm-mktemp.html
# . Genimage - The Image Creation Tool
# https://github.com/pengutronix/genimage #!/usr/bin/env bash #
# dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME
# in ${BR_CONFIG}, then prints the corresponding list of file names for the
# genimage configuration file
#
dtb_list()
{
local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0- \-]*\)"$/\1/p' ${BR2_CONFIG})" for dt in $DTB_LIST; do
echo -n "\"$dt.dtb\", "
done
} #
# linux_image extracts the Linux image format from BR2_LINUX_KERNEL_UIMAGE in
# ${BR_CONFIG}, then prints the corresponding file name for the genimage
# configuration file
#
linux_image()
{
if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
echo "\"uImage\""
else
echo "\"zImage\""
fi
} main()
{
# 获取dtb和linux image
local FILES="$(dtb_list) $(linux_image)"
# 创建配置文件文件
local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" # 替换掉cfg模板文件中的FILES字段
sed -e "s/%FILES%/${FILES}/" \
board/freescale/common/imx/genimage.cfg.template > ${GENIMAGE_CFG} # 可能存在上次的暂存目录,删除
rm -rf "${GENIMAGE_TMP}" #
# outputpath: default: images Mandatory path where all images are written to (must exist).
# inputpath: default: input This mandatory path is searched for input images, for example bootloader binaries, kernel images (must exist).
# rootpath: default: root Mandatory path to the root filesystem (must exist).
# tmppath: default: tmp Optional path to a temporary directory. There must be enough space available here to hold a copy of the root filesystem.
# config: default: genimage.cfg Path to the genimage config file.
#
# ${TARGET_DIR} = /home/zengjf/zengjf/Buildroot/buildroot/output/target
# ${GENIMAGE_TMP} = /home/zengjf/zengjf/Buildroot/buildroot/output/build/genimage.tmp
# ${BINARIES_DIR} = /home/zengjf/zengjf/Buildroot/buildroot/output/images
# ${BINARIES_DIR} = /home/zengjf/zengjf/Buildroot/buildroot/output/images
# ${GENIMAGE_CFG} = /tmp/tmp.1Kks4kDC5mgenimage.cfg
#
genimage \
--rootpath "${TARGET_DIR}" \
--tmppath "${GENIMAGE_TMP}" \
--inputpath "${BINARIES_DIR}" \
--outputpath "${BINARIES_DIR}" \
--config "${GENIMAGE_CFG}" // 删除配置文件
rm -f ${GENIMAGE_CFG} exit $?
} main $@

post-image.sh hacking的更多相关文章

  1. Woobuntu woobuntu_build.sh hacking

    # Woobuntu woobuntu_build.sh hacking # 说明: # 有时候因为一些需求,我们需要定制一些系统,包括Ubuntu系统,于是 # 我们自然需要知道如何去解包一个Ubu ...

  2. OK335xS psplash make-image-header.sh hacking

    /***************************************************************************** * OK335xS psplash mak ...

  3. ti processor sdk linux am335x evm setup.sh hacking

    #!/bin/sh # # ti processor sdk linux am335x evm setup.sh hacking # 说明: # 本文主要对TI的sdk中的setup.sh脚本进行解读 ...

  4. ti processor sdk linux am335x evm /bin/setup-host-check.sh hacking

    #!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-host-check.sh hacking # 说明: # 本文主要对TI的sdk ...

  5. ti processor sdk linux am335x evm /bin/create-sdcard.sh hacking

    #!/bin/bash # # ti processor sdk linux am335x evm /bin/create-sdcard.sh hacking # 说明: # 本文主要对TI的sdk中 ...

  6. ti processor sdk linux am335x evm /bin/unshallow-repositories.sh hacking

    #!/bin/bash # # ti processor sdk linux am335x evm /bin/unshallow-repositories.sh hacking # 说明: # 本文主 ...

  7. ti processor sdk linux am335x evm /bin/setup-package-install.sh hacking

    #!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-package-install.sh hacking # 说明: # 本文主要对T ...

  8. ti processor sdk linux am335x evm /bin/setup-uboot-env.sh hacking

    #!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-uboot-env.sh hacking # 说明: # 本文主要对TI的sdk中 ...

  9. ti processor sdk linux am335x evm /bin/setup-minicom.sh hacking

    #!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-minicom.sh hacking # 说明: # 本文主要对TI的sdk中的s ...

  10. ti processor sdk linux am335x evm /bin/setup-targetfs-nfs.sh hacking

    #!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-targetfs-nfs.sh hacking # 说明: # 本文主要对TI的s ...

随机推荐

  1. dp 入门

    1.HDU 1003 求最长连续相加的和. dp[i]=max(a[i],dp[i-1]+a[i]); dp[i]表示以 i 结尾的最大值. 再开/个strat去标记从哪里开始. #include & ...

  2. Mysql for Linux安装配置之—— 源码安装

    1.安装 --假设已经有mysql-5.5.10.tar.gz以及cmake-2.8.4.tar.gz两个源码压缩文件1)先安装cmake(mysql5.5以后是通过cmake来编译的)   # ta ...

  3. vue+vue-resource+vue-cookie随笔

    vue-resource http拦截器interceptors: Vue.http.interceptors.push(function(request, next) {...} V-cookie: ...

  4. MFC消息-自定义消息

    转:http://blog.csdn.net/penpenandtongtong/article/details/18598907 像MFC的窗口发送消息,可以进行自定义的动作行为,因此很多时候非常有 ...

  5. 命令创建Vue

    创建vue+webpack vue init webpack projectName 基础 Vue+webpack+Vux 新建文件命令 # install vue-cli npm install - ...

  6. ubuntu下唤醒或休眠远程计算机

    ubuntu让我明白,没有什么完美的东西,要想完美必须付出代价.要么花时间折腾,要么花时间赚钱买系统. 人生也是一样,所以不要期待什么完美.哪有那么好的人,在合适的时间合适的地点让你遇见,还对你有感觉 ...

  7. 逆袭之旅DAY.XIA.Object中常用方法

    2018-07-31

  8. Win10系列:VC++ Direct3D模板介绍1

    Visual Studio为开发Direct3D应用程序提供了便捷的模版,读者可以不必手动去新建Direct3D中所使用到的基础资源,而只需专注于图形的绘制.本小节主要为读者介绍这个模版中用于绘制图形 ...

  9. nodejs项目文件搭建环境

    nodeJS,作为一门较为“新鲜的”的原因,近年来普遍受到一些前端想转为全栈的ITer青睐,在想用nodeJS配合数据库开发出一个小玩意的路上,萌新们第一步便要遇到就是环境的支持.node作为Java ...

  10. Centos常用快捷键

    终端快捷键  tab=补全 ctrl+a=开始位置 ctrl+e=最后位置 ctrl+k=删除此处至末尾所有内容 ctrl+u=删除此处至开始所有内容 ctrl+d=删除当前字母 ctrl+w=删除此 ...