diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/automotive.its b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/automotive.its index 72ace68d4..5d8edf6d5 100644 --- a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/automotive.its +++ b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/automotive.its @@ -44,7 +44,7 @@ }; initrd { description = "Initrd"; - data = /incbin/("/var/tmp/buildroot/output/images/rootfs.cpio.lzo"); + data = /incbin/("/var/tmp/buildroot/output/images/rootfs.cpio.lz4"); type = "ramdisk"; arch = "arm64"; os = "linux"; diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/build_fits.sh b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/build_fits.sh index 189f26b59..961ba45a2 100755 --- a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/build_fits.sh +++ b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/build_fits.sh @@ -11,21 +11,26 @@ else dnf install --setopt=install_weak_deps=false -y git make gcc gcc-c++ which file diffutils \ wget cpio rsync bc lzop zip patch perl tar qemu-system-aarch64 qemu-img unzboot \ - uboot-tools kmod awk zstd + uboot-tools kmod awk zstd lz4 kernel dtc rpm-build + + # FIXME remove in Fedora 43 + # until unzboot is updated, use the build directly + rpm -Uvh https://kojipkgs.fedoraproject.org//packages/unzboot/0.1~git.20250502.0c0c3ad/2.fc43/aarch64/unzboot-0.1~git.20250502.0c0c3ad-2.fc43.aarch64.rpm git clone --depth 1 --branch 2025.08 https://github.com/buildroot/buildroot "${BUILDROOT_DIR}" - # build default buildroot kernel & initramfs + # build buildroot (initramfs) cp buildroot_defconfig "${BUILDROOT_DIR}/configs/" cp -R overlay "${BUILDROOT_DIR}" + ./kernel_fedora.sh "${BUILDROOT_DIR}/overlay" ( cd "${BUILDROOT_DIR}"; make buildroot_defconfig && make ) dtc s32g3.dts -o s32g3.dtb - mkimage -f buildroot.its data/flasher-buildroot.itb + mkimage -f fedora.its data/flasher-fedora.itb rm -rf "${BUILDROOT_DIR}/overlay" - # replace kernel with kernel-automotive and rebuild + # replace kernel with kernel-automotive and rebuild. Beware the $BUILDROOT_DIR/output/target is reused! cp -R overlay "${BUILDROOT_DIR}" - ./replace_kernel.sh "${BUILDROOT_DIR}/overlay" + ./kernel_automotive.sh "${BUILDROOT_DIR}/overlay" ( cd "${BUILDROOT_DIR}" && make ) mkimage -f automotive.its data/flasher-automotive.itb rm -rf "${BUILDROOT_DIR}/overlay" diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/buildroot_defconfig b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/buildroot_defconfig index 06d328934..985b09bc3 100644 --- a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/buildroot_defconfig +++ b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/buildroot_defconfig @@ -15,7 +15,7 @@ BR2_PACKAGE_NTP=y BR2_PACKAGE_NTP_SNTP=y BR2_PACKAGE_NTP_NTPDATE=y BR2_TARGET_ROOTFS_CPIO=y -BR2_TARGET_ROOTFS_CPIO_LZO=y +BR2_TARGET_ROOTFS_CPIO_LZ4=y BR2_PACKAGE_DROPBEAR=n # use full-featured dd BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y @@ -27,10 +27,12 @@ BR2_PACKAGE_COREUTILS=y # include initramfs within the kernel Image # on J784S4 the size exceeds uboot's CONFIG_SYS_BOOTM_LEN # BR2_TARGET_ROOTFS_INITRAMFS=y -BR2_LINUX_KERNEL=y -BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y -BR2_LINUX_KERNEL_LZO=y -BR2_LINUX_KERNEL_IMAGE=y -BR2_LINUX_KERNEL_DTS_SUPPORT=y -BR2_LINUX_KERNEL_INTREE_DTS_NAME="ti/k3-j784s4-evm ti/k3-am69-sk" +# +# Not building kernel anymore, keeping for reference in case Fedora kernel is not good enough +BR2_LINUX_KERNEL=n +#BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +#BR2_LINUX_KERNEL_LZO=y +#BR2_LINUX_KERNEL_IMAGE=y +#BR2_LINUX_KERNEL_DTS_SUPPORT=y +#BR2_LINUX_KERNEL_INTREE_DTS_NAME="ti/k3-j784s4-evm ti/k3-am69-sk" diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/buildroot.its b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/fedora.its similarity index 87% rename from packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/buildroot.its rename to packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/fedora.its index 43abd4fe8..0958ad6a8 100644 --- a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/buildroot.its +++ b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/fedora.its @@ -7,11 +7,11 @@ images { kernel { description = "buildroot Kernel"; - data = /incbin/("/var/tmp/buildroot/output/images/Image"); + data = /incbin/("./kernel-fedora/vmlinuz.lz4"); type = "kernel"; arch = "arm64"; os = "linux"; - compression = "none"; + compression = "lz4"; load = <0x80000000>; entry = <0x80000000>; hash { @@ -20,7 +20,7 @@ }; initrd { description = "Initrd"; - data = /incbin/("/var/tmp/buildroot/output/images/rootfs.cpio.lzo"); + data = /incbin/("/var/tmp/buildroot/output/images/rootfs.cpio.lz4"); type = "ramdisk"; arch = "arm64"; os = "linux"; @@ -31,7 +31,7 @@ }; fdt-j784s4 { description = "DTB TI J784S4EVM"; - data = /incbin/("/var/tmp/buildroot/output/images/k3-j784s4-evm.dtb"); + data = /incbin/("./kernel-fedora/dtb/ti/k3-j784s4-evm.dtb"); type = "flat_dt"; arch = "arm64"; compression = "none"; @@ -42,7 +42,7 @@ }; fdt-am69 { description = "DTB TI SK-AM69"; - data = /incbin/("/var/tmp/buildroot/output/images/k3-am69-sk.dtb"); + data = /incbin/("./kernel-fedora/dtb/ti/k3-am69-sk.dtb"); type = "flat_dt"; arch = "arm64"; compression = "none"; diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/replace_kernel.sh b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/kernel_automotive.sh similarity index 97% rename from packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/replace_kernel.sh rename to packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/kernel_automotive.sh index 70f2738b9..3300b0974 100755 --- a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/replace_kernel.sh +++ b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/kernel_automotive.sh @@ -1,6 +1,6 @@ #!/bin/bash -KVER="5.14.0-594.543.el9iv.aarch64" +KVER="5.14.0-617.566.el9iv.aarch64" KMOD=( # R-Car S4 storage fixed diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/kernel_fedora.sh b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/kernel_fedora.sh new file mode 100755 index 000000000..e491e9da1 --- /dev/null +++ b/packages/jumpstarter-driver-flashers/oci_bundles/aarch64-itb/kernel_fedora.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +KMOD=( + # S32G3 storage + sdhci_esdhc_imx + mmc_block + # S32G3 networking + dwmac_s32 + micrel + # TI storage + sdhci_am654 + mmc_block + # TI networking + phy_gmii_sel + syscon_clk + dp83867 + reset_ti_sci + davinci_mdio + am65_cpts + gpio_davinci + k3_udma + rti_wdt + i2c_omap + i2c_mux_pca954x + irq_ti_sci_intr + omap_mailbox + omap_hwspinlock + phy_j721e_wiz + ti_k3_r5_remoteproc + ti_k3_dsp_remoteproc + k3_j72xx_bandgap + pinctrl_tps6594 + tps6594_pfsm + tps6594_i2c + tps6594_regulator + rtc_tps6594 + phy_cadence_torrent + mux_core + mux_gpio + mux_mmio + virtio_rpmsg_bus + rpmsg_ctrl + irq_ti_sci_inta + optee + omap_rng + optee_rng + ti_am65_cpsw_nuss +) + +[ $# -ne 1 ] && { echo "$0 [target_overlay_dir]"; exit 1; } +ODIR=$1 +mkdir -p ./kernel-fedora +pushd ./kernel-fedora + +KVER=$(rpm -q kernel | head -1 | cut -d - -f 2,3) +if [ "$(uname -m)" != "aarch64" ]; then + echo "ERROR: kernel_fedora.sh must run in an aarch64 container" + exit 1 +fi +unzboot /usr/lib/modules/$KVER/vmlinuz vmlinuz +lz4 -f -12 vmlinuz vmlinuz.lz4 +ln -sfn /lib/modules/$KVER/dtb dtb +echo "building required modules list ..." +for mod in ${KMOD[@]}; do + modprobe -S $KVER --show-depends $mod +done | sed "s|^builtin|# builtin|; s|\\.ko\\.xz|.ko|" > modlist + +popd + +echo "installing modules into overlay dir ..." +mkdir -p $ODIR/etc/init.d || exit 1 +sed -nr 's|^insmod ||p' < ./kernel-fedora/modlist | while read mod; do + echo $mod + mkdir -p "$ODIR$(dirname $mod)" + xz -dc "$mod.xz" > "$ODIR$mod" +done + +echo "updating module deps ..." +depmod --errsyms --filesyms /lib/modules/$KVER/System.map --basedir $1 $KVER + +echo "adding modules start-up script to overlay ..." +script=$ODIR/etc/init.d/S01modules +cat >$script <