imx6q initramfs rootfs.cpio.gz.u-boot 的生成详解

fsl-image-mfgtool-initramfs-xxxx.rootfs.cpio.gz.u-boot 的生成流程如下, 该流程来自于yocto2.1 的BB 文件:

(cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio)
        if [ ! -L ${IMAGE_ROOTFS}/init -a ! -e ${IMAGE_ROOTFS}/init ]; then
                if [ -L ${IMAGE_ROOTFS}/sbin/init -o -e ${IMAGE_ROOTFS}/sbin/init ]; then
                        ln -sf /sbin/init ${WORKDIR}/cpio_append/init
                else
                        touch ${WORKDIR}/cpio_append/init
                fi
                (cd  ${WORKDIR}/cpio_append && echo ./init | cpio -oA -H newc -F ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio)
        fi
        COMPRESS_CMD_gz = "gzip -f -9 -c ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz

生成.u-boot

oe_mkimage () {
    mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C $2 -n ${IMAGE_NAME} \
        -d ${DEPLOY_DIR_IMAGE}/$1 ${DEPLOY_DIR_IMAGE}/$1.u-boot
    if [ x$3 = x"clean" ]; then
        rm $1
    fi
}

COMPRESS_CMD_gz.u-boot      = "${COMPRESS_CMD_gz}; oe_mkimage ${IMAGE_NAME}.rootfs.${type}.gz gzip clean"

rootfs.cpio.gz.u-boot 的解压

   # 为什么要跳过64byte, 是因为mkimage 只是给镜像头部加了64 byte 的信息,故去掉它,就是真正的镜像!
    $ dd if=uramdisk.img of=ramdisk.img.gz skip=64 bs=1

    $ gunzip ramdisk.img.gz

   $ mkdir ramdisk; cd ramdisk

    $ cpio -i < ../ramdisk.img

    # 

你可能感兴趣的:(armlinux,mfgtools,cpio,initramfs)