Raspberry pi 构建较小尺寸的树莓pi图像

Raspberry pi 构建较小尺寸的树莓pi图像,raspberry-pi,packer,packer-builder,Raspberry Pi,Packer,Packer Builder,我正在尝试使用packerbuilderarm()社区插件构建小尺寸的树莓Pi图像 生成的图像仍然是2GB。有人建议如何缩小图像大小吗。谢谢 { "variables": {}, "builders": [ { "type": "arm", "file_urls": [ "http://downloads.raspberrypi.org/raspios_lite_

我正在尝试使用packerbuilderarm()社区插件构建小尺寸的树莓Pi图像

生成的图像仍然是2GB。有人建议如何缩小图像大小吗。谢谢

{
  "variables": {},
  "builders": [
{
  "type": "arm",
  "file_urls": [
    "http://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2020-05-28/2020-05-27-raspios-buster-lite-armhf.zip"
  ],
  "file_checksum_url": "http://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2020-05-28/2020-05-27-raspios-buster-lite-armhf.zip.sha256",
  "file_checksum_type": "sha256",
  "file_target_extension": "zip",
  "image_build_method": "reuse",
  "image_path": "custom-raspberry-pi-os.img",
  "image_size": "700M",
  "image_type": "dos",
  "image_partitions": [
    {
      "name": "boot",
      "type": "c",
      "start_sector": "8192",
      "filesystem": "vfat",
      "size": "256M",
      "mountpoint": "/boot"
    },
    {
      "name": "root",
      "type": "83",
      "start_sector": "532480",
      "filesystem": "ext4",
      "size": "0",
      "mountpoint": "/"
    }
  ],
  "image_chroot_env": [
    "PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
  ],
  "qemu_binary_source_path": "/usr/bin/qemu-arm-static",
  "qemu_binary_destination_path": "/usr/bin/qemu-arm-static"
}
  ],
  "provisioners": [
{
  "type": "shell",
  "inline": ["touch /tmp/test"]
}
  ]
}```

您可能需要考虑删除其中不需要的程序。然后使用类似于
resize2fs

的方法调整分区大小一个好的解决方案是创建一个自定义后处理器来删除未使用的程序并将图像压缩为zip文件。