summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/efirom.c3
-rw-r--r--src/util/elf2efi.c36
-rwxr-xr-xsrc/util/genfsimg3
-rwxr-xr-xsrc/util/licence.pl14
4 files changed, 56 insertions, 0 deletions
diff --git a/src/util/efirom.c b/src/util/efirom.c
index 95feaf239..b0334bdb1 100644
--- a/src/util/efirom.c
+++ b/src/util/efirom.c
@@ -28,6 +28,8 @@
#include <errno.h>
#include <assert.h>
#include <getopt.h>
+
+#define EFI_HOSTONLY
#include <ipxe/efi/Uefi.h>
#include <ipxe/efi/IndustryStandard/PeImage.h>
#include <ipxe/efi/IndustryStandard/Pci22.h>
@@ -93,6 +95,7 @@ static void read_pe_info ( void *pe, uint16_t *machine,
break;
case EFI_IMAGE_MACHINE_X64:
case EFI_IMAGE_MACHINE_AARCH64:
+ case EFI_IMAGE_MACHINE_LOONGARCH64:
*subsystem = nt->nt64.OptionalHeader.Subsystem;
break;
default:
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index 08d790f1e..cea9abf86 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -33,6 +33,8 @@
#include <fcntl.h>
#include <elf.h>
#include <libgen.h>
+
+#define EFI_HOSTONLY
#include <ipxe/efi/Uefi.h>
#include <ipxe/efi/IndustryStandard/PeImage.h>
@@ -79,6 +81,9 @@
#ifndef EM_AARCH64
#define EM_AARCH64 183
#endif
+#ifndef EM_LOONGARCH
+#define EM_LOONGARCH 258
+#endif
#ifndef R_AARCH64_NONE
#define R_AARCH64_NONE 0
#endif
@@ -124,6 +129,27 @@
#ifndef R_ARM_V4BX
#define R_ARM_V4BX 40
#endif
+#ifndef R_LARCH_NONE
+#define R_LARCH_NONE 0
+#endif
+#ifndef R_LARCH_64
+#define R_LARCH_64 2
+#endif
+#ifndef R_LARCH_B26
+#define R_LARCH_B26 66
+#endif
+#ifndef R_LARCH_PCALA_HI20
+#define R_LARCH_PCALA_HI20 71
+#endif
+#ifndef R_LARCH_PCALA_LO12
+#define R_LARCH_PCALA_LO12 72
+#endif
+#ifndef R_LARCH_GOT_PC_HI20
+#define R_LARCH_GOT_PC_HI20 75
+#endif
+#ifndef R_LARCH_GOT_PC_LO12
+#define R_LARCH_GOT_PC_LO12 76
+#endif
/**
* Alignment of raw data of sections in the image file
@@ -484,6 +510,9 @@ static void set_machine ( struct elf_file *elf, struct pe_header *pe_header ) {
case EM_AARCH64:
machine = EFI_IMAGE_MACHINE_AARCH64;
break;
+ case EM_LOONGARCH:
+ machine = EFI_IMAGE_MACHINE_LOONGARCH64;
+ break;
default:
eprintf ( "Unknown ELF architecture %d\n", ehdr->e_machine );
exit ( 1 );
@@ -669,6 +698,7 @@ static void process_reloc ( struct elf_file *elf, const Elf_Shdr *shdr,
case ELF_MREL ( EM_X86_64, R_X86_64_NONE ) :
case ELF_MREL ( EM_AARCH64, R_AARCH64_NONE ) :
case ELF_MREL ( EM_AARCH64, R_AARCH64_NULL ) :
+ case ELF_MREL ( EM_LOONGARCH, R_LARCH_NONE ) :
/* Ignore dummy relocations used by REQUIRE_SYMBOL() */
break;
case ELF_MREL ( EM_386, R_386_32 ) :
@@ -678,6 +708,7 @@ static void process_reloc ( struct elf_file *elf, const Elf_Shdr *shdr,
break;
case ELF_MREL ( EM_X86_64, R_X86_64_64 ) :
case ELF_MREL ( EM_AARCH64, R_AARCH64_ABS64 ) :
+ case ELF_MREL ( EM_LOONGARCH, R_LARCH_64 ) :
/* Generate an 8-byte PE relocation */
generate_pe_reloc ( pe_reltab, offset, 8 );
break;
@@ -698,6 +729,11 @@ static void process_reloc ( struct elf_file *elf, const Elf_Shdr *shdr,
case ELF_MREL ( EM_AARCH64, R_AARCH64_LDST16_ABS_LO12_NC ) :
case ELF_MREL ( EM_AARCH64, R_AARCH64_LDST32_ABS_LO12_NC ) :
case ELF_MREL ( EM_AARCH64, R_AARCH64_LDST64_ABS_LO12_NC ) :
+ case ELF_MREL ( EM_LOONGARCH, R_LARCH_B26):
+ case ELF_MREL ( EM_LOONGARCH, R_LARCH_PCALA_HI20 ):
+ case ELF_MREL ( EM_LOONGARCH, R_LARCH_PCALA_LO12 ):
+ case ELF_MREL ( EM_LOONGARCH, R_LARCH_GOT_PC_HI20 ):
+ case ELF_MREL ( EM_LOONGARCH, R_LARCH_GOT_PC_LO12 ):
/* Skip PC-relative relocations; all relative
* offsets remain unaltered when the object is
* loaded.
diff --git a/src/util/genfsimg b/src/util/genfsimg
index 731fa6ce0..0c0692793 100755
--- a/src/util/genfsimg
+++ b/src/util/genfsimg
@@ -72,6 +72,9 @@ efi_boot_name() {
"c201" )
echo "BOOTARM.EFI"
;;
+ "6462" )
+ echo "BOOTLOONGARCH64.EFI"
+ ;;
"64aa" )
echo "BOOTAA64.EFI"
;;
diff --git a/src/util/licence.pl b/src/util/licence.pl
index 79e70fd65..bb23c9524 100755
--- a/src/util/licence.pl
+++ b/src/util/licence.pl
@@ -29,6 +29,7 @@ my $known_licences = {
public_domain => 1,
bsd3 => 1,
bsd2 => 1,
+ bsd2_patent => 1,
mit => 1,
isc => 1,
},
@@ -41,6 +42,7 @@ my $known_licences = {
public_domain => 1,
bsd3 => 1,
bsd2 => 1,
+ bsd2_patent => 1,
mit => 1,
isc => 1,
},
@@ -54,6 +56,7 @@ my $known_licences = {
public_domain => 1,
bsd3 => 1,
bsd2 => 1,
+ bsd2_patent => 1,
mit => 1,
isc => 1,
},
@@ -65,6 +68,7 @@ my $known_licences = {
public_domain => 1,
bsd3 => 1,
bsd2 => 1,
+ bsd2_patent => 1,
mit => 1,
isc => 1,
},
@@ -100,6 +104,16 @@ my $known_licences = {
isc => 1,
},
},
+ bsd2_patent => {
+ desc => ( "BSD Licence (without advertising or endorsement clauses, ".
+ "with patent clause)" ),
+ can_subsume => {
+ public_domain => 1,
+ bsd2 => 1,
+ mit => 1,
+ isc => 1,
+ },
+ },
mit => {
desc => "MIT/X11/Xorg Licence",
can_subsume => {