#*********************************************************************************
#* 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. 【LeetCode】N数和

    1. 3Sum 给定一个无序数组(可能存在重复元素),是否存在三个数之和为0,输出所有不重复的三元组. e.g. 给定数组 [-1, 0, 1, 2, -1, -4], 结果集为:[ [-1, 0, ...

  2. 七、持久层框架(MyBatis)

    一.MyBatis学习 平时我们都用JDBC访问数据库,除了自己需要写SQL,还要操作Connection,Statement,ResultSet这些. 使用MyBatis,只需要自己提供SQL语句, ...

  3. noip2014生活大爆炸版石头剪刀布

    题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一 样,则不分胜负.在<生活大爆炸>第二季第8集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...

  4. 转 Deep Learning for NLP 文章列举

    原文链接:http://www.xperseverance.net/blogs/2013/07/2124/   大部分文章来自: http://www.socher.org/ http://deepl ...

  5. [BZOJ1269]文本编辑器editor

    Problem 有n个操作 Solution splay模板题,用splay维护下标. Notice 需要把l的前一个位置旋转到根,r的后一个位置旋转到根的右节点.所以特别要注意0的大坑. Code ...

  6. TTL反相器的外部特性

    TTL反相器的外部特性 电压传输特性 输入端噪声容限特性 静态输入特性: 静态输出特性: 动态特性: 传输延迟时间:是由晶体管的延迟时间,电阻以及寄生电容元素引起的.包括俩部分:输入由低电平跳为高电平 ...

  7. 如何在Ubuntu中安装中文输入法

    在使用ubuntu系统时,有的时候总觉得英文输入法不方便操作,总希望能有中文输入法可以辅助操作,那怎样才能在ubuntu中安装中文输入法呢?下面有一种简单的方法可以安装中文输入法. 如何在ubuntu ...

  8. 什么是XP

    极限编程(XP)是敏捷过程中最富盛名的一个.下述这些特点使得敏捷过程能够较好地适应商业竞争环境下对小型项目提出的有效资源和有限开发时间的约束. 极限编程的有效实践 极限编程的整体开发过程 极限编程的迭 ...

  9. 开窗函数 函数() OVER()

    -- 初始化 CREATE TABLE T_Person (FName VARCHAR2(20), FCity VARCHAR2(20), FAge INT, FSalary INT); INSERT ...

  10. Array.apply(null, {length: 20})和Array(20)的理解

    话说今晚在学习Vue.js教程里:Render函数,这一章节是发现了一个问题,就是利用下面的这个render函数可以渲染20个重复的段落: render: function (createElemen ...