solo-io / packer-plugin-arm-image

Packer plugin for ARM images
Apache License 2.0
426 stars 104 forks source link

Created image is aarch64 instead of armv7l #160

Closed YannickRiou closed 1 year ago

YannickRiou commented 1 year ago

I tried to create an image using this json :

{
  "variables": {
    "cm4_version": "master_johto",
    "esp32_version": "master"
  },
  "builders": [
    {
      "type": "arm-image",
      "iso_url": "https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-lite.img.xz",
      "iso_checksum": "sha256:b5e3a1d984a7eaa402a6e078d707b506b962f6804d331dcc0daa61debae3a19a",
      "target_image_size": 2000000000,
      "output_filename": "johto_CM4-{{user `cm4_version`}}_esp32-{{user `esp32_version`}}.img",
      "qemu_binary": "qemu-arm-static"
    }
  ],
  "provisioners": [
    {
      "type": "file",
      "source": "./configFiles/",
      "destination": "/home/pi/configFiles/"
    },
    {
      "type": "file",
      "source": "./firstboot.sh",
      "destination": "/home/pi/firstboot.sh"
    },
    {
      "type": "file",
      "source": "./firstboot.service",
      "destination": "/etc/systemd/system/firstboot.service"
    },
    {
      "type": "shell",
      "script": "./update.sh"
    },
    {
      "type": "shell-local",
      "inline": [
        "./updateProdImg.sh -v {{user `cm4_version`}} -u yes -g yes --vesp {{user `esp32_version`}}"
      ]
    },
    {
      "type": "file",
      "source": "./buildFolder/",
      "destination": "/home/pi/buildFolder/"
    },
    {
      "type": "shell",
      "script": "./post-run.sh"
    },
    {
      "type": "shell",
      "inline": "cd /var/www/enrolapp;composer update"
    },
    {
      "type": "shell",
      "inline": "sed -i 's/^CODE_VERSION =.*/CODE_VERSION = {{user `cm4_version`}}/' /home/pi/configFiles/config.ini"
    }
  ],
  "post-processors": [
    {
      "type": "compress",
      "output": "johto_CM4-{{user `cm4_version`}}_esp32-{{user `esp32_version`}}.gz"
    }
  ]
}

After booting it on a CM4 (64bit CPU), the OS seems to be 64bit even if the image provided was 32bit (uname says it is aarch64 where it should be armv7l). I think this is because of what QEMU is compatible with. Is this normal ?