当前位置: 首页 > article >正文

genimage 打包镜像

前言

buildroot 使用 genimage 工具打包镜像

工作原理

用户准备好待打包的原料:uboot.bin、zImage、rootfs 等,然后编写一个配置文件 genimage.cfg,描述如何进行打包,然后执行命令 genimage -c genimage.cfg 就可以打包好一个镜像。

实例分析

原料:

liyongjun@Box:~/project/board/buildroot/LCzero/images_lyj$ ls
boot.scr  genimage.cfg  rootfs.ext2  rootfs.ext4  sun8i-v3s-licheepi-zero-dock.dtb  sun8i-v3s-licheepi-zero.dtb  u-boot-sunxi-with-spl.bin  zImage

genimage.cfg

image boot.vfat {
	vfat {
		files = {
			"zImage",
			"sun8i-v3s-licheepi-zero-dock.dtb",
			"sun8i-v3s-licheepi-zero.dtb",
			"boot.scr"
		}
	}

	size = 8M
}

image sdcard.img {
	hdimage {
	}

	partition u-boot {
		in-partition-table = "no"
		image = "u-boot-sunxi-with-spl.bin"
		offset = 8K
		size = 504K # 512KB - 8KB
	}

	partition boot {
		partition-type = 0xC
		bootable = "true"
		image = "boot.vfat"
	}

	partition rootfs {
		partition-type = 0x83
		image = "rootfs.ext4"
		size = 0
	}
}

生成:

liyongjun@Box:~/project/board/buildroot/LCzero/images_lyj$ ../host/bin/genimage --rootpath /tmp/tmp.fdst8UdlaK --tmppath /home/liyongjun/project/board/buildroot/DIY_V3S/images_lyj/genimage.tmp --inputpath ./  --outputpath ./ --config genimage.cfg
INFO: cmd: "rm -rf "/home/liyongjun/project/board/buildroot/DIY_V3S/images_lyj/genimage.tmp"/*" (stderr):
INFO: cmd: "mkdir -p "/home/liyongjun/project/board/buildroot/DIY_V3S/images_lyj/genimage.tmp"" (stderr):
INFO: cmd: "cp -a "/tmp/tmp.fdst8UdlaK" "/home/liyongjun/project/board/buildroot/DIY_V3S/images_lyj/genimage.tmp/root"" (stderr):
INFO: cmd: "mkdir -p "/home/liyongjun/project/board/buildroot/LCzero/images_lyj/./"" (stderr):
INFO: vfat(boot.vfat): cmd: "mkdosfs   '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//boot.vfat'" (stderr):
INFO: vfat(boot.vfat): adding file 'zImage' as 'zImage' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//boot.vfat' '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//zImage' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'sun8i-v3s-licheepi-zero-dock.dtb' as 'sun8i-v3s-licheepi-zero-dock.dtb' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//boot.vfat' '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//sun8i-v3s-licheepi-zero-dock.dtb' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'sun8i-v3s-licheepi-zero.dtb' as 'sun8i-v3s-licheepi-zero.dtb' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//boot.vfat' '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//sun8i-v3s-licheepi-zero.dtb' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'boot.scr' as 'boot.scr' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//boot.vfat' '/home/liyongjun/project/board/buildroot/LCzero/images_lyj/.//boot.scr' '::'" (stderr):
INFO: hdimage(sdcard.img): adding partition 'u-boot' from 'u-boot-sunxi-with-spl.bin' ...
INFO: hdimage(sdcard.img): adding partition 'boot' (in MBR) from 'boot.vfat' ...
INFO: hdimage(sdcard.img): adding partition 'rootfs' (in MBR) from 'rootfs.ext4' ...
INFO: hdimage(sdcard.img): adding partition '[MBR]' ...
INFO: hdimage(sdcard.img): writing MBR
INFO: cmd: "rm -rf "/home/liyongjun/project/board/buildroot/DIY_V3S/images_lyj/genimage.tmp"/*" (stderr):

liyongjun@Box:~/project/board/buildroot/LCzero/images_lyj$ ls
boot.scr   genimage.cfg  rootfs.ext4  sun8i-v3s-licheepi-zero-dock.dtb  u-boot-sunxi-with-spl.bin
boot.vfat  rootfs.ext2   sdcard.img   sun8i-v3s-licheepi-zero.dtb       zImage

生成了 sdcard.img


http://www.kler.cn/a/150199.html

相关文章:

  • 文件操作案例
  • 嵌入式硬件工程师的职业发展规划
  • Linux下Java的多种方式安装
  • 【react使用AES对称加密的实现】
  • Linux:网络协议socket
  • WPF使用Prism框架首页界面
  • ESP32-Web-Server编程- WebSocket 编程
  • leetcode二叉树
  • Spring Boot项目Service类单元测试自动生成
  • TikTok区块链实践:数字社交媒体的去中心化未来
  • 记录一次登录相关bug
  • Hive_last_value()
  • 解决QT信号在信号和槽连接前发出而导致槽函数未调用问题
  • 爬虫代理技术与构建本地代理池的实践
  • 亚马逊云科技向量数据库助力生成式AI成功落地实践探秘(二)
  • Java LeetCode篇-深入了解关于单链表的经典解法
  • Linux命令中的符号
  • 初学者如何入门深度学习:以手写数字字符识别为例看AI 的学习路径,一图胜千言!
  • 福德植保无人机:农业科技的新篇章
  • 小航助学题库蓝桥杯题库c++选拔赛(23年8月)(含题库教师学生账号)
  • 卷积神经网络(CNN)注意力检测
  • 统计英语单词
  • 在Docker上部署Springboot项目
  • 大一学编程怎么学?刚接触编程怎么学习,有没有中文编程开发语言工具?
  • 为什么预处理对象会提升处理的性能
  • 线性可分SVM摘记