Skip to content

Commit

Permalink
[misc] relicense the sources that can be relicensed to GPLv2+
Browse files Browse the repository at this point in the history
* This commit relicenses most of the sources found under ./src/ to GPLv2+.
* This is accomplished by following all the legal procedures for relicensing,
  which includes:
  - Obtaining a formal written authorization to relicense their code from
    any external contributors to the relevant source files (which we did).
  - Demonstrating that the original source (if any) on which derivative
    work was applied was using a license that is compatible with GPLv2+.
  - Removing any elements that could not be explicitly relicensed (such as
    the str###a() function calls from missing.c).
* Note that this does *not* mean that the project itself has been relicensed
  to GPLv2+, as it is still derived from GRUB 2.0, which is GPLv3+. It only
  means that the files, that are now explicitly stated as such, can be reused
  in GPLv2+ compatible works.
  • Loading branch information
pbatard committed Feb 12, 2021
1 parent 6818a6e commit 08b1ae4
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 72 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,12 @@ For additional info as well as precompiled drivers, see https://efi.akeo.ie
```
build -a X64 -b RELEASE -t <toolchain> -p EfiFsPkg/EfiFsPkg.dsc
```
where `<toolchain>` is something like `VS2015` (Windows) or `GCC5` (Linux).
where `<toolchain>` is something like `VS2019` (Windows) or `GCC5` (Linux).
NB: To build an individual driver, such as NTFS, you can also use something
like:
```
build -a X64 -b RELEASE -t <toolchain> -p EfiFsPkg/EfiFsPkg.dsc -m EfiFsPkg/EfiFsPkg/Ntfs.inf
```
* Note that, provided that you cloned a recent EDK2 from git, you should be able
to use `VS2019` as your EDK2 toolchain, including for buidling the ARM or
ARM64 drivers, with something like:
```
build -a AARCH64 -b RELEASE -t VS2019 -p EfiFsPkg/EfiFsPkg.dsc
```
* A Windows script to build the drivers, using EDK2 with VS2019 is also provided
as `edk2_build_drivers.cmd`.

Expand Down Expand Up @@ -102,6 +96,11 @@ This is a pure GPLv3+ implementation of EFI drivers. Great care was taken not to
use any code from non GPLv3 compatible sources, such as rEFInd's `fsw_efi`
(GPLv2 only) or Intel's FAT driver (requires an extra copyright notice).

Note however that some files (the non `grub_####` sources under `./src/`) are
licensed under GPLv2+ rather than GPLv3+ and that, just like the GPLv3+ sources,
we took great care of ensuring that we are fully compliant with any licensing
or relicensing matters, so that they can legally be reused into GPLv2+ works.

## Bonus: Commands to compile EfiFs using EDK2 on a vanilla Debian GNU/Linux 10.x

As root:
Expand Down
14 changes: 14 additions & 0 deletions debug.vbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
' Visual Studio QEMU debugging script.
' Copyright © 2014-2021 Pete Batard <[email protected]>
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 2 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
'
' I like invoking vbs as much as anyone else, but we need to download and unzip a
' bunch of files, as well as launch QEMU, and neither Powershell or a standard batch
Expand Down
7 changes: 6 additions & 1 deletion src/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
* Based on iPXE's efi_driver.c and efi_file.c:
* Copyright © 2011,2013 Michael Brown <[email protected]>.
*
* Note: This file has been relicensed from GPLv3+ to GPLv2+ by formal
* agreement of all of the contributors who applied changes on top of
* its original GPLv2+ source. The original source can be found at:
* https://github.com/ipxe/ipxe/blob/26029658063dcafcca746640a28a76d4f7f4a66e/src/interface/efi/efi_driver.c
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand Down
9 changes: 5 additions & 4 deletions src/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
/*
* Copyright © 2014-2020 Pete Batard <[email protected]>
*
* Note: This file has been relicensed from GPLv3+ to GPLv2+ by formal
* agreement of all of its contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand Down Expand Up @@ -205,9 +208,7 @@ extern CHAR16 *ShortDriverName, *FullDriverName;
extern GRUB_MOD_INIT GrubModuleInit[];
extern GRUB_MOD_EXIT GrubModuleExit[];

extern VOID strcpya(CHAR8 *dst, CONST CHAR8 *src);
extern CHAR8 *strchra(const CHAR8 *s, INTN c);
extern CHAR8 *strrchra(const CHAR8 *s, INTN c);
#define strcpya(dst, src) CopyMem(dst, src, strlena(src) + 1)
extern VOID SetLogging(VOID);
extern VOID PrintStatus(EFI_STATUS Status);
extern VOID GrubDriverInit(VOID);
Expand Down
9 changes: 7 additions & 2 deletions src/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
* Based on iPXE's efi_driver.c and efi_file.c:
* Copyright © 2011,2013 Michael Brown <[email protected]>.
*
* Note: This file has been relicensed from GPLv3+ to GPLv2+ by formal
* agreement of all of the contributors who applied changes on top of
* its original GPLv2+ source. The original source can be found at:
* https://github.com/ipxe/ipxe/blob/26029658063dcafcca746640a28a76d4f7f4a66e/src/interface/efi/efi_file.c
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand Down Expand Up @@ -128,7 +133,7 @@ FileOpen(EFI_FILE_HANDLE This, EFI_FILE_HANDLE *New,
path[i] = '/';
}

/* We only want to handle with absolute paths */
/* We only want to handle absolute paths */
clean_path[0] = '/';
/* Find out if we're dealing with root by removing the junk */
CopyPathRelative(&clean_path[1], path, MAX_PATH - 1);
Expand Down
5 changes: 4 additions & 1 deletion src/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
/*
* Copyright © 2014-2017 Pete Batard <[email protected]>
*
* Note: This file has been relicensed from GPLv3+ to GPLv2+ by formal
* agreement of all of its contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand Down
45 changes: 8 additions & 37 deletions src/missing.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/* missing.c - Missing convenience calls from the EFI interface */
/*
* Copyright © 2014-2017 Pete Batard <[email protected]>
* Based on GRUB -- GRand Unified Bootloader
* Copyright © 1999-2010 Free Software Foundation, Inc.
* Copyright © 2014-2021 Pete Batard <[email protected]>
*
* NB: This file was relicensed from GPLv3+ to GPLv2+ by its author.
* Per https://github.com/pbatard/efifs/commit/6472929565970fc88fbad479c5973898c3275235#diff-e4e188b933de262cfdf4c2be771da37b2ec89ba97d353a16352c6eebb41a286f
* you can confirm that we did remove the initial 3 function calls
* that were derived from GPLv3+ work, thus granting us the ability
* to relicense this file.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand All @@ -25,39 +29,6 @@
#pragma comment(linker, "/INCLUDE:_MultS64x64")
#endif

VOID
strcpya(CHAR8 *dst, CONST CHAR8 *src)
{
INTN len = strlena(src) + 1;
CopyMem(dst, src, len);
}

CHAR8 *
strchra(const CHAR8 *s, INTN c)
{
do {
if (*s == c)
return (CHAR8 *) s;
}
while (*s++);

return NULL;
}

CHAR8 *
strrchra(const CHAR8 *s, INTN c)
{
CHAR8 *p = NULL;

do {
if (*s == c)
p = (CHAR8 *) s;
}
while (*s++);

return p;
}

EFI_STATUS
PrintGuid(EFI_GUID *Guid)
{
Expand Down
32 changes: 14 additions & 18 deletions src/path.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
/* path.c - Path handling routines */
/*
* Copyright © 2014 Pete Batard <[email protected]>
* Copyright © 2014-2021 Pete Batard <[email protected]>
* Based on path sanitation code by Ludwig Nussel <[email protected]>
*
* Note: This file has been relicensed from GPLv3+ to GPLv2+ by formal
* agreement of all of the contributors who applied changes on top of
* its original Public Domain source. The original source can be found at:
* https://github.com/saygili/pisilinux/blob/65c6b72d90aa282d8a3e79be209fa364c7180ffc/extra/util/archive/unarj/files/unarj-2.65-sanitation.patch#L4-L86
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand Down Expand Up @@ -38,8 +43,8 @@ VOID CopyPathRelative(CHAR8 *dest, CHAR8 *src, INTN len)
for(; len && *p;)
{
src = p;
p = strchra(src, PATH_CHAR);
if(!p) p = src+strlena(src);
while (*p && *p != PATH_CHAR) p++;
if (!*p) p = src+strlena(src);

/* . => skip */
if(p-src == 1 && *src == '.' )
Expand All @@ -51,21 +56,12 @@ VOID CopyPathRelative(CHAR8 *dest, CHAR8 *src, INTN len)
{
if(o != dest)
{
CHAR8* tmp;
UINTN i;
*o = '\0';
tmp = strrchra(dest, PATH_CHAR);
if(!tmp)
{
len += o-dest;
o = dest;
if(*p) ++p;
}
else
{
len += o-tmp;
o = tmp;
if(*p) ++p;
}
for(i = strlena(dest)-1; i > 0 && dest[i] != PATH_CHAR; i--);
len += o-&dest[i];
o = &dest[i];
if(*p) ++p;
}
else /* nothing to pop */
if(*p) ++p;
Expand Down
5 changes: 4 additions & 1 deletion src/this.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
/*
* Copyright © 2014-2017 Pete Batard <[email protected]>
*
* Note: This file has been relicensed from GPLv3+ to GPLv2+ by formal
* agreement of all of its contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand Down
7 changes: 6 additions & 1 deletion src/utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
* Based on Netscape security libraries:
* Copyright © 1994-2000 Netscape Communications Corporation.
*
* Note: This file has been relicensed from GPLv3+ to GPLv2+ by formal
* agreement of all of the contributors who applied changes on top of
* its original GPLv2+ source. The original source can be found at:
* https://github.com/mozilla/gecko-dev/blob/9fd7059a19baa49b01a534eddf9a5a4de918a9f9/security/nss/lib/util/utf8.c
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand Down

0 comments on commit 08b1ae4

Please sign in to comment.