博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
post-image.sh hacking
阅读量:7044 次
发布时间:2019-06-28

本文共 2830 字,大约阅读时间需要 9 分钟。

#*********************************************************************************#*                      post-image.sh hacking#* 说明:#*     分析i.MX6 post-images.sh合成SD card工作原理。#*#*                                              2018-1-23 深圳 宝安西乡 曾剑锋#********************************************************************************/# 一、参考文档:#    1. Linux mktemp命令#        http://www.runoob.com/linux/linux-comm-mktemp.html#    2. 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-9 \-]*\)"$/\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 $@

 

转载于:https://www.cnblogs.com/zengjfgit/p/8334889.html

你可能感兴趣的文章
linux关闭防火墙及开放端口
查看>>
Git常见用法
查看>>
「镁客·请讲」星逻智能王海滨:为无人机提供特斯拉服务,实现“无人化”操作 ...
查看>>
Spring AOP 实现原理
查看>>
BlockingQueue与Condition原理解析
查看>>
Nginx安全优化
查看>>
DilatedNet - 扩张卷积(语义分割)
查看>>
强化学习基础-对偶梯度上升
查看>>
设计模式——单例模式
查看>>
5G不是原子弹,任正非感谢美国帮忙宣传华为
查看>>
C++面向对象高级编程(上) 第二周 侯捷
查看>>
Spring Cloud Greenwich 新特性和F升级分享
查看>>
发现可远程控制玩家电脑的Steam漏洞,Valve 7500美元奖励上报人 ...
查看>>
0110-如何给Kerberos环境下的CDH集群添加Gateway节点
查看>>
正火的 Spring Boot 2.0 更新了啥?
查看>>
Kubernetes(K8s)Events介绍(上)
查看>>
Apsara SA系列混合云存储阵列发布
查看>>
携新一代车规级固态激光雷达而来,速腾聚创为助力自动驾驶量产有何新动作?...
查看>>
RStudio: Warning message: Setting LC_CTYPE failed, using "C" 浅析
查看>>
VDSM command failed: The method does not exist / is not available.
查看>>