Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged
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
@@ -0,0 +1,72 @@
#!/bin/bash

KVER="5.14.0-587.536.el9iv.aarch64"
KMOD=(
# R-Car S4 storage
fixed
renesas_sdhi_internal_dmac
mmc_block
# R-Car S4 networking
gpio-rcar
r8a779f0-ether-serdes
marvell10g
rswitch
)
ODIR="overlay"

cd "$(dirname "$(readlink -f "$0")")"
BASE=$PWD

url="https://cbs.centos.org/kojifiles/packages/kernel-automotive"
url="$url/$(echo $KVER | sed -r 's|-|/|; s|\.([^.]*)$|/\1|')"
pkgs=(
kernel-automotive-core-$KVER.rpm
kernel-automotive-modules-$KVER.rpm
kernel-automotive-modules-core-$KVER.rpm
)

mkdir -p kernel
cd kernel

# fetch kernel rpm packages
for pkg in ${pkgs[@]}; do
[[ -f $pkg ]] || wget "$url/$pkg" || exit 1
done

# extract kernel rpm packages
if ! [[ -d lib ]]; then
for pkg in ${pkgs[@]}; do
echo -n "extracting $pkg ... "
rpm2cpio $pkg | cpio -id
done
Comment on lines +38 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Quote array expansions in the extraction loop
Similarly, quote the package names when extracting RPMs.

-for pkg in ${pkgs[@]}; do
+for pkg in "${pkgs[@]}"; do
     echo -n "extracting $pkg ... "
     rpm2cpio "$pkg" | cpio -id
 done
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for pkg in ${pkgs[@]}; do
echo -n "extracting $pkg ... "
rpm2cpio $pkg | cpio -id
done
for pkg in "${pkgs[@]}"; do
echo -n "extracting $pkg ... "
rpm2cpio "$pkg" | cpio -id
done
🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 38-38: Double quote array expansions to avoid re-splitting elements.

(SC2068)

🤖 Prompt for AI Agents
In packages/jumpstarter-driver-flashers/oci_bundles/rcar_s4/add_kernel.sh at
lines 38 to 41, the array expansion ${pkgs[@]} and the variable $pkg should be
quoted to prevent word splitting and globbing issues. Update the for loop to
quote "${pkgs[@]}" and also quote "$pkg" in the rpm2cpio command to ensure
package names with spaces or special characters are handled correctly.

echo "extracting kernel ..."
unzboot lib/modules/$KVER/vmlinuz vmlinuz
ln -sfn lib/modules/$KVER/dtb dtb
echo "updating module deps ..."
depmod --errsyms --filesyms lib/modules/$KVER/System.map --basedir $PWD $KVER
echo "building required modules list ..."
for mod in ${KMOD[@]}; do
modprobe -d $PWD -S $KVER --show-depends $mod
done | sed "s|$PWD||; s|^builtin|# builtin|; s|\\.ko\\.zst|.ko|" > modlist
fi

cd $OLDPWD

mkdir -p $ODIR/lib/modules $ODIR/etc/init.d || exit 1
echo "installing modules into overlay dir ..."
sed -nr 's|^insmod ||p' < kernel/modlist | while read mod; do
mkdir -p "$ODIR$(dirname $mod)"
zstd -d "kernel$mod.zst" -o "$ODIR$mod"
done

echo "adding modules start-up script to overlay ..."
script=$ODIR/etc/init.d/S01modules
cat >$script <<EOF
#!/bin/sh

if [ "\$1" = "start" ]; then
$(cat kernel/modlist)
fi
EOF
chmod +x $script

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

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

git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot

./add_kernel.sh
cp -R overlay /buildroot
cp renesas_s4_defconfig /buildroot/configs/
( cd /buildroot; make renesas_s4_defconfig && make )
mkimage -f flasher.its data/flasher.itb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/dts-v1/;

/ {
description = "R-Car S4 flasher FIT Image";
#address-cells = <1>;

images {
kernel {
description = "Kernel";
data = /incbin/("kernel/vmlinuz");
type = "kernel";
arch = "arm64";
os = "linux";
compression = "none";
load = <0x48080000>;
entry = <0x48080000>;
hash {
algo = "sha256";
};
};
fdt-spider {
description = "DTB 8779f0-spider";
data = /incbin/("kernel/dtb/renesas/r8a779f0-spider.dtb");
type = "flat_dt";
arch = "arm64";
compression = "none";
load = <0x48000000>;
entry = <0x48000000>;
hash {
algo = "sha256";
};
};
fdt-s4sk {
description = "DTB r8a779f4-s4sk";
data = /incbin/("kernel/dtb/renesas/r8a779f4-s4sk.dtb");
type = "flat_dt";
arch = "arm64";
compression = "none";
load = <0x48000000>;
entry = <0x48000000>;
hash {
algo = "sha256";
};
};
initrd {
description = "Initrd";
data = /incbin/("/buildroot/output/images/rootfs.cpio.lzo");
type = "ramdisk";
arch = "arm64";
os = "linux";
hash {
algo = "sha256";
};
};
};

configurations {
default = "spider";
spider {
description = "Boot R-Car S4 Spider";
kernel = "kernel";
fdt = "fdt-spider";
ramdisk = "initrd";
hash {
algo = "sha256";
};
};
s4sk {
description = "Boot R-Car S4 SK";
kernel = "kernel";
fdt = "fdt-s4sk";
ramdisk = "initrd";
hash {
algo = "sha256";
};
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
spec:
manufacturer: Renesas
link: "https://www.renesas.com/en/products/automotive-products/automotive-system-chips-socs/r-car-s4-automotive-system-chip-soc-car-servercommunication-gateway"
# boot default configuration R-Car S4 Spider, for S4SK use "bootm 0x58000000#s4sk"
bootcmd: "bootm 0x58000000"
shelltype: "busybox"
login:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

IF_WAIT_DELAY=30

if [ "${IFACE}" != "lo" ]; then
ip link set ${IFACE} up
printf "Waiting for interface %s carrier" "${IFACE}"
while [ ${IF_WAIT_DELAY} -gt 0 ]; do
if [ "$(cat /sys/class/net/${IFACE}/carrier)" = "1" ]; then
printf "\n"
exit 0
fi
sleep 1
printf "."
: $((IF_WAIT_DELAY -= 1))
done
printf " timeout!\n"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_HOSTNAME="flasher"
BR2_TARGET_GENERIC_ISSUE="flasher"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_TARGET_GENERIC_ROOT_PASSWD=""
BR2_SYSTEM_DHCP="tsn0"
BR2_ROOTFS_OVERLAY="$(CONFIG_DIR)/overlay"
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_OPENSSL=y
BR2_PACKAGE_LIBCURL=y
BR2_PACKAGE_LIBCURL_CURL=y
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_PACKAGE_DROPBEAR=n
# BR2_TARGET_ROOTFS_TAR is not set
Loading