util/autoport: Make printing of SPDX headers generic

Previously, Add_gpl() was only used with C and ASL source code files,
and was hard coded to use the C /* */ style comment, preventing it from
being used with files with other comment styles. Convert this into a
generic function for adding arbitrary SPDX license identifiers for
arbitrary filetypes. This replaces the hard coded GPL-2.0-or-later
string used in gma-mainboard.ads with a call to the new function.

This is also used to add SPDX headers to Kconfig and Makefile sources;
as previous commits added them to all such files in the tree.

Tested against logs from a Latitude E6430 (Ivy Bridge) and Precision
M6800 (Haswell) to check that license headers that were already being
generated did not change.

Change-Id: I24a1ccd0afb7045e878bf6eaae7a23f828a9240d
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83184
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Nicholas Chin 2024-06-23 10:15:47 -06:00 committed by Felix Held
commit 2a2c78aeea
9 changed files with 55 additions and 22 deletions

View file

@ -181,7 +181,7 @@ func (b bd82x6x) Scan(ctx Context, addr PCIDevData) {
sb := Create(ctx, "early_init.c")
defer sb.Close()
Add_gpl(sb)
Add_SPDX(sb, C, GPL2_only)
sb.WriteString(`#include <bootblock_common.h>
#include <device/pci_ops.h>
@ -246,7 +246,7 @@ void bootblock_mainboard_early_init(void)
gnvs := Create(ctx, "acpi_tables.c")
defer gnvs.Close()
Add_gpl(gnvs)
Add_SPDX(gnvs, C, GPL2_only)
gnvs.WriteString(`#include <acpi/acpi_gnvs.h>
#include <soc/nvs.h>