Skip to content
Snippets Groups Projects
Commit 9cdaffb7 authored by Denis Pynkin's avatar Denis Pynkin
Browse files

Add bootable APT image for rk3399 SoC


The recipe creates the image for rockpro64 board bootable
with MMC or EMMC bootable devices.

New variable `sbc` (single-board computer) is introduced for selecting
the target device. This variable is needed for proper U-Boot files
selection and should have the same name as U-Boot directory targeting
to this device under `/usr/lib/u-boot/`:
 - firefly-rk3399
 - pinebook-pro-rk3399
 - puma-rk3399
 - rock-pi-4-rk3399
 - rock64-rk3328
 - rockpro64-rk3399

"rock-pi-4-rk3399" is used as a default target device.

Signed-off-by: default avatarDenis Pynkin <denis.pynkin@collabora.com>
parent f5ae347e
No related branches found
No related tags found
No related merge requests found
{{ $architecture := or .architecture "arm64" }}
{{ $type := or .type "minimal" }}
{{ $suite := or .suite "v2022dev0" }}
{{ $ospack := or .ospack (printf "ospack_%s-%s-%s" $suite $architecture $type) }}
{{ $sbc := or .sbc "rock-pi-4-rk3399" }}
{{ $cmdline := or .cmdline "rootwait rw verbose splash plymouth.ignore-serial-consoles fsck.mode=auto fsck.repair=yes earlyprintk earlycon=uart8250,mmio32,0xff1a0000 " }}
{{ $image := or .image (printf "apertis-%s-%s-%s-%s" $suite $type $architecture $sbc) }}
{{ $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: gpt
mountpoints:
- mountpoint: /
partition: system
- mountpoint: /boot
partition: boot
- mountpoint: /home
partition: general_storage
partitions:
- name: boot
fs: ext2
start: 32768s
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: apt
description: U-Boot package
packages:
- u-boot-rockchip
- action: raw
description: Install loader1 for {{ $sbc }}
origin: filesystem
source: /usr/lib/u-boot/{{ $sbc }}/idbloader.img
offset: {{ sector 64 }}
- action: raw
description: Install U-Boot for {{ $sbc }}
origin: filesystem
source: /usr/lib/u-boot/{{ $sbc }}/u-boot.itb
offset: {{ sector 16384 }}
- action: overlay
description: Set the default bootcounter
source: overlays/default-uboot-bootcount
- action: overlay
description: "Enable USB automount"
source: overlays/usb-automount-rules
# 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 }}
# 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
{{- if eq $architecture "armhf" }}
- action: overlay
source: overlays/initramfs-modules-armhf
{{ end }}
- action: apt
description: Kernel and system packages
packages:
- kmod
- linux-base
{{ if eq $architecture "armhf" }}
- linux-image-armmp
{{ else }}
- linux-image-{{$architecture}}
{{ end }}
- action: run
description: Switch to live APT repos
chroot: true
script: scripts/switch-apt-to-live.sh -r {{ $suite }}
- 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: Generate BOM file
chroot: false
script: scripts/generate_bom.py -d "${ROOTDIR}/usr/share/doc" -v 2 | gzip > "${ARTIFACTDIR}/{{ $image }}.img.licenses.gz"
- action: run
description: Delete /usr/share/doc
chroot: false
command: rm -rf "${ROOTDIR}"/usr/share/doc/*
- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment