首页 > 解决方案 > 构建更小尺寸的树莓派镜像

问题描述

我正在尝试使用 packer-builder-arm ( https://github.com/mkaczanowski/packer-builder-arm ) 社区插件构建小型 Raspberry 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"]
}
  ]
}```

标签: raspberry-pipackerpacker-builder

解决方案


您可能想考虑删除那里不需要的程序。然后使用类似resize2fs.


推荐阅读