From bd2cb308854a5ec9f438c0604a47a5eef6880d92 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Mon, 11 Aug 2025 00:33:36 +0200 Subject: Fix raspberry install correct kernel/firmware using rpi-update It can't be tested on mocked debian docker container, therefore disabling the testing for it --- roles/bootstrap/tasks/install-raspberry.yml | 21 +++++++++++-------- roles/bootstrap/templates/raspberry.config.j2 | 5 +++++ roles/bootstrap/vars/debian.yml | 26 ------------------------ roles/bootstrap/vars/raspberry.yml | 29 +++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 34 deletions(-) delete mode 100644 roles/bootstrap/vars/debian.yml create mode 100644 roles/bootstrap/vars/raspberry.yml diff --git a/roles/bootstrap/tasks/install-raspberry.yml b/roles/bootstrap/tasks/install-raspberry.yml index b287746..e7a6914 100644 --- a/roles/bootstrap/tasks/install-raspberry.yml +++ b/roles/bootstrap/tasks/install-raspberry.yml @@ -1,6 +1,6 @@ --- -- name: "Include distribution vars" - ansible.builtin.include_vars: "{{ ansible_distribution | lower }}.yml" +- name: "Include Raspberry vars" + ansible.builtin.include_vars: "raspberry.yml" - name: "Ensure install dependencies are installed on live environment" ansible.builtin.apt: @@ -55,14 +55,19 @@ changed_when: true with_items: - "apt-get update" - - "apt-get install -y --no-install-recommends {{ bootstrap_distro.packages | join(' ') }}" + - "apt-get install -y {{ bootstrap_distro.packages | join(' ') }}" -- name: "Copy kernel to boot partition" - # NOTE: Copying {{ mnt_root_path }}/boot/ doesn't work - # NOTE: Alternative, download latest fresh from https://github.com/raspberrypi/firmware/archive/refs/heads/master.zip - ansible.builtin.shell: | - cp -r /boot/firmware/* {{ mnt_boot_path }}/ +- name: "Update rpi kernel and firmware" + ansible.builtin.command: + cmd: "arch-chroot {{ mnt_root_path }} rpi-update" + environment: + SKIP_BACKUP: "1" + WANT_64BIT: "1" + WANT_PI5: "1" + SKIP_WARNING: "1" + SKIP_CHECK_PARTITION: "1" changed_when: true + tags: ["molecule-notest"] - name: "Configure bootloader" ansible.builtin.template: diff --git a/roles/bootstrap/templates/raspberry.config.j2 b/roles/bootstrap/templates/raspberry.config.j2 index def13e0..0faa3df 100644 --- a/roles/bootstrap/templates/raspberry.config.j2 +++ b/roles/bootstrap/templates/raspberry.config.j2 @@ -9,6 +9,11 @@ arm_64bit=1 disable_overscan=1 arm_boost=1 +[pi5] +kernel=kernel_2712.img +dtparam=pciex1 +dtparam=pciex1_gen=2 + [cm4] otg_mode=1 diff --git a/roles/bootstrap/vars/debian.yml b/roles/bootstrap/vars/debian.yml deleted file mode 100644 index a305470..0000000 --- a/roles/bootstrap/vars/debian.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -bootstrap_distro: - name: "bookworm" # => Debian 12/Raspberry OS - mirror_url: "http://deb.debian.org/debian" - packages: - - "raspberrypi-kernel" - - "raspberrypi-bootloader" - - "firmware-brcm80211" - - "rpi-eeprom" - -bootstrap_opts: "--arch=arm64" - -bootstrap_apt_ignored_preferences: "" - -# yamllint disable rule:line-length -bootstrap_apt_sources: | - deb [signed-by=/usr/share/keyrings/raspberrypi.gpg] http://archive.raspberrypi.org/debian {{ bootstrap_distro.name }} main - deb http://deb.debian.org/debian {{ bootstrap_distro.name }} main -# yamllint enable rule:line-length - -# 1 = SD card -# f = Restart (loop back) -# 6 = NVMe SSD -# 4 = USB mass storage -# 1 = SD card (fallback) -bootstrap_boot_order: "0x1f641" diff --git a/roles/bootstrap/vars/raspberry.yml b/roles/bootstrap/vars/raspberry.yml new file mode 100644 index 0000000..9915526 --- /dev/null +++ b/roles/bootstrap/vars/raspberry.yml @@ -0,0 +1,29 @@ +--- +bootstrap_distro: + name: "bookworm" # => Debian 12 + mirror_url: "http://deb.debian.org/debian" + packages: + - "rpi-eeprom" + - "rpi-update" + - "fake-hwclock" + - "man-db" + - "manpages" + - "net-tools" + - "ntp" + +bootstrap_opts: "--arch=arm64" + +bootstrap_apt_ignored_preferences: "" + +# yamllint disable rule:line-length +bootstrap_apt_sources: | + deb [signed-by=/usr/share/keyrings/raspberrypi.gpg] http://archive.raspberrypi.org/debian {{ bootstrap_distro.name }} main + deb http://deb.debian.org/debian {{ bootstrap_distro.name }} main +# yamllint enable rule:line-length + +# 1 = SD card +# f = Restart (loop back) +# 6 = NVMe SSD +# 4 = USB mass storage +# 1 = SD card (fallback) +bootstrap_boot_order: "0x1f641" -- cgit v1.2.3