xref: /openbmc/qemu/scripts/update-syscalltbl.sh (revision 2e1cacfb)
1TBL_LIST="\
2arch/alpha/kernel/syscalls/syscall.tbl,linux-user/alpha/syscall.tbl \
3arch/arm/tools/syscall.tbl,linux-user/arm/syscall.tbl \
4scripts/syscall.tbl,linux-user/aarch64/syscall_64.tbl \
5scripts/syscall.tbl,linux-user/hexagon/syscall.tbl \
6scripts/syscall.tbl,linux-user/loongarch64/syscall.tbl \
7arch/m68k/kernel/syscalls/syscall.tbl,linux-user/m68k/syscall.tbl \
8arch/microblaze/kernel/syscalls/syscall.tbl,linux-user/microblaze/syscall.tbl \
9arch/mips/kernel/syscalls/syscall_n32.tbl,linux-user/mips64/syscall_n32.tbl \
10arch/mips/kernel/syscalls/syscall_n64.tbl,linux-user/mips64/syscall_n64.tbl \
11arch/mips/kernel/syscalls/syscall_o32.tbl,linux-user/mips/syscall_o32.tbl \
12scripts/syscall.tbl,linux-user/openrisc/syscall.tbl \
13arch/parisc/kernel/syscalls/syscall.tbl,linux-user/hppa/syscall.tbl \
14arch/powerpc/kernel/syscalls/syscall.tbl,linux-user/ppc/syscall.tbl \
15scripts/syscall.tbl,linux-user/riscv/syscall.tbl \
16arch/s390/kernel/syscalls/syscall.tbl,linux-user/s390x/syscall.tbl \
17arch/sh/kernel/syscalls/syscall.tbl,linux-user/sh4/syscall.tbl \
18arch/sparc/kernel/syscalls/syscall.tbl,linux-user/sparc64/syscall.tbl \
19arch/sparc/kernel/syscalls/syscall.tbl,linux-user/sparc/syscall.tbl \
20arch/x86/entry/syscalls/syscall_32.tbl,linux-user/i386/syscall_32.tbl \
21arch/x86/entry/syscalls/syscall_64.tbl,linux-user/x86_64/syscall_64.tbl \
22arch/xtensa/kernel/syscalls/syscall.tbl,linux-user/xtensa/syscall.tbl\
23"
24
25linux="$1"
26output="$2"
27
28if [ -z "$linux" ] || ! [ -d "$linux" ]; then
29    cat << EOF
30usage: update-syscalltbl.sh LINUX_PATH [OUTPUT_PATH]
31
32LINUX_PATH      Linux kernel directory to obtain the syscall.tbl from
33OUTPUT_PATH     output directory, usually the qemu source tree (default: $PWD)
34EOF
35    exit 1
36fi
37
38if [ -z "$output" ]; then
39    output="$PWD"
40fi
41
42for entry in $TBL_LIST; do
43    OFS="$IFS"
44    IFS=,
45    set $entry
46    src=$1
47    dst=$2
48    IFS="$OFS"
49    if ! cp "$linux/$src" "$output/$dst" ; then
50        echo "Cannot copy $linux/$src to $output/$dst" 1>&2
51        exit 1
52    fi
53done
54
55