diff options
author | Oskari Rauta <oskari.rauta@gmail.com> | 2021-04-21 03:58:42 +0300 |
---|---|---|
committer | Rosen Penev <rosenp@gmail.com> | 2021-04-24 01:12:39 -0700 |
commit | ccf1b96e0eb8342adfc0a9f06f473a7e9218d753 (patch) | |
tree | 25c1e6057430e4b72f16f15497c20ac3c447b904 /utils/gummiboot | |
parent | 5d4d292e501a42e85107e2430fb49eb963fa5f7b (diff) |
gummiboot: add new package
Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
Diffstat (limited to 'utils/gummiboot')
-rw-r--r-- | utils/gummiboot/Makefile | 66 | ||||
-rw-r--r-- | utils/gummiboot/patches/010-fix-missing-includes.patch | 10 | ||||
-rw-r--r-- | utils/gummiboot/patches/020-fix-dev-mapping.patch | 54 |
3 files changed, 130 insertions, 0 deletions
diff --git a/utils/gummiboot/Makefile b/utils/gummiboot/Makefile new file mode 100644 index 000000000..01db86610 --- /dev/null +++ b/utils/gummiboot/Makefile @@ -0,0 +1,66 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gummiboot +PKG_VERSION:=45 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/rzr/gummiboot.git +PKG_SOURCE_DATE:=2021-04-11 +PKG_SOURCE_VERSION:=eb3daf2ca4cb1657cf1f780957485d690a552bf6 +PKG_MIRROR_HASH:=4c57791693b57bbe36e85b49d70310728b8008c4c545006a71c5a5f71b8df501 + +PKG_LICENSE:=LGPL-2.1-or-later +PKG_LICENSE_FILES:=LICENSE +PKG_BUILD_DEPENDS:=gnu-efi +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/gummiboot + SECTION:=boot + CATEGORY:=Boot Loaders + TITLE:=Simple UEFI boot manager + DEPENDS:=@TARGET_X86_64 +libblkid + URL:=https://github.com/rzr/gummiboot +endef + +define Package/gummiboot/description + gummiboot Simple UEFI boot manager + + gummiboot executes EFI images. The default entry is selected by a configured + pattern (glob) or an on-screen menu. +endef + +CONFIGURE_ARGS += \ + --with-efi-libdir=$(STAGING_DIR)/usr/lib \ + --with-efi-ldsdir=$(STAGING_DIR)/usr/lib \ + --with-efi-includedir=$(STAGING_DIR)/usr/include + +define Build/Compile + +$(MAKE_VARS) EFI_CFLAGS="-I$(TOOLCHAIN_DIR)/include $(TARGET_CFLAGS)" \ + $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \ + $(MAKE_FLAGS) \ + $(1); +endef + +define Build/Install + $(MAKE_VARS) EFI_CFLAGS="-I$(TOOLCHAIN_DIR)/include $(TARGET_CFLAGS)" \ + $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \ + $(MAKE_INSTALL_FLAGS) install +endef + +define Package/gummiboot/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/lib/gummiboot + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/gummiboot/gummibootx64.efi $(1)/usr/lib/gummiboot/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gummiboot $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,gummiboot)) diff --git a/utils/gummiboot/patches/010-fix-missing-includes.patch b/utils/gummiboot/patches/010-fix-missing-includes.patch new file mode 100644 index 000000000..60365997d --- /dev/null +++ b/utils/gummiboot/patches/010-fix-missing-includes.patch @@ -0,0 +1,10 @@ +--- a/src/setup/setup.c ++++ b/src/setup/setup.c +@@ -37,6 +37,7 @@ + #include <ftw.h> + #include <stdbool.h> + #include <blkid.h> ++#include <sys/sysmacros.h> + + #include "efivars.h" + diff --git a/utils/gummiboot/patches/020-fix-dev-mapping.patch b/utils/gummiboot/patches/020-fix-dev-mapping.patch new file mode 100644 index 000000000..0446aa2d0 --- /dev/null +++ b/utils/gummiboot/patches/020-fix-dev-mapping.patch @@ -0,0 +1,54 @@ +--- a/src/setup/setup.c ++++ b/src/setup/setup.c +@@ -83,6 +83,9 @@ static int verify_esp(const char *p, uin + blkid_probe b = NULL; + int r; + const char *v; ++ char buf[1024]; ++ ++ memset(buf, 0, sizeof(buf)); + + if (statfs(p, &sfs) < 0) { + fprintf(stderr, "Failed to check file system type of %s: %m\n", p); +@@ -122,24 +125,38 @@ static int verify_esp(const char *p, uin + return -ENODEV; + } + +- r = asprintf(&t, "/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev)); ++ r = asprintf(&t, "/sys/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev)); + if (r < 0) { + fprintf(stderr, "Out of memory.\n"); + return -ENOMEM; + } + ++ r = readlink(t, buf, sizeof(buf) - 1); ++ if (r < 0) { ++ fprintf(stderr, "Failed to identify device node for block device %u:%u\n", major(st.st_dev), minor(st.st_dev)); ++ return -ENOMEM; ++ } ++ ++ r = asprintf(&t, "/dev/%s", basename(buf)); ++ if (r < 0) { ++ fprintf(stderr, "Out of memory.\n"); ++ return -ENOMEM; ++ } ++ + errno = 0; + b = blkid_new_probe_from_filename(t); +- free(t); + if (!b) { + if (errno != 0) { +- fprintf(stderr, "Failed to open file system %s: %m\n", p); ++ fprintf(stderr, "Failed to open file system %s on %s: %m\n", p, t); ++ free(t); + return -errno; + } + ++ free(t); + fprintf(stderr, "Out of memory.\n"); + return -ENOMEM; + } ++ free(t); + + blkid_probe_enable_superblocks(b, 1); + blkid_probe_set_superblocks_flags(b, BLKID_SUBLKS_TYPE); |