Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged

S32g3 #644

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Comment thread
coderabbitai[bot] marked this conversation as resolved.
# 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
Comment thread
mangelajo marked this conversation as resolved.

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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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";
Expand All @@ -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";
Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ..."
Comment thread
coderabbitai[bot] marked this conversation as resolved.
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 <<EOF
#!/bin/sh

if [ "\$1" = "start" ]; then
if dmesg | head | grep -i S32G-VNP-RDB3; then
modprobe micrel
fi
fi
EOF
chmod +x $script

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ spec:
prompt: "#"
default_target: "usd"
targets:
usd: "/sys/devices/platform/soc\@0/402f0000.mmc"
# usd: "/sys/class/block/mmcblk0"
usd: "/dev/mmcblk0"
# removed for now, even if it's our documented procedure, if
# the board is configured to boot from sd or emmc (and not SPI), and
# the flashing of the final image fails, it will result in an un-bootable
Expand All @@ -32,7 +31,7 @@ spec:
# file: my.dtb
# address: "0x88000000"
kernel:
file: data/flasher-buildroot.itb
file: data/flasher-fedora.itb
address: "0x90000000"

dtb:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ spec:
link: "https://www.ti.com/tool/PROCESSOR-SDK-J784S4"
# boot using the default configuration built-in flasher.itb, j784s4
# you can boot included alternative configurations, e.g. for SK-AM69 use "bootm 0x90000000#am69"
# NOTE that for bootm to work with larger kernels (like the fedora kernel in flasher-fedora.itb require larger CONFIG_BOOTM_LEN
# Using workaround to extract images manually and boot using booti instead
# FIXME beware - this relies on kernel being the first image and header being 0xd4 bytes large.
bootcmd: "bootm 0x90000000"
shelltype: "busybox"
login:
Expand All @@ -33,16 +36,16 @@ spec:
# file: my.dtb
# address: "0x88000000"
kernel:
file: data/flasher-buildroot.itb
file: data/flasher-fedora.itb
address: "0x90000000"

dtb:
default: j784s4
address: "0x88000000"
variants:
j784s4:
bootcmd: "bootm 0x90000000#j784s4"
bootcmd: "unlz4 0x900000d4 0x80000000 0x8000000; imxtract 0x90000000 fdt-j784s4 0x88000000; imxtract 0x90000000 initrd 0x89000000; booti 0x80000000 0x89000000:0x7000000 0x88000000"
am69:
bootcmd: "bootm 0x90000000#am69"
bootcmd: "unlz4 0x900000d4 0x80000000 0x8000000; imxtract 0x90000000 fdt-am69 0x88000000; imxtract 0x90000000 initrd 0x89000000; booti 0x80000000 0x89000000:0x7000000 0x88000000"
custom:
bootcmd: "bootm 0x90000000:kernel 0x90000000:initrd 0x88000000"
bootcmd: "unlz4 0x900000d4 0x80000000 0x8000000; imxtract 0x90000000 initrd 0x89000000; booti 0x80000000 0x89000000:0x7000000 0x88000000"
Loading