[gnome-build-meta/valentindavid/rpi4-ostree] Add support for dracut+ostree in rpi4 image
- From: Valentin David <valentindavid src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/valentindavid/rpi4-ostree] Add support for dracut+ostree in rpi4 image
- Date: Wed, 3 Jun 2020 10:42:08 +0000 (UTC)
commit 0111912229b984e394a5b1b955fb5400f04d6f08
Author: Valentin David <valentin david codethink co uk>
Date: Mon May 18 16:03:44 2020 +0200
Add support for dracut+ostree in rpi4 image
elements/boards/raspberrypi-4/bsp.bst | 10 --
elements/boards/raspberrypi-4/bsp/boot.bst | 9 --
elements/boards/raspberrypi-4/bsp/linux.bst | 108 ++++++++++-----
.../raspberrypi-4/bsp/rpi-efi-boot-script.bst | 18 +++
elements/boards/raspberrypi-4/bsp/u-boot.bst | 28 ++++
elements/boards/raspberrypi-4/deps.bst | 17 +++
elements/boards/raspberrypi-4/filesystem.bst | 1 -
elements/boards/raspberrypi-4/image-deps.bst | 9 ++
elements/boards/raspberrypi-4/image.bst | 151 ++++++++++++++-------
elements/boards/raspberrypi-4/initramfs.bst | 68 ++++++++++
elements/boards/raspberrypi-4/initramfs/deps.bst | 21 +++
.../raspberrypi-4/initramfs/initial-scripts.bst | 7 +
elements/boards/raspberrypi-4/repair-mbr.bst | 20 +++
elements/boards/raspberrypi-4/repo.bst | 42 ++++++
fdsdk-firmware.patch | 13 ++
files/boards/raspberrypi-4/boot.script | 15 ++
.../raspberrypi-4/repair-mbr/module-setup.sh | 22 +++
.../raspberrypi-4/repair-mbr/repair-mbr.service | 12 ++
.../boards/raspberrypi-4/repair-mbr/repair-mbr.sh | 38 ++++++
19 files changed, 509 insertions(+), 100 deletions(-)
---
diff --git a/elements/boards/raspberrypi-4/bsp/linux.bst b/elements/boards/raspberrypi-4/bsp/linux.bst
index 4ec8236c..037cd2cc 100644
--- a/elements/boards/raspberrypi-4/bsp/linux.bst
+++ b/elements/boards/raspberrypi-4/bsp/linux.bst
@@ -1,33 +1,41 @@
-kind: autotools
-
-build-depends:
-- freedesktop-sdk.bst:bootstrap-import.bst
-- freedesktop-sdk.bst:components/kmod.bst
-- freedesktop-sdk.bst:components/flex.bst
-- freedesktop-sdk.bst:components/bison.bst
-- freedesktop-sdk.bst:components/bc.bst
-- freedesktop-sdk.bst:components/gzip.bst
-
-
+kind: manual
sources:
- kind: git_tag
- url: https://github.com/raspberrypi/linux
- # Aim to track 5.4 LTS work for vc4-kms etc
+ url: github_com:raspberrypi/linux.git
+ # tpreston/raspi4 builds against 5.5 a0262f184d79838604ca07ec785ec30c22abf3a6
+ # Aim to track 5.4 LTS work
# track: 5.4.y
track: a98ba9221895e03b8736312ce6666005da5968a1
track-tags: false
+depends:
+- freedesktop-sdk.bst:components/kmod.bst
+
+build-depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+- freedesktop-sdk.bst:components/bison.bst
+- freedesktop-sdk.bst:components/flex.bst
+- freedesktop-sdk.bst:components/bc.bst
+- freedesktop-sdk.bst:components/gzip.bst
+
variables:
- make: make Image modules dtbs
+ bootdir: /boot
+ kernel_arch: arm64
+ image-name: arch/arm64/boot/Image
+
+environment:
+ ARCH: '%{kernel_arch}'
config:
configure-commands:
- |
- KERNEL=kernel8
- make ARCH=arm64 bcm2711_defconfig
+ # Generate the default kernel config for the target architecture
+ make defconfig
- |
+ # Modify the kernel config for additional features
+
# Kernel Config Options
scripts/config -e DEVTMPFS
scripts/config -e CGROUPS
@@ -179,28 +187,64 @@ config:
scripts/config -e NETDEVICES
scripts/config -e WLAN
+ # Rpi4 support
+ scripts/config -e PCIE_BRCMSTB
+ scripts/config -e RASPBERRYPI_FIRMWARE
+ scripts/config -m SND_BCM2708_SOC_RPI_CIRRUS
+ scripts/config -m SND_BCM2708_SOC_RPI_DAC
+ scripts/config -m SND_BCM2708_SOC_RPI_PROTO
+ scripts/config -m SND_BCM2708_SOC_FE_PI_AUDIO
+ scripts/config -m SND_PISOUND
+ scripts/config -m SND_BCM2835
+ scripts/config -m VIDEO_BCM2835
+ scripts/config -m VIDEO_CODEC_BCM2835
+ scripts/config -e CLK_RASPBERRYPI
+ scripts/config -e BCM2835_POWER
+ scripts/config -m RPI_AXIPERF
+ scripts/config -m PWM_PCA9685
+ scripts/config -m MFD_ARIZONA_I2C
+ scripts/config -m MFD_ARIZONA_SPI
+ scripts/config -e MFD_WM5102
+ scripts/config -m BCMGENET
+ scripts/config -m BROADCOM_PHY
+ scripts/config -m BRCMFMAC_USB
+
# Enable vc4 drm
- scripts/config -e I2C_BCM2835
- scripts/config -e DRM
- scripts/config -e DRM_FBDEV_EMULATION
- scripts/config -e DRM_VC4
+ scripts/config -e I2C_BCM2835
+ scripts/config -e DRM
+ scripts/config -e DRM_FBDEV_EMULATION
+ scripts/config -e DRM_VC4
+
+ # This was broken by this branch
+ scripts/config -d PCI_AARDVARK
+ scripts/config -d PCIE_ALTERA
+ scripts/config -d PCIE_ROCKCHIP_HOST
+
+ build-commands:
+ - |
+ make
install-commands:
- |
- make INSTALL_MOD_PATH="%{install-root}/usr/" modules_install
- mkdir -p %{install-root}/boot/
- mkdir -p %{install-root}/boot/overlays
+ install -Dm644 "%{image-name}" '%{install-root}%{bootdir}/vmlinuz'
+ install -Dm644 System.map '%{install-root}%{bootdir}/System.map'
+ make INSTALL_MOD_PATH='%{install-root}%{prefix}' modules_install
- cp arch/arm64/boot/Image %{install-root}/boot/kernel8.img
- cp arch/arm64/boot/dts/broadcom/*.dtb* %{install-root}/boot/
- cp arch/arm64/boot/dts/overlays/*.dtb* %{install-root}/boot/overlays/
- cp arch/arm64/boot/dts/overlays/README %{install-root}/boot/overlays/
+ rm %{install-root}%{indep-libdir}/modules/*/{source,build}
+
+ - |
+ make INSTALL_DTBS_PATH='%{install-root}%{bootdir}/dtbs' dtbs_install
public:
bst:
- split-rules:
- boot:
- - '/boot/*'
- mods:
- - '/lib/*'
+ integration-commands:
+ - |
+ cd '%{indep-libdir}/modules'
+ for version in *; do
+ depmod -b '%{prefix}' -a "$version";
+ done
+ split-rules:
+ devel:
+ (>):
+ - '%{bootdir}/System.map'
diff --git a/elements/boards/raspberrypi-4/bsp/rpi-efi-boot-script.bst
b/elements/boards/raspberrypi-4/bsp/rpi-efi-boot-script.bst
new file mode 100644
index 00000000..9986840d
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/rpi-efi-boot-script.bst
@@ -0,0 +1,18 @@
+kind: manual
+
+sources:
+- kind: local
+ path: files/boards/raspberrypi-4/boot.script
+
+variables:
+ board: rpi_4
+
+build-depends:
+- boards/raspberrypi-4/bsp/u-boot.bst
+
+config:
+ build-commands:
+ - mkimage -A arm64 -O efi -T script -n "Boot EFI with DT overlays" -d boot.script boot.scr
+
+ install-commands:
+ - install -Dm644 -t "%{install-root}%{indep-libdir}/u-boot/%{board}" boot.scr
diff --git a/elements/boards/raspberrypi-4/bsp/u-boot.bst b/elements/boards/raspberrypi-4/bsp/u-boot.bst
new file mode 100644
index 00000000..d6b50fb9
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/u-boot.bst
@@ -0,0 +1,28 @@
+kind: manual
+
+sources:
+- kind: tar
+ url: ftp://ftp.denx.de/pub/u-boot/u-boot-2020.07-rc2.tar.bz2
+
+depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+
+build-depends:
+- freedesktop-sdk.bst:components/bison.bst
+- freedesktop-sdk.bst:components/flex.bst
+- freedesktop-sdk.bst:components/gzip.bst
+- freedesktop-sdk.bst:components/bc.bst
+
+variables:
+ board: rpi_4
+
+config:
+ configure-commands:
+ - make "%{board}_defconfig"
+
+ build-commands:
+ - make V=1 all
+
+ install-commands:
+ - install -Dm644 -t "%{install-root}%{indep-libdir}/u-boot/%{board}" u-boot.bin
+ - install -Dm755 -t "%{install-root}%{bindir}" tools/mkimage
diff --git a/elements/boards/raspberrypi-4/deps.bst b/elements/boards/raspberrypi-4/deps.bst
index 9181e830..a4440b3b 100644
--- a/elements/boards/raspberrypi-4/deps.bst
+++ b/elements/boards/raspberrypi-4/deps.bst
@@ -9,12 +9,29 @@ runtime-depends:
- freedesktop-sdk.bst:components/avahi.bst
- freedesktop-sdk.bst:vm/mesa-default.bst
+- core-deps/flatpak.bst
+- vm/ostree-config.bst
+- core-deps/eos-updater.bst
+- vm/dev-repo-script.bst
- vm/plymouth-gnome-theme.bst
- freedesktop-sdk.bst:vm/config/pulseaudio.bst
- freedesktop-sdk.bst:vm/config/sudo.bst
- freedesktop-sdk.bst:vm/config/journald.bst
+- vm/flathub-config.bst
- sdk-platform.bst
- core.bst
- core/systemd-presets.bst
+
+- boards/raspberrypi-4/initramfs.bst
+- vm/resize-root.bst
+- vm/eos-repartition.bst
+
+- freedesktop-sdk.bst:components/linux-firmware.bst
+- freedesktop-sdk.bst:components/wireless-regdb-bin.bst
+
+- vm/wpa-supplicant-config.bst
+
+- boards/raspberrypi-4/bsp/firmware.bst
+- boards/raspberrypi-4/bsp/userland-firmware.bst
diff --git a/elements/boards/raspberrypi-4/filesystem.bst b/elements/boards/raspberrypi-4/filesystem.bst
index 3b723b33..dc7971aa 100644
--- a/elements/boards/raspberrypi-4/filesystem.bst
+++ b/elements/boards/raspberrypi-4/filesystem.bst
@@ -1,7 +1,6 @@
kind: compose
build-depends:
-- boards/raspberrypi-4/bsp.bst
- boards/raspberrypi-4/deps.bst
# Currently we just take everything and remove the
diff --git a/elements/boards/raspberrypi-4/image-deps.bst b/elements/boards/raspberrypi-4/image-deps.bst
new file mode 100644
index 00000000..ad6c65c0
--- /dev/null
+++ b/elements/boards/raspberrypi-4/image-deps.bst
@@ -0,0 +1,9 @@
+kind: stack
+
+runtime-depends:
+- freedesktop-sdk.bst:integration/mtab.bst
+- freedesktop-sdk.bst:components/genimage.bst
+- vm/qemu-tools.bst
+- core-deps/libostree.bst
+- boards/raspberrypi-4/bsp/u-boot.bst
+- boards/raspberrypi-4/bsp/rpi-efi-boot-script.bst
diff --git a/elements/boards/raspberrypi-4/image.bst b/elements/boards/raspberrypi-4/image.bst
index 280c8fde..df79a4b4 100644
--- a/elements/boards/raspberrypi-4/image.bst
+++ b/elements/boards/raspberrypi-4/image.bst
@@ -1,88 +1,143 @@
kind: script
build-depends:
-- boards/raspberrypi-4/filesystem.bst
-- freedesktop-sdk.bst:integration/mtab.bst
-- freedesktop-sdk.bst:components/genimage.bst
-- boards/raspberrypi-4/initial-scripts.bst
-- freedesktop-sdk.bst:vm/prepare-image.bst
+- boards/raspberrypi-4/image-deps.bst
+- boards/raspberrypi-4/bsp/firmware.bst
+- boards/raspberrypi-4/repo.bst
+- boards/raspberrypi-4/bsp/linux.bst
+
+variables:
+ linux-root: B921B045-1DF0-41C3-AF44-4C6F280D3FAE
+ ostree-branch: gnome-os/aarch64/raspberrypi-4
+ board: rpi_4
+
+ sysroot: "/sysroot"
+
+environment:
+ OSTREE_REPO: "%{sysroot}/ostree/repo"
config:
layout:
+ - element: ''
+ destination: '/sysroot'
- element: ''
destination: '/genimage'
- - element: integration/mtab.bst
+ - element: boards/raspberrypi-4/repo.bst
+ destination: '/source-repo'
+ - element: boards/raspberrypi-4/image-deps.bst
destination: '/'
- - element: components/genimage.bst
- destination: '/'
- - element: ''
- destination: /tmp
- - element: boards/raspberrypi-4/filesystem.bst
- destination: /sysroot
- - element: boards/raspberrypi-4/initial-scripts.bst
- destination: /
- - element: vm/prepare-image.bst
- destination: /
+ - element: boards/raspberrypi-4/bsp/linux.bst
+ destination: '/kernel'
+ - element: boards/raspberrypi-4/bsp/firmware.bst
+ destination: '/firmware'
commands:
+ - mkdir -p "${OSTREE_REPO}"
+ - ostree init --repo="${OSTREE_REPO}" --mode=bare
+
+ - ostree config --group sysroot set bootloader auto
+ - ostree pull-local "/source-repo" %{ostree-branch}
+
+ - mkdir -p "%{sysroot}/boot"
+
+ - ostree admin init-fs "%{sysroot}"
+ - ostree admin os-init --sysroot="%{sysroot}" gnome-os
+
+ # U-Boot does not provide EFI variables at runtime. So /dev/gpt-auto-root
+ # is not available.
+ - |
+ ostree admin deploy --os="gnome-os" \
+ --sysroot="%{sysroot}" %{ostree-branch} \
+ --karg="rw" --karg="quiet" --karg="splash" \
+ --karg="root=LABEL=root" \
+ --karg="dwc_otg.lpm_enable=0" \
+ --karg-append="console=ttyS0,115200" \
+ --karg-append="console=tty1" \
+ --karg="plymouth.ignore-serial-consoles"
+
+ - |
+ mkdir -p "%{sysroot}/etc/ostree"
+ cp -r "%{sysroot}"/ostree/boot.1/gnome-os/*/*/etc/ostree/remotes.d "%{sysroot}/etc/ostree/remotes.d"
+
+ - |
+ ostree admin set-origin --sysroot="%{sysroot}" \
+ --index=0 \
+ GnomeOS dummy \
+ %{ostree-branch}
+
+ - |
+ cp -r "%{sysroot}"/ostree/boot.1/gnome-os/*/*/boot/EFI/ "%{sysroot}/boot/"
+
+ - |
+ cp -r "/kernel/boot/dtbs" "%{sysroot}/boot/dtb"
+
- |
- # Create needed api
- cd /sysroot
- mkdir -p {srv,sys,tmp}
+ cp /firmware/boot/* "%{sysroot}/boot/"
- |
- prepare-image.sh \
- --sysroot /sysroot \
- --rootsource /dev/mmcblk0p2 \
- --rootpasswd "root" \
- --noboot \
- --rootfsopts "defaults,noatime"
+ cp "%{indep-libdir}/u-boot/%{board}/u-boot.bin" "%{sysroot}/boot/kernel8.img"
+ cp "%{indep-libdir}/u-boot/%{board}/boot.scr" "%{sysroot}/boot/"
+ # The dtb seems to be required by the firmware to be able to load u-boot
- |
- cat >>"/sysroot/etc/fstab" <<EOF
- /dev/mmcblk0p1 /boot vfat defaults 0 2
- EOF
+ cp -r "/kernel/boot/dtbs/broadcom/bcm2711-rpi-4-b.dtb" "%{sysroot}/boot/"
+ # FIXME: We should try to load the overlay from u-boot instead.
- |
- # Add empty machine-id, to allow systemd to read-only
- # boot whilst creating & committing a unique id on first boot,
- # avoiding waiting on systemd-timesyncd or caching a generated id.
- touch "/sysroot/etc/machine-id"
+ mkdir -p "%{sysroot}/boot/overlays"
+ cp -r "/kernel/boot/dtbs/overlays/vc4-fkms-v3d.dtbo" "%{sysroot}/boot/overlays/"
- |
+ cat >"%{sysroot}/boot/config.txt" <<EOF
+ enable_uart=1
+ start_x=1
+ # FIXME: We should maybe try to load fdt and overlays from u-boot
+ device_tree_address=0x02600000
+ dtoverlay=vc4-fkms-v3d
+ dtparam=audio=on
+ EOF
+
+ - |
+ size=$(($(du -s -B 4K "%{sysroot}" | cut -f1)*4+200*1024))
cat >/genimage/genimage.cfg <<EOF
- image boot.vfat {
- vfat {
+ image efi.img {
+ vfat {
+ extraargs = "-F32 -n EFI"
}
mountpoint = "/boot"
- size = 64M
+ size = 500M
}
- image rootfs.ext4 {
+ image root.img {
ext4 {
label = "root"
use-mke2fs = true
}
- size = 4G
+ size = ${size}K
}
- image sdcard.img {
+ image disk.img {
hdimage {
+ gpt = true
+ align = 1M
}
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
-
+ partition efi {
+ image = "efi.img"
+ partition-type = 0x0c
+ bootable = true
+ partition-type-uuid = "U"
}
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
+ partition root {
+ image = "root.img"
+ partition-type-uuid = "%{linux-root}"
}
}
EOF
- |
cd /genimage
- genimage --rootpath /sysroot
+ genimage --rootpath "%{sysroot}"
+
+ - |
+ sfdisk --part-attrs /genimage/images/disk.img 2 55
- |
- install -Dm644 -t "%{install-root}" genimage/images/sdcard.img
+ qemu-img convert -O qcow2 -f raw /genimage/images/disk.img "%{install-root}/disk.qcow2"
diff --git a/elements/boards/raspberrypi-4/initramfs.bst b/elements/boards/raspberrypi-4/initramfs.bst
new file mode 100644
index 00000000..f30630d2
--- /dev/null
+++ b/elements/boards/raspberrypi-4/initramfs.bst
@@ -0,0 +1,68 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:vm/prepare-image.bst
+- boards/raspberrypi-4/initramfs/deps.bst
+- boards/raspberrypi-4/initramfs/initial-scripts.bst
+
+variables:
+ uuidnamespace: aea54278-2587-4075-ae67-8688ace4ce3d
+
+config:
+ layout:
+ - element: ''
+ destination: '/tmp'
+ - element: ''
+ destination: '/var/tmp'
+ - element: ''
+ destination: '/efi'
+ - element: boards/raspberrypi-4/initramfs/deps.bst
+ destination: '/'
+ - element: boards/raspberrypi-4/initramfs/initial-scripts.bst
+ destination: '/'
+ - element: vm/prepare-image.bst
+ destination: '/'
+
+ commands:
+ - |
+ prepare-image.sh \
+ --seed "%{uuidnamespace}" \
+ --rootsource LABEL=root \
+ --efisource LABEL=EFI \
+ --efipath /boot >/dev/null
+
+ - |
+ mkdir -p "%{install-root}/usr/lib/"
+ cp -r /usr/lib/modules "%{install-root}/usr/lib/"
+
+ - |
+ version="$(ls -1 /lib/modules | head -n1)"
+ mkdir -p "%{install-root}/usr/lib/modules/${version}"
+ dracut -v --fstab \
+ --no-machineid \
+ --kver "${version}" \
+ --add ostree \
+ --add plymouth \
+ --add eos-repartition \
+ --add-drivers "rockchipdrm panfrost panel_simple analogix_dp pwm_bl drm_kms_helper" \
+ --install 'fsck.ext4' \
+ "%{install-root}/usr/lib/modules/${version}/initramfs"
+
+ - |
+ version="$(ls -1 /lib/modules | head -n1)"
+ cp /boot/vmlinuz "%{install-root}/usr/lib/modules/${version}/vmlinuz"
+
+ - dbus-uuidgen >/etc/machine-id
+ - SYSTEMD_RELAX_ESP_CHECKS=1 bootctl --path='/efi' --no-variables install
+ - rm /etc/machine-id
+
+ - |
+ cp -r /efi "%{install-root}/boot"
+
+ - |
+ cat <<EOF >"%{install-root}/boot/loader/loader.conf"
+ timeout 3
+ editor yes
+ console-mode keep
+ default *
+ EOF
diff --git a/elements/boards/raspberrypi-4/initramfs/deps.bst
b/elements/boards/raspberrypi-4/initramfs/deps.bst
new file mode 100644
index 00000000..fab83d34
--- /dev/null
+++ b/elements/boards/raspberrypi-4/initramfs/deps.bst
@@ -0,0 +1,21 @@
+kind: stack
+
+runtime-depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+- freedesktop-sdk.bst:components/util-linux.bst
+- freedesktop-sdk.bst:components/systemd.bst
+- freedesktop-sdk.bst:components/dbus.bst
+- freedesktop-sdk.bst:components/dracut.bst
+- freedesktop-sdk.bst:components/os-release.bst
+- freedesktop-sdk.bst:components/shadow.bst
+- freedesktop-sdk.bst:components/tzdata.bst
+- freedesktop-sdk.bst:components/pkg-config.bst
+- vm/plymouth-gnome-theme.bst
+
+- boards/raspberrypi-4/bsp/linux.bst
+- freedesktop-sdk.bst:components/linux-firmware.bst
+- freedesktop-sdk.bst:components/wireless-regdb-bin.bst
+
+- core-deps/libostree.bst
+- vm/eos-repartition.bst
+- boards/raspberrypi-4/repair-mbr.bst
diff --git a/elements/boards/raspberrypi-4/initramfs/initial-scripts.bst
b/elements/boards/raspberrypi-4/initramfs/initial-scripts.bst
new file mode 100644
index 00000000..766b83af
--- /dev/null
+++ b/elements/boards/raspberrypi-4/initramfs/initial-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- boards/raspberrypi-4/initramfs/deps.bst
+
+config:
+ path: /etc/fdsdk/initial_scripts
diff --git a/elements/boards/raspberrypi-4/repair-mbr.bst b/elements/boards/raspberrypi-4/repair-mbr.bst
new file mode 100644
index 00000000..210be094
--- /dev/null
+++ b/elements/boards/raspberrypi-4/repair-mbr.bst
@@ -0,0 +1,20 @@
+kind: manual
+
+sources:
+- kind: local
+ path: files/boards/raspberrypi-4/repair-mbr/module-setup.sh
+- kind: local
+ path: files/boards/raspberrypi-4/repair-mbr/repair-mbr.service
+- kind: local
+ path: files/boards/raspberrypi-4/repair-mbr/repair-mbr.sh
+
+depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+
+variables:
+ dir: "%{indep-libdir}/dracut/modules.d/50repair-mbr"
+
+config:
+ install-commands:
+ - install -Dm755 -t "%{install-root}%{dir}" module-setup.sh repair-mbr.sh
+ - install -Dm644 -t "%{install-root}%{dir}" repair-mbr.service
diff --git a/elements/boards/raspberrypi-4/repo.bst b/elements/boards/raspberrypi-4/repo.bst
new file mode 100644
index 00000000..d5812ffd
--- /dev/null
+++ b/elements/boards/raspberrypi-4/repo.bst
@@ -0,0 +1,42 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:vm/prepare-image.bst
+- core-deps/libostree.bst
+- boards/raspberrypi-4/initial-scripts.bst
+- boards/raspberrypi-4/filesystem.bst
+
+variables:
+ uuidnamespace: aea54278-2587-4075-ae67-8688ace4ce3d
+ ostree-branch: gnome-os/aarch64/raspberrypi-4
+
+environment:
+ OSTREE_REPO: "%{install-root}"
+
+config:
+ layout:
+ - element: ''
+ destination: /tmp
+ - element: core-deps/libostree.bst
+ destination: /
+ - element: boards/raspberrypi-4/filesystem.bst
+ destination: /sysroot
+ - element: boards/raspberrypi-4/initial-scripts.bst
+ destination: /
+ - element: vm/prepare-image.bst
+ destination: /
+
+ commands:
+ - |
+ prepare-image.sh \
+ --sysroot /sysroot \
+ --seed "%{uuidnamespace}" \
+ --rootsource LABEL=root \
+ --efisource LABEL=EFI \
+ --efipath /boot >/dev/null
+
+ - mkdir -p "${OSTREE_REPO}"
+ - ostree init --repo="${OSTREE_REPO}" --mode=archive
+ - mv /sysroot/etc /sysroot/usr/etc
+ - ostree commit --branch=%{ostree-branch} --timestamp="$(date --date="@${SOURCE_DATE_EPOCH}"
--rfc-3339=seconds)" /sysroot
+
diff --git a/fdsdk-firmware.patch b/fdsdk-firmware.patch
new file mode 100644
index 00000000..92fea9a9
--- /dev/null
+++ b/fdsdk-firmware.patch
@@ -0,0 +1,13 @@
+diff --git a/elements/components/linux-firmware.bst b/elements/components/linux-firmware.bst
+index 0e872f61..d83b3d18 100644
+--- a/elements/components/linux-firmware.bst
++++ b/elements/components/linux-firmware.bst
+@@ -6,7 +6,7 @@ depends:
+ config:
+ install-commands:
+ - |
+- make DESTDIR="%{install-root}" FIRMWAREDIR="%{install-root}%{prefix}/firmware" install
++ make DESTDIR="%{install-root}" FIRMWAREDIR="%{indep-libdir}/firmware" install
+
+ sources:
+ - kind: git_tag
diff --git a/files/boards/raspberrypi-4/boot.script b/files/boards/raspberrypi-4/boot.script
new file mode 100644
index 00000000..e0fa46de
--- /dev/null
+++ b/files/boards/raspberrypi-4/boot.script
@@ -0,0 +1,15 @@
+# FIXME: This should load the device tree. But something does not work correctly.
+
+#load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /dtb/${fdtfile};
+#fdt addr ${fdt_addr_r};
+#fdt resize 8192;
+#load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /dtb/overlays/vc4-kms-v3d-pi4.dtbo;
+#fdt apply ${ramdisk_addr_r};
+#load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /dtb/overlays/miniuart-bt.dtbo;
+#fdt apply ${ramdisk_addr_r};
+#fdt set /audio status on;
+
+fdt addr ${fdt_addr_r};
+bootefi bootmgr ${fdt_addr_r};
+load mmc ${devnum}:${distro_bootpart} ${kernel_addr_r} /efi/boot/bootaa64.efi;
+bootefi ${kernel_addr_r} ${fdt_addr_r};
diff --git a/files/boards/raspberrypi-4/repair-mbr/module-setup.sh
b/files/boards/raspberrypi-4/repair-mbr/module-setup.sh
new file mode 100755
index 00000000..a0b1d7fb
--- /dev/null
+++ b/files/boards/raspberrypi-4/repair-mbr/module-setup.sh
@@ -0,0 +1,22 @@
+check() {
+ return 0
+}
+
+depends() {
+ echo systemd
+ echo eos-repartition
+}
+
+install() {
+ dracut_install sfdisk
+ dracut_install sed
+ dracut_install grep
+ dracut_install udevadm
+
+ inst_script "$moddir/repair-mbr.sh" /bin/repair-mbr
+ inst_simple "$moddir/repair-mbr.service" \
+ "$systemdsystemunitdir/repair-mbr.service"
+ mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
+ ln_r "$systemdsystemunitdir/repair-mbr.service" \
+ "$systemdsystemunitdir/initrd.target.wants/repair-mbr.service"
+}
diff --git a/files/boards/raspberrypi-4/repair-mbr/repair-mbr.service
b/files/boards/raspberrypi-4/repair-mbr/repair-mbr.service
new file mode 100644
index 00000000..6b078acd
--- /dev/null
+++ b/files/boards/raspberrypi-4/repair-mbr/repair-mbr.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Fix hybrid partitions
+ConditionPathExists=/etc/initrd-release
+
+DefaultDependencies=no
+Before=initrd-root-fs.target sysroot.mount systemd-fsck-root.service
+After=initrd-root-device.target dracut-pre-mount.service endless-repartition.service
+
+[Service]
+Type=oneshot
+ExecStart=-/bin/repair-mbr
+RemainAfterExit=yes
diff --git a/files/boards/raspberrypi-4/repair-mbr/repair-mbr.sh
b/files/boards/raspberrypi-4/repair-mbr/repair-mbr.sh
new file mode 100644
index 00000000..d0849dba
--- /dev/null
+++ b/files/boards/raspberrypi-4/repair-mbr/repair-mbr.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+set -eu
+
+root_part="$(systemctl show -p What sysroot.mount | sed "s/^What=//")"
+if [ -z "${root_part}" ]; then
+ echo "Cannot find sysroot partition" 1&>2
+ exit 1
+fi
+root_part="$(readlink -f "${root_part}")"
+if [ -z "${root_part}" ]; then
+ echo "Cannot find sysroot partition block file" 1&>2
+ exit 1
+fi
+
+root_disk=$(echo "${root_part}" | sed -E "/([0-9])p[0-9]+$/{;s//\1/;q};s/[0-9]+$//")
+if [ "${root_disk}" = "${root_part}" ]; then
+ echo "Cannot find root disk block file" 1&>2
+ exit 1
+fi
+
+if sfdisk --label-nested mbr "${root_disk}" | grep 'type=c' >/dev/null; then
+ echo "Bootable MBR partition found"
+ exit 0
+fi
+
+parts="$(sfdisk -d "${root_disk}")"
+boot="$(echo "${parts}" | grep LegacyBIOSBootable)"
+prefix=$(echo "${boot}" | sed 's/[0-9]* : .*//')
+start=$(echo "${boot}" | sed 's/.*start= *\([0-9]*\).*/\1/')
+size=$(echo "${boot}" | sed 's/.*size= *\([0-9]*\).*/\1/')
+
+sfdisk --label-nested mbr "${root_disk}" <<EOF
+${prefix}1 : start=${start}, size=${size}, type=c, bootable
+${prefix}2 : start=1, size=33, type=ee
+EOF
+
+udevadm settle
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]