Skip to content
Snippets Groups Projects

Images recipes for Raspberry Pi 64b

Merged Denis Pynkin requested to merge wip/d4s/apertis-image-recipes_rpi64 into apertis/v2021dev3
All threads resolved!
1 file
+ 187
0
Compare changes
  • Side-by-side
  • Inline
  • 2a701388
    Add recipe for APT-based rpi64 image · 2a701388
    Denis Pynkin authored
    This recipe is needed to produce APT-based bootable images
    for Raspberry Pi 3 and 4.
    RPi requires MS-DOS partitioning and FAT-formatted 1-st partition,
    hence the new recipe file is created.
    
    The 1-st partition must be FAT and contain:
    - config.txt -- boot configuration
    - firmware files for initial boot
    - DTB files
    - u-boot.bin -- unified rpi64 U-Boot suitable for Rpi 3 and 4
    
    The 2-nd partition containing extlinux config (/boot) must have a bootable
    flag allowing U-Boot to find configuration.
    
    Signed-off-by: default avatarDenis Pynkin <denis.pynkin@collabora.com>
+ 187
0
{{ $architecture := or .architecture "arm64" }}
{{ $type := or .type "minimal" }}
{{ $suite := or .suite "v2021dev3" }}
{{ $ospack := or .ospack (printf "ospack_%s-%s-%s" $suite $architecture $type) }}
{{ $image := or .image (printf "apertis_%s-%s-%s-rpi64" $suite $type $architecture) }}
{{ $cmdline := or .cmdline " rootwait ro quiet splash plymouth.ignore-serial-consoles fsck.mode=auto fsck.repair=yes" }}
{{ $demopack := or .demopack "disabled" }}
{{ if eq $type "minimal" }}
{{ $demopack := "disabled" }}
{{ end }}
{{- $unpack := or .unpack "true" }}
architecture: {{ $architecture }}
actions:
{{- if eq $unpack "true" }}
- action: unpack
description: Unpack {{ $ospack }}
compression: gz
file: {{ $ospack }}.tar.gz
{{- end }}
- action: image-partition
imagename: {{ $image }}.img
{{ if eq $type "minimal" }}
imagesize: 4G
{{ else }}
imagesize: 15G
{{end}}
partitiontype: msdos
mountpoints:
- mountpoint: /
partition: system
- mountpoint: /boot
partition: boot
options: [ x-systemd.automount ]
- mountpoint: /boot/firmware
partition: firmware
buildtime: true
- mountpoint: /home
partition: general_storage
partitions:
- name: firmware
fs: vfat
start: 0%
end: 64M
- name: boot
fs: ext2
start: 64M
end: 256M
flags: [ boot ]
- name: system
fs: ext4
start: 256M
end: 3000M
- name: general_storage
fs: ext4
start: 3000M
end: 100%
- action: filesystem-deploy
setup-kernel-cmdline: true
append-kernel-cmdline: {{ $cmdline }}
description: Deploying ospack onto image
- action: overlay
source: overlays/reset-uboot-bootcount
# on arm64 the initramfs post-install does not call zz-u-boot-menu from
# u-boot-menupackage when it is installed at the same time as the kernel
# work around it by installing the the boot configuration tools first
# see https://phabricator.apertis.org/T6325
- action: apt
description: Boot configuration packages
packages:
- initramfs-tools
- u-boot-menu
- action: apt
description: Kernel and system packages
packages:
- linux-image-{{$architecture}}
- e2fsprogs
- action: apt
description: U-Boot package
packages:
- u-boot-rpi
- action: apt
description: Firmware packages
packages:
- raspi-firmware
- firmware-brcm80211
- action: run
description: Install Raspberry Pi boot firmware
chroot: true
command: sh -c "cp -av /usr/lib/raspi-firmware/* /boot/firmware/"
- action: run
description: Install U-Boot
chroot: true
command: sh -c "cp -av /usr/lib/u-boot/rpi_arm64/u-boot.bin /boot/firmware/"
- action: overlay
description: Copy config.txt
source: overlays/raspberrypi/firmware
destination: /boot/firmware
- action: run
description: Copy DTBs from the kernel
chroot: true
command: sh -c "cp -av boot/dtbs/*-arm64/broadcom/* /boot/firmware/"
# Add multimedia demo pack
# Provide URL via '-t demopack:"https://images.apertis.org/media/multimedia-demo.tar.gz"'
# to add multimedia demo files
{{ if ne $demopack "disabled" }}
# Use wget to get some insight about https://phabricator.collabora.com/T11930
# TODO: Revert to a download action once the cause is found
- action: run
description: Download multimedia demo pack
chroot: false
command: wget --debug {{ $demopack }} -O "${ARTIFACTDIR}/multimedia-demo.tar.gz"
- action: unpack
description: Unpack multimedia demo pack
compression: gz
file: multimedia-demo.tar.gz
- action: run
description: Clean up multimedia demo pack tarball
chroot: false
command: rm "${ARTIFACTDIR}/multimedia-demo.tar.gz"
{{ end }}
- action: run
description: "Save installed package status"
chroot: false
command: gzip -c "${ROOTDIR}/var/lib/dpkg/status" > "${ARTIFACTDIR}/{{ $image }}.img.pkglist.gz"
- action: run
description: Cleanup /var/lib
script: scripts/remove_var_lib_parts.sh
# the clearing of machine-id can't be done before this point since
# systemd-boot requires the machine-id to be set for reasons related to
# dual-boot scenarios:
# * to avoid conflicts when creating entries, see the `90-loaderentry` kernel
# install trigger
# * to set the entries for the currently booted installation as default in
# the loader.conf generated by `bootctl install`
#
# in our image this is not useful, as the actual machine-id is supposed to be
# uniquely generated on the first boot. however the impact is negligible, as
# things still work albeit the code used to potentially disambiguate entries
# doesn't match a real machine-id
- action: run
chroot: false
description: "Empty /etc/machine-id so it's regenerated on first boot with an unique value"
command: truncate -s0 "${ROOTDIR}/etc/machine-id"
- action: run
description: List files on {{ $image }}
chroot: false
script: scripts/list-files "$ROOTDIR" | gzip > "${ARTIFACTDIR}/{{ $image }}.img.filelist.gz"
- action: run
description: Create block map for {{ $image }}.img
postprocess: true
command: bmaptool create {{ $image }}.img > {{ $image }}.img.bmap
- action: run
description: Compress {{ $image }}.img
postprocess: true
command: gzip -f {{ $image }}.img
- action: run
description: Checksum for {{ $image }}.img.gz
postprocess: true
command: sha256sum {{ $image }}.img.gz > {{ $image }}.img.gz.sha256
Loading