Skip to content

Add parsers for arm mkuboot.sh and syscallnr.sh#125

Open
gastmaier wants to merge 1 commit intoTNG:mainfrom
gastmaier:feat/mkuboot_syscallnr
Open

Add parsers for arm mkuboot.sh and syscallnr.sh#125
gastmaier wants to merge 1 commit intoTNG:mainfrom
gastmaier:feat/mkuboot_syscallnr

Conversation

@gastmaier
Copy link
Copy Markdown

@gastmaier gastmaier commented Apr 27, 2026

Add support to targets that depends on those commands:

bash .../scripts/mkuboot.sh -A arm -O linux ... -d
sh .../arch/arm/tools/syscallnr.sh <input.tbl> <output.h>

Add _parse_mkuboot_command: mkuboot.sh is a thin wrapper around mkimage(1); the input file is the argument to the -d flag.

Add _parse_syscallnr_command: follows the same positional convention as the existing syscalltbl.sh parser, positionals[2] is the input syscall table file.

Register both in SINGLE_COMMAND_PARSERS alongside the other ARM/sh script entries.

Solves:


[ERROR] File ".../site-packages/kernel_sbom/cmd_graph/savedcmd_parser.py", line 630, in log_error_or_warning
Skipped parsing command sh .../linux/arch/arm/tools/syscallnr.sh .../linux/arch/arm/tools/syscall.tbl arch/arm/include/generated/asm/unistd-nr.h because no matching parser was found

Add support to targets that depends on those commands:

  bash .../scripts/mkuboot.sh -A arm -O linux ... -d <input> <output>
  sh .../arch/arm/tools/syscallnr.sh <input.tbl> <output.h>

Add _parse_mkuboot_command: mkuboot.sh is a thin wrapper around
mkimage(1); the input file is the argument to the -d flag.

Add _parse_syscallnr_command: follows the same positional convention
as the existing syscalltbl.sh parser, positionals[2] is the input
syscall table file.

Register both in SINGLE_COMMAND_PARSERS alongside the other ARM/sh
script entries.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
(re.compile(r"sh (.*/)?gen_initramfs\.sh\b"), _parse_gen_initramfs_command),
(re.compile(r"sh (.*/)?checkundef\.sh\b"), _parse_noop),
(re.compile(r"(bash|sh) (.*/)?mkuboot\.sh\b"), _parse_mkuboot_command),
(re.compile(r"sh (.*/)?(arch/)?arm/tools/syscallnr\.sh\b"), _parse_syscallnr_command),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this regex too strict ?
There are 3 equally named scripts:

  • scripts/syscallnr.sh
  • arch/arm/tools/syscallnr.sh
  • arch/mips/kernel/syscalls/syscallnr.sh

Can we use r"sh (.*/)?syscallnr\.sh\b" ?

def _parse_mkuboot_command(command: str) -> list[PathStr]:
command_parts = _tokenize_single_command(command)
# mkuboot.sh passes all args to mkimage; -d specifies the data/input image file
# e.g.: bash .../scripts/mkuboot.sh -A arm -O linux -C none -T kernel -a 0x8000 -e 0x8000 -n 'name' -d arch/arm/boot/zImage arch/arm/boot/uImage
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of this comment please add tests for mkuboot.sh and syscallnr.sh example commands to the test_savedcmd_parser.py file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants