device-amlogic-tvbox: rework boot packaging

* add a new `aml_boot_prep` function to setup FIT images and uEnv.ini
   (for legacy U-Boot support)
 * add support for generating a FIT image

Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6121
This commit is contained in:
Ferass El Hafidi
2025-05-12 19:17:27 +02:00
committed by Pablo Correa Gómez
parent 370c78448a
commit 4ec35e37d5
3 changed files with 70 additions and 2 deletions
+21 -2
View File
@@ -2,19 +2,21 @@
# Maintainer: Ferass El Hafidi <funderscore@postmarketos.org>
pkgname=device-amlogic-tvbox
pkgdesc="Amlogic TV box"
pkgver=6
pkgver=7
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
dtc
postmarketos-base
soc-amlogic-s905
u-boot-tools
"
makedepends="devicepkg-dev"
source="
boot-image.its
deviceinfo
modules-initfs
"
@@ -34,21 +36,36 @@ package() {
devicepkg_package $startdir $pkgname
}
aml_boot_prep() {
# uEnv.ini: Used to set kernel cmdline, and DTB if booting a legacy uImage
mkdir -p "$2"/boot/
echo "bootargs=console=tty0 console=ttyAML0,115200n8" > "$2"/boot/uEnv.ini
echo "pmos_env_dtb=$1" >> "$2"/boot/uEnv.ini
# FIT image used to boot Amlogic devices if their vendor U-Boot build supports it
mkdir -p "$2"/usr/share/u-boot/amlogic-tvbox
sed "s@\\[\\[\\[DEVICETREE\\]\\]\\]@/boot/dtbs/amlogic/$1@" "$srcdir/boot-image.its" > "$2"/usr/share/u-boot/amlogic-tvbox/boot-image.its
chmod 644 "$2"/usr/share/u-boot/amlogic-tvbox/boot-image.its # Perms fixup
}
kernel_p201() {
pkgdesc="Kernel for Amlogic P201-based TV box (S905)"
depends="linux-postmarketos-amlogic u-boot-amlogic-s905-tv"
aml_boot_prep "meson-gxbb-p201.dtb" "$subpkgdir"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
kernel_p212() {
pkgdesc="Kernel for Amlogic P212-based TV box (S905X)"
depends="linux-postmarketos-amlogic u-boot-amlogic-s905x-tv"
aml_boot_prep "meson-gxl-s905x-p212.dtb" "$subpkgdir"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
kernel_p241() {
pkgdesc="Kernel for Amlogic P241-based TV box (S805X/S805Y)"
depends="linux-postmarketos-amlogic u-boot-amlogic-s905x-tv"
aml_boot_prep "meson-gxl-s805x-p241.dtb" "$subpkgdir"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
@@ -62,10 +79,12 @@ kernel_videostrong_kii_pro() {
pkgdesc="Kernel for Videostrong KII Pro (S905)"
depends="linux-postmarketos-amlogic u-boot-amlogic-s905-tv"
_pmb_recommends="firmware-videostrong-kii-pro"
aml_boot_prep "meson-gxbb-kii-pro.dtb" "$subpkgdir"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
sha512sums="
1ae8e02447cf9b84ee1fa23d81ff64911390a12ff298220f0ee400f7eef5dc4a35200cb174ceb04e8a63b35eb2afebf9ada1dbed084fa10dd9fb7d7886a3356e deviceinfo
17e803e341c362f54df2116125549ededc41deb89cd6f57974133e18053b30af35fc2b60cdb732b10efadf95234f154bdd7b32410c139f0166adfe9b4ffe02dd boot-image.its
ef92eb6a536f2f21866515412fc560c6ea62aee5fc8ace8de04e6e6c0a9bbdcd4dcefdd4ed05d489bf50cdd4f3ef9690c0670878f7008590b737035874139897 deviceinfo
52948c2884a6f6384e12b7a598f70878526d0d3293c214425170145231144ec7de805c038641741a4a5d75b50e554f6a3fa3769784a674217ed032f9b6a233c8 modules-initfs
"
@@ -0,0 +1,45 @@
/dts-v1/;
/ {
description = "Amlogic Generic TV Box FIT Image";
#address-cells = <1>;
images {
kernel {
description = "Kernel";
data = /incbin/("vmlinuz");
type = "kernel";
arch = "arm64";
os = "linux";
compression = "none";
load = <0x1080000>;
entry = <0x1080000>;
};
fdt {
description = "DTB";
data = /incbin/("[[[DEVICETREE]]]");
type = "flat_dt";
compression = "none";
arch = "arm64";
};
initrd {
description = "Initramfs image";
data = /incbin/("initramfs");
type = "ramdisk";
arch = "arm64";
os = "linux";
};
};
configurations {
default = "standard";
standard {
description = "Standard Boot";
kernel = "kernel";
fdt = "fdt";
ramdisk = "initrd";
};
};
};
@@ -31,6 +31,10 @@ deviceinfo_kernel_cmdline="console=ttyAML0,115200n8"
# can just use extlinux.
deviceinfo_generate_extlinux_config="true"
# For other devices where a FIT image is supported, generate one
deviceinfo_generate_uboot_fit_images="true"
deviceinfo_uboot_boardname="amlogic-tvbox"
# For the rest, generate a uImage.
deviceinfo_generate_legacy_uboot_initfs="true"
deviceinfo_legacy_uboot_load_address="0x1080000"