util/: Replace GPLv2 boiler plate with SPDX header
Used commands:
perl -i -p0e 's|\/\*[\s*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-only */|' $(cat filelist)
perl -i -p0e 's|This[\s*]*program[\s*]*is[\s*]*free[\s*]*software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*either[\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License,[\s*]*or[\s*]*.at[\s*]*your[\s*]*option.*[\s*]*any[\s*]*later[\s*]*version.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-or-later */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*This[\s*#]*program[\s*#]*is[\s*#]*free[\s*#]*software[;:,][\s*#]*you[\s*#]*can[\s*#]*redistribute[\s*#]*it[\s*#]*and/or[\s*#]*modify[\s*#]*it[\s*#]*under[\s*#]*the[\s*#]*terms[\s*#]*of[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*as[\s*#]*published[\s*#]*by[\s*#]*the[\s*#]*Free[\s*#]*Software[\s*#]*Foundation[;:,][\s*#]*either[\s*#]*version[\s*#]*3[\s*#]*of[\s*#]*the[\s*#]*License[;:,][\s*#]*or[\s*#]*.at[\s*#]*your[\s*#]*option.*[\s*#]*any[\s*#]*later[\s*#]*version.[\s*#]*This[\s*#]*program[\s*#]*is[\s*#]*distributed[\s*#]*in[\s*#]*the[\s*#]*hope[\s*#]*that[\s*#]*it[\s*#]*will[\s*#]*be[\s*#]*useful[;:,][\s*#]*but[\s*#]*WITHOUT[\s*#]*ANY[\s*#]*WARRANTY[;:,][\s*#]*without[\s*#]*even[\s*#]*the[\s*#]*implied[\s*#]*warranty[\s*#]*of[\s*#]*MERCHANTABILITY[\s*#]*or[\s*#]*FITNESS[\s*#]*FOR[\s*#]*A[\s*#]*PARTICULAR[\s*#]*PURPOSE.[\s*#]*See[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*for[\s*#]*more[\s*#]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-3.0-or-later */|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w]*.*is free software[:;][\#\s]*you[\#\s]*can[\#\s]*redistribute[\#\s]*it[\#\s]*and\/or[\#\s]*modify[\#\s]*it[\s\#]*under[\s \#]*the[\s\#]*terms[\s\#]*of[\s\#]*the[\s\#]*GNU[\s\#]*General[\s\#]*Public[\s\#]*License[\s\#]*as[\s\#]*published[\s\#]*by[\s\#]*the[\s\#]*Free[\s\#]*Software[\s\#]*Foundation[;,][\s\#]*version[\s\#]*2[\s\#]*of[\s\#]*the[\s\#]*License.*[\s\#]*This[\s\#]*program[\s\#]*is[\s\#]*distributed[\s\#]*in[\s\#]*the[\s\#]*hope[\s\#]*that[\s\#]*it[\s\#]*will[\#\s]*be[\#\s]*useful,[\#\s]*but[\#\s]*WITHOUT[\#\s]*ANY[\#\s]*WARRANTY;[\#\s]*without[\#\s]*even[\#\s]*the[\#\s]*implied[\#\s]*warranty[\#\s]*of[\#\s]*MERCHANTABILITY[\#\s]*or[\#\s]*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.[\#\s]*See[\#\s]*the[\#\s]*GNU[\#\s]*General[\#\s]*Public[\#\s]*License[\#\s]*for[\#\s]*more[\#\s]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
Change-Id: I1008a63b804f355a916221ac994701d7584f60ff
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-08 20:48:04 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2009-03-31 13:57:36 +02:00
|
|
|
|
2012-10-30 00:52:36 +01:00
|
|
|
#ifndef __CBFS_H
|
|
|
|
#define __CBFS_H
|
|
|
|
|
2015-10-01 15:54:04 +02:00
|
|
|
#include "common.h"
|
2020-03-14 00:43:34 +01:00
|
|
|
#include <commonlib/bsd/cbfs_serialized.h>
|
2009-03-31 13:57:36 +02:00
|
|
|
|
2015-07-17 21:35:46 +02:00
|
|
|
/* To make CBFS more friendly to ROM, fill -1 (0xFF) instead of zero. */
|
|
|
|
#define CBFS_CONTENT_DEFAULT_VALUE (-1)
|
|
|
|
|
2012-11-16 23:48:22 +01:00
|
|
|
#define CBFS_HEADPTR_ADDR_X86 0xFFFFFFFC
|
2015-10-01 15:54:04 +02:00
|
|
|
|
2020-05-07 02:06:35 +02:00
|
|
|
/* cbfstool is allowed to use this constant freely since it's not part of the
|
|
|
|
CBFS image, so make an alias for the name that's a little less aggressive. */
|
|
|
|
#define METADATA_HASH_ANCHOR_MAGIC \
|
|
|
|
DO_NOT_USE_METADATA_HASH_ANCHOR_MAGIC_DO_NOT_USE
|
|
|
|
|
2020-03-14 00:43:34 +01:00
|
|
|
struct typedesc_t {
|
2011-10-21 23:24:57 +02:00
|
|
|
uint32_t type;
|
2020-03-14 00:43:34 +01:00
|
|
|
const char *name;
|
2015-09-09 16:46:00 +02:00
|
|
|
};
|
|
|
|
|
2020-03-14 00:43:34 +01:00
|
|
|
static const struct typedesc_t types_cbfs_compression[] = {
|
|
|
|
{CBFS_COMPRESS_NONE, "none"},
|
|
|
|
{CBFS_COMPRESS_LZMA, "LZMA"},
|
|
|
|
{CBFS_COMPRESS_LZ4, "LZ4"},
|
|
|
|
{0, NULL},
|
2015-10-01 15:54:04 +02:00
|
|
|
};
|
|
|
|
|
2020-03-14 00:43:34 +01:00
|
|
|
static struct typedesc_t filetypes[] unused = {
|
|
|
|
{CBFS_TYPE_BOOTBLOCK, "bootblock"},
|
|
|
|
{CBFS_TYPE_CBFSHEADER, "cbfs header"},
|
|
|
|
{CBFS_TYPE_STAGE, "stage"},
|
|
|
|
{CBFS_TYPE_SELF, "simple elf"},
|
|
|
|
{CBFS_TYPE_FIT, "fit"},
|
|
|
|
{CBFS_TYPE_OPTIONROM, "optionrom"},
|
|
|
|
{CBFS_TYPE_BOOTSPLASH, "bootsplash"},
|
|
|
|
{CBFS_TYPE_RAW, "raw"},
|
|
|
|
{CBFS_TYPE_VSA, "vsa"},
|
|
|
|
{CBFS_TYPE_MBI, "mbi"},
|
|
|
|
{CBFS_TYPE_MICROCODE, "microcode"},
|
|
|
|
{CBFS_TYPE_FSP, "fsp"},
|
|
|
|
{CBFS_TYPE_MRC, "mrc"},
|
|
|
|
{CBFS_TYPE_CMOS_DEFAULT, "cmos_default"},
|
|
|
|
{CBFS_TYPE_CMOS_LAYOUT, "cmos_layout"},
|
|
|
|
{CBFS_TYPE_SPD, "spd"},
|
|
|
|
{CBFS_TYPE_MRC_CACHE, "mrc_cache"},
|
|
|
|
{CBFS_TYPE_MMA, "mma"},
|
|
|
|
{CBFS_TYPE_EFI, "efi"},
|
|
|
|
{CBFS_TYPE_STRUCT, "struct"},
|
|
|
|
{CBFS_TYPE_DELETED, "deleted"},
|
|
|
|
{CBFS_TYPE_NULL, "null"},
|
|
|
|
{0, NULL}
|
2015-10-01 15:54:04 +02:00
|
|
|
};
|
|
|
|
|
2013-01-19 00:53:22 +01:00
|
|
|
#define CBFS_SUBHEADER(_p) ( (void *) ((((uint8_t *) (_p)) + ntohl((_p)->offset))) )
|
2015-07-15 20:49:00 +02:00
|
|
|
|
2020-03-14 00:43:34 +01:00
|
|
|
static inline size_t cbfs_file_attr_hash_size(enum vb2_hash_algorithm algo)
|
|
|
|
{
|
|
|
|
return offsetof(struct cbfs_file_attr_hash, hash.raw) +
|
|
|
|
vb2_digest_size(algo);
|
|
|
|
}
|
|
|
|
|
2013-12-30 22:16:18 +01:00
|
|
|
/* cbfs_image.c */
|
|
|
|
uint32_t get_cbfs_entry_type(const char *name, uint32_t default_value);
|
|
|
|
uint32_t get_cbfs_compression(const char *name, uint32_t unknown);
|
|
|
|
|
2014-02-04 17:29:35 +01:00
|
|
|
/* cbfs-mkpayload.c */
|
|
|
|
void xdr_segs(struct buffer *output,
|
|
|
|
struct cbfs_payload_segment *segs, int nseg);
|
2014-08-05 17:48:20 +02:00
|
|
|
void xdr_get_seg(struct cbfs_payload_segment *out,
|
|
|
|
struct cbfs_payload_segment *in);
|
2014-02-04 17:29:35 +01:00
|
|
|
|
2012-10-30 00:52:36 +01:00
|
|
|
#endif
|