Li Zhou 3db46876c0 Debian: kernel-modules: Add support for kernel-rt
Add ""@KERNEL_TYPE@" in kernel modules' build codes.
When building modules for kernel-std, it is replaced by null, and
when building modules for kernel-rt, it is replaced by '-rt'.
The build results for rt kernel related will be put at:
/localdisk/loadbuild/<USER>/stx/rt
The build results for std kernel related will be put at:
/localdisk/loadbuild/<USER>/stx/std

Test Plan:
  - PASS: build kernel-rt.
  - PASS: build the 7 oot kernel modules for kernel-rt.
  - PASS: build the test image for kernel-rt and oot modules of it;
          boot up on qemu and probe ko for every oot kernel-module.
  - PASS: do above 3 tests (build modules/build iso/boot up on qemu)
          for kernel-std and verify that this change doesn't affect
          std kernel and modules.

Depends-On: https://review.opendev.org/c/starlingx/root/+/835627
Depends-On: https://review.opendev.org/c/starlingx/root/+/834809
Story: 2009221
Task: 44808
Signed-off-by: Li Zhou <li.zhou@windriver.com>
Change-Id: Ia92191eebb9af8d5affe625a9bd631fe916a277e
2022-03-31 05:21:24 -04:00

32 lines
580 B
Bash
Executable File

#!/bin/bash
# parameters:
# (1) modules' path; (2) privkey for signing; (3) pubkey for signing
privkey=$2
pubkey=$3
if [ ! -f /usr/lib/linux@KERNEL_TYPE@-kbuild-*/scripts/sign-file ]; then
echo "Tool sign-file doesn't exist!"
exit 1
fi
found=0
for module in $(find $1 -type f -name \*.ko); do
found=1
echo ${module}
/usr/lib/linux@KERNEL_TYPE@-kbuild-*/scripts/sign-file sha256 \
${privkey} ${pubkey} ${module}
if [ $? -eq 1 ]; then
echo "Fail to sign!"
exit 1
fi
done
if [ ${found} -eq 1 ]; then
echo "Signed successfully!"
else
echo "No ko found!"
exit 1
fi