selftests/nolibc: add XARCH and ARCH mapping support
authorZhangjin Wu <falcon@tinylab.org>
Sat, 5 Aug 2023 18:41:37 +0000 (02:41 +0800)
committerWilly Tarreau <w@1wt.eu>
Wed, 23 Aug 2023 03:17:07 +0000 (05:17 +0200)
commitc6c3734fb6b1c438d5586748753fee52a135c078
tree8d6b859223ea6d7319a1d03a7ddc419e9556c059
parente45ce88e6591bf609f997aea6dc1fdf1bc45fd43
selftests/nolibc: add XARCH and ARCH mapping support

Most of the CPU architectures have different variants, but kernel
usually only accepts parts of them via the ARCH variable, the others
should be customized via kernel config files.

To simplify testing, a new XARCH variable is added to extend the
kernel's ARCH with a few variants of the same architecture, and it is
used to customize variant specific variables, at last XARCH is converted
to the kernel's ARCH:

  e.g. make run XARCH=<one of the supported variants>
                | \
                |  `-> variant specific variables:
                |      IMAGE, DEFCONFIG, QEMU_ARCH, QEMU_ARGS, CFLAGS ...
                \
                 `---> kernel's ARCH

XARCH and ARCH are carefully mapped to allow users to pass architecture
variants via XARCH or pass architecture via ARCH from cmdline.

PowerPC is the first user and also a very good reference architecture of
this mapping, it has variants with different combinations of
32-bit/64-bit and bit endian/little endian.

To use this mapping, the other architectures can refer to PowerPC, If
the target architecture only has one variant, XARCH is simply an alias
of ARCH, no additional mapping required.

Suggested-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/lkml/20230702171715.GD16233@1wt.eu/
Link: https://lore.kernel.org/lkml/20230730061801.GA7690@1wt.eu/
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
tools/testing/selftests/nolibc/Makefile