diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-04 05:48:38 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-04 05:48:38 -0500 |
| commit | bfd9c39e4712ebdb442d4ca0673061faed1e70e1 (patch) | |
| tree | 0d7a74b4463ee387f9cf9368ceb1b757f694f72a /sys-boot | |
| parent | f716a9fe6455d39eef01e718aae68dae61c19704 (diff) | |
| download | baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.gz baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.xz baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.zip | |
Revert "Adding metadata"
This reverts commit f716a9fe6455d39eef01e718aae68dae61c19704.
Diffstat (limited to 'sys-boot')
251 files changed, 12327 insertions, 0 deletions
diff --git a/sys-boot/aboot/Manifest b/sys-boot/aboot/Manifest new file mode 100644 index 000000000000..e06ee93fc07a --- /dev/null +++ b/sys-boot/aboot/Manifest @@ -0,0 +1,4 @@ +DIST aboot-1.0_pre20040408.tar.bz2 115062 BLAKE2B 49f1b45abcd4726fd036e24709d10bbfea42cee03293e31b2deb3aec383c1c438602aa97d3909516ec9864986dfcf82612fe7644b47e3e2760bdf377313446a0 SHA512 b1fff7ce806336f89efe8239108a8547053f22727cba93cea742995432c4f35133f8dc619588390ba6e0d114e2fd62b80b730443e6c18900aa2a8832ddd4ebfc +DIST aboot-2.0_pre20210801.tar.gz 173477 BLAKE2B 54c38a98b9e3e956f08b4fcca6a4f3351364d7774a915916aae8af67237982635a2686c1df0628fc28dcc2443da8ad57be822c8530e1580261c60dde73f00519 SHA512 57181897147bba65e8b216af262bf2d2e57cb76bd809d8207439dbfbe84ff550cf9a43c0f10f9925e54ca21660cfe9441c7607743ff3f7613c1e22e219708081 +DIST aboot_gentoo.diff.bz2 9527 BLAKE2B 2492b456f7411630b6ecfb19db775969b69a35c0ef31b2146fd353aac78cf4d3c9ef2162cf54ab4ac025c65607219b3a33a74d2105be196e6dda54dd2509c1f8 SHA512 868a73fee56e9bf6d986175a6a4dc321ed12fb78d74dfb8f1a3e35274577ddc9ea0820768b44836403587b3976ad8dacdcf6562a9ce5c45981c752670901155f +DIST gentoo-headers-base-2.6.22.tar.bz2 4700338 BLAKE2B a264d7999ed7735e42ea21f8cf96b60ca1bdbfcb76dbdfcba14a849043e1f6a9109cd72bf5b91b9ab877dc3025ce6a9270ea914cf277b8f77cecff703646a7ec SHA512 99849928eede0c4b101ddc9179c0974cac6b4f18803dc98b72dcbe80cea88d3062f709beaa1b890edbed9c147be0dd516065d4cee945164b5d9f19f7a3cf249d diff --git a/sys-boot/aboot/aboot-1.0_pre20040408-r3.ebuild b/sys-boot/aboot/aboot-1.0_pre20040408-r3.ebuild new file mode 100644 index 000000000000..a14b4ee280ba --- /dev/null +++ b/sys-boot/aboot/aboot-1.0_pre20040408-r3.ebuild @@ -0,0 +1,90 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit toolchain-funcs + +KERN_VER="2.6.22" + +DESCRIPTION="Alpha Linux boot loader for SRM" +HOMEPAGE="http://aboot.sourceforge.net/" +SRC_URI="http://aboot.sourceforge.net/tarballs/${P}.tar.bz2 + mirror://gentoo/gentoo-headers-base-${KERN_VER}.tar.bz2 + mirror://gentoo/${PN}_gentoo.diff.bz2 + https://dev.gentoo.org/~armin76/dist/${PN}_gentoo.diff.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* ~alpha" + +src_unpack() { + unpack ${A} + # setup local copies of kernel headers since we rely so + # heavily on linux internals. + mv gentoo-headers-base-${KERN_VER}/include/{linux,asm-generic,asm-alpha} "${S}"/include/ || die + cd "${S}"/include + ln -s asm-alpha asm || die + touch linux/config.h || die +} + +src_prepare() { + eapply "${FILESDIR}/aboot-gcc-3.4.patch" + eapply "${FILESDIR}/aboot-pt_note.patch" + # Bug 364697 + eapply "${FILESDIR}/aboot-define_stat_only_in_userspace.patch" + eapply "${FILESDIR}"/aboot-respect-AR.patch + eapply "${FILESDIR}"/aboot-gnu90.patch + + # Modified patch from Debian to add netboot support + eapply "${WORKDIR}"/aboot_gentoo.diff + + eapply_user +} + +src_compile() { + # too many problems with parallel building + emake -j1 AR="$(tc-getAR)" CC="$(tc-getCC)" LD="$(tc-getLD)" +} + +src_install() { + dodir /boot /sbin /usr/share/man/man{1,5,8} + make \ + root="${D}" \ + bindir="${D}"/sbin \ + bootdir="${D}"/boot \ + mandir="${D}"/usr/share/man \ + install + + insinto /boot + doins net_aboot.nh + dobin netabootwrap + dodoc ChangeLog INSTALL README TODO aboot.conf + + insinto /etc + newins "${FILESDIR}"/aboot.conf aboot.conf.example + +} + +pkg_postinst() { + einfo "To make aboot install a new bootloader on your harddisk follow" + einfo "these steps:" + einfo "" + einfo " - edit the file /etc/aboot.conf" + einfo " - cd /boot" + einfo " - swriteboot -c2 /dev/sda bootlx" + einfo " This will install a new bootsector on /dev/sda and aboot will" + einfo " use the second partition on this device to lookup kernel and " + einfo " initrd (as described in the aboot.conf file)" + einfo "" + einfo "IMPORTANT :" + einfo "" + einfo "The partition table of your boot device has to contain " + einfo "a BSD-DISKLABEL and the first 12 megabytes of your boot device" + einfo "must not be part of a partition as aboot will write its bootloader" + einfo "in there and not as with most x86 bootloaders into the " + einfo "master boot sector. If your partition table does not reflect this" + einfo "you are going to destroy your installation !" + einfo "Also note that aboot currently only supports ext2/3 partitions" + einfo "to boot from." +} diff --git a/sys-boot/aboot/aboot-2.0_pre20210801.ebuild b/sys-boot/aboot/aboot-2.0_pre20210801.ebuild new file mode 100644 index 000000000000..0cb5a272325e --- /dev/null +++ b/sys-boot/aboot/aboot-2.0_pre20210801.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit toolchain-funcs + +if [[ ${PV} = 9999* ]]; then + EGIT_REPO_URI="https://github.com/mattst88/${PN}.git" + inherit git-r3 +else + COMMIT_ID="dde7f7b85f7631668f1da7c0b0ecf7ddbbde004e" + SRC_URI="https://github.com/mattst88/${PN}/archive/${COMMIT_ID}.tar.gz -> ${P}.tar.gz" + S="${WORKDIR}/${PN}-${COMMIT_ID}" + KEYWORDS="-* ~alpha" +fi + +DESCRIPTION="Alpha Linux boot loader for SRM" +HOMEPAGE="https://github.com/mattst88/aboot https://sourceforge.net/projects/aboot/" + +LICENSE="GPL-2" +SLOT="0" + +BDEPEND="app-text/docbook-sgml-utils" + +src_compile() { + emake AR="$(tc-getAR)" CC="$(tc-getCC)" LD="$(tc-getLD)" \ + all netabootwrap + + einfo "Building man pages" + emake -C doc/man +} + +src_install() { + dodir /boot /sbin /usr/share/man/man{1,5,8} + emake root="${D}" install + + insinto /boot + doins net_aboot.nh + dobin netabootwrap + dodoc ChangeLog INSTALL README TODO aboot.conf + + insinto /etc + newins "${FILESDIR}"/aboot.conf aboot.conf.example + +} + +pkg_postinst() { + einfo "To make aboot install a new bootloader on your harddisk follow" + einfo "these steps:" + einfo "" + einfo " - edit the file /etc/aboot.conf" + einfo " - cd /boot" + einfo " - swriteboot -c2 /dev/sda bootlx" + einfo " This will install a new bootsector on /dev/sda and aboot will" + einfo " use the second partition on this device to lookup kernel and " + einfo " initrd (as described in the aboot.conf file)" + einfo "" + einfo "IMPORTANT :" + einfo "" + einfo "The partition table of your boot device has to contain " + einfo "a BSD-DISKLABEL and the first 12 megabytes of your boot device" + einfo "must not be part of a partition as aboot will write its bootloader" + einfo "in there and not as with most x86 bootloaders into the " + einfo "master boot sector. If your partition table does not reflect this" + einfo "you are going to destroy your installation !" + einfo "Also note that aboot currently only supports ext2/3 partitions" + einfo "to boot from." +} diff --git a/sys-boot/aboot/aboot-9999.ebuild b/sys-boot/aboot/aboot-9999.ebuild new file mode 100644 index 000000000000..494ceb2d395e --- /dev/null +++ b/sys-boot/aboot/aboot-9999.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit toolchain-funcs + +if [[ ${PV} = 9999* ]]; then + EGIT_REPO_URI="https://github.com/mattst88/${PN}.git" + inherit git-r3 +else + SRC_URI="https://github.com/mattst88/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* ~alpha" +fi + +DESCRIPTION="Alpha Linux boot loader for SRM" +HOMEPAGE="https://github.com/mattst88/aboot https://sourceforge.net/projects/aboot/" + +LICENSE="GPL-2" +SLOT="0" + +BDEPEND="app-text/docbook-sgml-utils" + +src_compile() { + emake AR="$(tc-getAR)" CC="$(tc-getCC)" LD="$(tc-getLD)" \ + all netabootwrap + + einfo "Building man pages" + emake -C doc/man +} + +src_install() { + dodir /boot /sbin /usr/share/man/man{1,5,8} + emake root="${D}" install + + insinto /boot + doins net_aboot.nh + dobin netabootwrap + dodoc ChangeLog INSTALL README TODO aboot.conf + + insinto /etc + newins "${FILESDIR}"/aboot.conf aboot.conf.example + +} + +pkg_postinst() { + einfo "To make aboot install a new bootloader on your harddisk follow" + einfo "these steps:" + einfo "" + einfo " - edit the file /etc/aboot.conf" + einfo " - cd /boot" + einfo " - swriteboot -c2 /dev/sda bootlx" + einfo " This will install a new bootsector on /dev/sda and aboot will" + einfo " use the second partition on this device to lookup kernel and " + einfo " initrd (as described in the aboot.conf file)" + einfo "" + einfo "IMPORTANT :" + einfo "" + einfo "The partition table of your boot device has to contain " + einfo "a BSD-DISKLABEL and the first 12 megabytes of your boot device" + einfo "must not be part of a partition as aboot will write its bootloader" + einfo "in there and not as with most x86 bootloaders into the " + einfo "master boot sector. If your partition table does not reflect this" + einfo "you are going to destroy your installation !" + einfo "Also note that aboot currently only supports ext2/3 partitions" + einfo "to boot from." +} diff --git a/sys-boot/aboot/files/aboot-define_stat_only_in_userspace.patch b/sys-boot/aboot/files/aboot-define_stat_only_in_userspace.patch new file mode 100644 index 000000000000..5b0b5e0efedf --- /dev/null +++ b/sys-boot/aboot/files/aboot-define_stat_only_in_userspace.patch @@ -0,0 +1,35 @@ +# Patch by Sergei Trofimovich +# http://bugs.gentoo.org/364697 + +diff --git a/Makefile b/Makefile +index bbe3b60..b4245af 100644 +--- a/Makefile ++++ b/Makefile +@@ -138,10 +138,10 @@ distclean: clean + find . -name \*~ | xargs rm -f + + lib/%: +- make -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)" ++ make -C lib $* CPPFLAGS="$(CPPFLAGS) -D__KERNEL__" TESTING="$(TESTING)" + + tools/%: +- make -C tools $* CPPFLAGS="$(CPPFLAGS)" ++ make -C tools $* CPPFLAGS="$(CPPFLAGS) -U__KERNEL__" + + sdisklabel/%: + make -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)" +diff --git a/include/isolib.h b/include/isolib.h +index 392327a..0ef6e2a 100644 +--- a/include/isolib.h ++++ b/include/isolib.h +@@ -7,7 +7,10 @@ + # define fd_set kernel_fd_set + #endif + ++#ifdef __KERNEL__ ++/* userspace stuff has it's own struct stat */ + #include <asm/stat.h> ++#endif + + extern int iso_read_super (void * data, int quiet); + extern int iso_open (const char * filename); diff --git a/sys-boot/aboot/files/aboot-gcc-3.4.patch b/sys-boot/aboot/files/aboot-gcc-3.4.patch new file mode 100644 index 000000000000..24da18ce8190 --- /dev/null +++ b/sys-boot/aboot/files/aboot-gcc-3.4.patch @@ -0,0 +1,31 @@ +--- aboot-1.0_pre20040408/cons.c ++++ aboot-1.0_pre20040408/cons.c +@@ -20,7 +20,6 @@ + #endif + + long cons_dev; /* console device */ +-extern long int dispatch(); /* Need the full 64 bit return here...*/ + + long + cons_puts(const char *str, long len) +--- aboot-1.0_pre20040408/fs/ext2.c ++++ aboot-1.0_pre20040408/fs/ext2.c +@@ -6,6 +6,7 @@ + * This file has been ported from the DEC 32-bit Linux version + * by David Mosberger (davidm@cs.arizona.edu). + */ ++#include <string.h> + #include <linux/stat.h> + #include <linux/types.h> + #include <linux/version.h> +--- aboot-1.0_pre20040408/include/cons.h ++++ aboot-1.0_pre20040408/include/cons.h +@@ -3,7 +3,7 @@ + + extern long cons_dev; /* console device */ + +-extern long dispatch(long proc, ...); ++extern long int dispatch(long proc, ...); + + #ifdef TESTING + #define STRINGIFY(sym) #sym diff --git a/sys-boot/aboot/files/aboot-gnu90.patch b/sys-boot/aboot/files/aboot-gnu90.patch new file mode 100644 index 000000000000..2fb4b87f6b2c --- /dev/null +++ b/sys-boot/aboot/files/aboot-gnu90.patch @@ -0,0 +1,26 @@ +This patch fixes multiple definitions of 'extern inline' functions. + +c99 and gnu90 have slightly different semantics +WRT symbol definition: http://www.greenend.org.uk/rjk/tech/inline.html + +gcc-4 defaults to gnu90 and works, gcc-6 defaults to gnu-99 +and fails to link aboot as: + alpha-unknown-linux-gnu-ld: Disabling relaxation: it will not work with multiple definitions + lib/libaboot.a(isolib.o): In function `prefetchw': + (.text+0x60): multiple definition of `prefetchw' + fs/ext2.o:(.text+0xe68): first defined here + +The change is to force gnu90 explicitly. +diff --git a/Makefile b/Makefile +index b4245af..634ac87 100644 +--- a/Makefile ++++ b/Makefile +@@ -40,6 +40,6 @@ ifeq ($(TESTING),) + CPPFLAGS = $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include +-CFLAGS = $(CPPFLAGS) -D__KERNEL__ -Os -Wall -fno-builtin -mno-fp-regs ++CFLAGS = $(CPPFLAGS) -std=gnu90 -D__KERNEL__ -Os -Wall -fno-builtin -mno-fp-regs + else + CPPFLAGS = -DTESTING $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include +-CFLAGS = $(CPPFLAGS) -O -g3 -Wall -D__KERNEL__ -ffixed-8 ++CFLAGS = $(CPPFLAGS) -std=gnu90 -O -g3 -Wall -D__KERNEL__ -ffixed-8 + endif diff --git a/sys-boot/aboot/files/aboot-pt_note.patch b/sys-boot/aboot/files/aboot-pt_note.patch new file mode 100644 index 000000000000..d28527ad5b0c --- /dev/null +++ b/sys-boot/aboot/files/aboot-pt_note.patch @@ -0,0 +1,308 @@ +Recent build changes have added a PT_NOTE entry to the kernel's +ELF header. A perfectly valid change, but Alpha's aboot loader +is none too bright about examining these headers. + +The following patch to aboot-1.0_pre20040408.tar.bz2 makes it +so that only PT_LOAD entries are considered for loading, as well +as several other changes required to get the damned thing to +build again. + +--- aboot-1.0_pre20040408/Makefile ++++ aboot-1.0_pre20040408/Makefile +@@ -32,15 +32,15 @@ export + # + LOADADDR = 20000000 + +-ABOOT_LDFLAGS = -static -N -Taboot.lds ++ABOOT_LDFLAGS = -static -N -Taboot.lds --relax + + CC = gcc + TOP = $(shell pwd) + ifeq ($(TESTING),) +-CPPFLAGS = $(CFGDEFS) -I$(TOP)/include +-CFLAGS = $(CPPFLAGS) -D__KERNEL__ -Os -Wall -fno-builtin -mno-fp-regs -ffixed-8 ++CPPFLAGS = $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include ++CFLAGS = $(CPPFLAGS) -D__KERNEL__ -Os -Wall -fno-builtin -mno-fp-regs + else +-CPPFLAGS = -DTESTING $(CFGDEFS) -I$(TOP)/include ++CPPFLAGS = -DTESTING $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include + CFLAGS = $(CPPFLAGS) -O -g3 -Wall -D__KERNEL__ -ffixed-8 + endif + ASFLAGS = $(CPPFLAGS) + +--- aboot-1.0_pre20040408/aboot.c ++++ aboot-1.0_pre20040408/aboot.c +@@ -19,7 +19,6 @@ + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +-#include <linux/elf.h> + #include <linux/kernel.h> + #include <linux/version.h> + +@@ -27,6 +26,7 @@ + #include <asm/hwrpb.h> + #include <asm/system.h> + ++#include <elf.h> + #include <alloca.h> + #include <errno.h> + +@@ -37,16 +37,6 @@ + #include "utils.h" + #include "string.h" + +-#ifndef elf_check_arch +-# define aboot_elf_check_arch(e) 1 +-#else +-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +-# define aboot_elf_check_arch(e) elf_check_arch(e) +-# else +-# define aboot_elf_check_arch(e) elf_check_arch(e->e_machine) +-# endif +-#endif +- + struct bootfs * bfs = 0; /* filesystem to boot from */ + char * dest_addr = 0; + jmp_buf jump_buffer; +@@ -83,77 +73,89 @@ static unsigned long entry_addr = START_ADDR; + long + first_block (const char *buf, long blocksize) + { +- struct elfhdr *elf; +- struct elf_phdr *phdrs; ++ Elf64_Ehdr *elf; ++ Elf64_Phdr *phdrs; ++ int i, j; + +- elf = (struct elfhdr *) buf; ++ elf = (Elf64_Ehdr *) buf; + +- if (elf->e_ident[0] == 0x7f +- && strncmp(elf->e_ident + 1, "ELF", 3) == 0) +- { +- int i; +- /* looks like an ELF binary: */ +- if (elf->e_type != ET_EXEC) { +- printf("aboot: not an executable ELF file\n"); +- return -1; +- } +- if (!aboot_elf_check_arch(elf)) { +- printf("aboot: ELF executable not for this machine\n"); +- return -1; +- } +- if (elf->e_phoff + elf->e_phnum * sizeof(*phdrs) > (unsigned) blocksize) { +- printf("aboot: " +- "ELF program headers not in first block (%ld)\n", +- (long) elf->e_phoff); ++ if (elf->e_ident[0] != 0x7f ++ || elf->e_ident[1] != 'E' ++ || elf->e_ident[2] != 'L' ++ || elf->e_ident[3] != 'F') { ++ /* Fail silently, it might be a compressed file */ ++ return -1; ++ } ++ if (elf->e_ident[EI_CLASS] != ELFCLASS64 ++ || elf->e_ident[EI_DATA] != ELFDATA2LSB ++ || elf->e_machine != EM_ALPHA) { ++ printf("aboot: ELF executable not for this machine\n"); ++ return -1; ++ } ++ ++ /* Looks like an ELF binary. */ ++ if (elf->e_type != ET_EXEC) { ++ printf("aboot: not an executable ELF file\n"); ++ return -1; ++ } ++ ++ if (elf->e_phoff + elf->e_phnum * sizeof(*phdrs) ++ > (unsigned) blocksize) { ++ printf("aboot: ELF program headers not in first block (%ld)\n", ++ (long) elf->e_phoff); ++ return -1; ++ } ++ ++ phdrs = (struct elf_phdr *) (buf + elf->e_phoff); ++ chunks = malloc(sizeof(struct segment) * elf->e_phnum); ++ start_addr = phdrs[0].p_vaddr; /* assume they are sorted */ ++ entry_addr = elf->e_entry; ++ ++ for (i = j = 0; i < elf->e_phnum; ++i) { ++ int status; ++ ++ if (phdrs[i].p_type != PT_LOAD) ++ continue; ++ ++ chunks[j].addr = phdrs[i].p_vaddr; ++ chunks[j].offset = phdrs[i].p_offset; ++ chunks[j].size = phdrs[i].p_filesz; ++ printf("aboot: PHDR %d vaddr %#lx offset %#lx size %#lx\n", ++ i, chunks[j].addr, chunks[j].offset, chunks[j].size); ++ ++ status = check_memory(chunks[j].addr, chunks[j].size); ++ if (status) { ++ printf("aboot: Can't load kernel.\n" ++ " Memory at %lx - %lx (PHDR %i) " ++ "is %s\n", ++ chunks[j].addr, ++ chunks[j].addr + chunks[j].size - 1, ++ i, ++ (status == -ENOMEM) ? ++ "Not Found" : ++ "Busy (Reserved)"); + return -1; + } +- phdrs = (struct elf_phdr *) (buf + elf->e_phoff); +- chunks = malloc(sizeof(struct segment) * elf->e_phnum); +- nchunks = elf->e_phnum; +- start_addr = phdrs[0].p_vaddr; /* assume they are sorted */ +- entry_addr = elf->e_entry; +-#ifdef DEBUG +- printf("aboot: %d program headers, start address %#lx, entry %#lx\n", +- nchunks, start_addr, entry_addr); +-#endif +- for (i = 0; i < elf->e_phnum; ++i) { +- int status; +- +- chunks[i].addr = phdrs[i].p_vaddr; +- chunks[i].offset = phdrs[i].p_offset; +- chunks[i].size = phdrs[i].p_filesz; +-#ifdef DEBUG +- printf("aboot: segment %d vaddr %#lx offset %#lx size %#lx\n", +- i, chunks[i].addr, chunks[i].offset, chunks[i].size); +-#endif +- +-#ifndef TESTING +- status = check_memory(chunks[i].addr, chunks[i].size); +- if (status) { ++ ++ if (phdrs[i].p_memsz > phdrs[i].p_filesz) { ++ if (bss_size > 0) { + printf("aboot: Can't load kernel.\n" +- " Memory at %lx - %lx (chunk %i) " +- "is %s\n", +- chunks[i].addr, +- chunks[i].addr + chunks[i].size - 1, +- i, +- (status == -ENOMEM) ? +- "Not Found" : +- "Busy (Reserved)"); ++ " Multiple BSS segments" ++ " (PHDR %d)\n", i); + return -1; + } +-#endif ++ ++ bss_start = (char *) (phdrs[i].p_vaddr + ++ phdrs[i].p_filesz); ++ bss_size = phdrs[i].p_memsz - phdrs[i].p_filesz; ++ + } +- bss_start = (char *) (phdrs[elf->e_phnum - 1].p_vaddr + +- phdrs[elf->e_phnum - 1].p_filesz); +- bss_size = (phdrs[elf->e_phnum - 1].p_memsz - +- phdrs[elf->e_phnum - 1].p_filesz); +-#ifdef DEBUG +- printf("aboot: bss at 0x%p, size %#lx\n", bss_start, bss_size); +-#endif +- } else { +- /* Fail silently, it might be a compressed file */ +- return -1; ++ ++ j++; + } ++ ++ nchunks = j; ++ printf("aboot: bss at 0x%p, size %#lx\n", bss_start, bss_size); + + return 0; + } + +--- aboot-1.0_pre20040408/aboot.lds ++++ aboot-1.0_pre20040408/aboot.lds +@@ -1,22 +1,25 @@ + OUTPUT_FORMAT("elf64-alpha") + ENTRY(__start) ++PHDRS { kernel PT_LOAD; } + SECTIONS + { + . = 0x20000000; +- .text : { *(.text) } ++ .text : { *(.text) } :kernel + _etext = .; + PROVIDE (etext = .); +- .rodata : { *(.rodata) } +- .data : { *(.data) CONSTRUCTORS } +- .got : { *(.got) } +- .sdata : { *(.sdata) } ++ .rodata : { *(.rodata*) } :kernel ++ .data : { *(.data*) } :kernel ++ .got : { *(.got) } :kernel ++ .sdata : { *(.sdata) } :kernel + _edata = .; + PROVIDE (edata = .); +- .sbss : { *(.sbss) *(.scommon) } +- .bss : { *(.bss) *(COMMON) } ++ .sbss : { *(.sbss) *(.scommon) } :kernel ++ .bss : { *(.bss) *(COMMON) } :kernel + _end = . ; + PROVIDE (end = .); + ++ /DISCARD/ : { *(.eh_frame) } ++ + .mdebug 0 : { *(.mdebug) } + .note 0 : { *(.note) } + .comment 0 : { *(.comment) } + +--- aboot-1.0_pre20040408/cons.c ++++ aboot-1.0_pre20040408/cons.c +@@ -82,7 +81,7 @@ cons_getenv(long index, char *envval, long maxlen) + * allocated on the stack (which guaranteed to by 8 byte + * aligned). + */ +- char * tmp = alloca(maxlen); ++ char tmp[maxlen]; + long len; + + len = dispatch(CCB_GET_ENV, index, tmp, maxlen - 1); + +--- aboot-1.0_pre20040408/disk.c ++++ aboot-1.0_pre20040408/disk.c +@@ -113,7 +113,7 @@ int + load_uncompressed (int fd) + { + long nread, nblocks; +- unsigned char *buf; ++ char *buf; + int i; + + buf = malloc(bfs->blocksize); +@@ -131,7 +131,7 @@ load_uncompressed (int fd) + + for(i = 0; i < 16; i++) { + for (j = 0; j < 16; j++) +- printf("%02X ", buf[j+16*i]); ++ printf("%02X ", (unsigned char) buf[j+16*i]); + for(j = 0; j < 16; j++) { + c = buf[j+16*i]; + printf("%c", (c >= ' ') ? c : ' '); + +--- aboot-1.0_pre20040408/head.S ++++ aboot-1.0_pre20040408/head.S +@@ -19,8 +19,7 @@ __start: + .quad 0,0,0,0,0,0,0,0 + 1: br $27,2f + 2: ldgp $29,0($27) +- lda $27,main_ +- jsr $26,($27),main_ ++ bsr $26,main_ !samegp + call_pal PAL_halt + .end __start + +@@ -170,4 +169,4 @@ run_kernel: + mov $16,$27 + mov $17,$30 + jmp $31,($27) +- .end run_kernel +\ No newline at end of file ++ .end run_kernel diff --git a/sys-boot/aboot/files/aboot-respect-AR.patch b/sys-boot/aboot/files/aboot-respect-AR.patch new file mode 100644 index 000000000000..44e4a2a52063 --- /dev/null +++ b/sys-boot/aboot/files/aboot-respect-AR.patch @@ -0,0 +1,13 @@ +diff --git a/lib/Makefile b/lib/Makefile +index e3a2247..c137b53 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -13,6 +13,6 @@ libaboot.a: vsprintf.o memcpy.o memset.o string.o _setjmp.o \ + __remlu.o +- ar cru $@ $? ++ $(AR) cru $@ $? + else + libaboot.a: isolib.o +- ar cru $@ $? ++ $(AR) cru $@ $? + endif diff --git a/sys-boot/aboot/files/aboot.conf b/sys-boot/aboot/files/aboot.conf new file mode 100644 index 000000000000..02114138e938 --- /dev/null +++ b/sys-boot/aboot/files/aboot.conf @@ -0,0 +1,10 @@ +# +# aboot default configurations +# +0:3/vmlinux.gz ro root=/dev/sda2 +1:3/vmlinux.old.gz ro root=/dev/sda2 +2:3/vmlinux.new.gz ro root=/dev/sda2 +3:3/vmlinux ro root=/dev/sda2 +8:- ro root=/dev/sda2 # fs less boot of raw kernel +9:0/- ro root=/dev/sda2 # fs less boot of (compressed) ECOFF kernel +- diff --git a/sys-boot/aboot/metadata.xml b/sys-boot/aboot/metadata.xml new file mode 100644 index 000000000000..596881e8bc97 --- /dev/null +++ b/sys-boot/aboot/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>alpha@gentoo.org</email> + <name>Alpha architecture team</name> + </maintainer> + <upstream> + <remote-id type="github">mattst88/aboot</remote-id> + <remote-id type="sourceforge">aboot</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/bootcreator/Manifest b/sys-boot/bootcreator/Manifest new file mode 100644 index 000000000000..af7b46ef78d5 --- /dev/null +++ b/sys-boot/bootcreator/Manifest @@ -0,0 +1 @@ +DIST bootcreator-src.tar.gz 18881 BLAKE2B 5f6375b16d7d676c50d0b61aed5706dbe972bb2eff98e3870df58fc03cf00050788ab1f2da12bb37a839c525bdfa926fcccea5638532454704c3c961a4600a59 SHA512 53a17cc6b6ec9eea06b4162f32068d5f6c86ff066cc152e30c346010b197a88f3266315295c90b7123a68e81fb4ee95e4b0b341ef666df2eaa230ac762892d0e diff --git a/sys-boot/bootcreator/bootcreator-1.2-r1.ebuild b/sys-boot/bootcreator/bootcreator-1.2-r1.ebuild new file mode 100644 index 000000000000..3b5ce425244f --- /dev/null +++ b/sys-boot/bootcreator/bootcreator-1.2-r1.ebuild @@ -0,0 +1,27 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="Simple generator for Forth based BootMenu scripts for Pegasos machines" +HOMEPAGE="http://tbs-software.com/morgoth/projects.html" +SRC_URI="http://tbs-software.com/morgoth/files/bootcreator-src.tar.gz" +S=${WORKDIR} + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="-* ppc" + +src_compile() { + emake CC="$(tc-getCC)" +} + +src_install() { + dosbin src/bootcreator + dodoc doc/README + + insinto /etc + newins examples/example.bc bootmenu.example +} diff --git a/sys-boot/bootcreator/metadata.xml b/sys-boot/bootcreator/metadata.xml new file mode 100644 index 000000000000..09592c79ae5d --- /dev/null +++ b/sys-boot/bootcreator/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>ppc@gentoo.org</email> + <name>PowerPC architecture team</name> + </maintainer> +</pkgmetadata> diff --git a/sys-boot/cromwell-bin/Manifest b/sys-boot/cromwell-bin/Manifest new file mode 100644 index 000000000000..4b5a97deb499 --- /dev/null +++ b/sys-boot/cromwell-bin/Manifest @@ -0,0 +1 @@ +DIST cromwell-2.40.tar.gz 541204 BLAKE2B b10db3a636c3638aeac71747f9b217acbeab52d19733c6581c369762ff339fd1eb5e6392be9e409f6e278a72b989ba84d81f000f6e1ff2d5ade00b6ce75f7d91 SHA512 492441ea24f8b17b3de2c896b03d823d7a97eac85c07768ea4490c0351c71e80f697caf8b469852213763b8a38a058475f8b78f51523197d10a006deaf461f24 diff --git a/sys-boot/cromwell-bin/cromwell-bin-2.40-r2.ebuild b/sys-boot/cromwell-bin/cromwell-bin-2.40-r2.ebuild new file mode 100644 index 000000000000..5613715edf70 --- /dev/null +++ b/sys-boot/cromwell-bin/cromwell-bin-2.40-r2.ebuild @@ -0,0 +1,21 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot + +DESCRIPTION="Xbox boot loader precompiled binaries from xbox-linux.org" +HOMEPAGE="https://sourceforge.net/projects/xbox-linux/" +SRC_URI="https://downloads.sourceforge.net/xbox-linux/cromwell-${PV}.tar.gz" +S="${WORKDIR}/cromwell-${PV}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* x86" +RESTRICT="${RESTRICT} strip" + +src_install() { + insinto /boot/${PN} + doins cromwell{,_1024}.bin xromwell.xbe +} diff --git a/sys-boot/cromwell-bin/metadata.xml b/sys-boot/cromwell-bin/metadata.xml new file mode 100644 index 000000000000..792d8cf8e70d --- /dev/null +++ b/sys-boot/cromwell-bin/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <remote-id type="sourceforge">xbox-linux</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/customrescuecd-x86_64-grub/customrescuecd-x86_64-grub-0.1.ebuild b/sys-boot/customrescuecd-x86_64-grub/customrescuecd-x86_64-grub-0.1.ebuild new file mode 100644 index 000000000000..8c86237c659d --- /dev/null +++ b/sys-boot/customrescuecd-x86_64-grub/customrescuecd-x86_64-grub-0.1.ebuild @@ -0,0 +1,30 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="Grub menu entries for the .iso image of customrescuecd" +HOMEPAGE="https://sourceforge.net/projects/customrescuecd/" + +S="${WORKDIR}" + +LICENSE="GPL-2" +SLOT=0 +KEYWORDS="~amd64" + +RDEPEND="app-admin/customrescuecd-x86_64 + sys-boot/grub" + +src_install() { + exeinto /etc/grub.d + newexe "${FILESDIR}"/customrescuecd.grub 39_customrescuecd + + insinto /etc/default + newins "${FILESDIR}"/customrescuecd.default customrescuecd +} + +pkg_postinst() { + elog "To add the menu entries for customrescuecd to grub, you should now run" + elog " grub-mkconfig -o /boot/grub/grub.cfg" + elog "You can set custom bootoptions in /etc/default/customrescuecd" +} diff --git a/sys-boot/customrescuecd-x86_64-grub/files/customrescuecd.default b/sys-boot/customrescuecd-x86_64-grub/files/customrescuecd.default new file mode 100644 index 000000000000..4392c3337a67 --- /dev/null +++ b/sys-boot/customrescuecd-x86_64-grub/files/customrescuecd.default @@ -0,0 +1,7 @@ +Here you can set custom bootoptions for the CustomRescueCD +# +# You can add for example in a space separated list: +# copytoram: causes the iso file to be fully loaded into memory +# this requires 1.5GB of memory to cache everything + +CRCD_BOOTOPTIONS="" diff --git a/sys-boot/customrescuecd-x86_64-grub/files/customrescuecd.grub b/sys-boot/customrescuecd-x86_64-grub/files/customrescuecd.grub new file mode 100644 index 000000000000..6e84cee6b4c0 --- /dev/null +++ b/sys-boot/customrescuecd-x86_64-grub/files/customrescuecd.grub @@ -0,0 +1,43 @@ +#!/bin/sh +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +. /usr/share/grub/grub-mkconfig_lib + +if [ -r /etc/default/customrescuecd ] ; then + . /etc/default/customrescuecd +fi + +# crcd = path of newest link to iso of customrescuecd, created by the ebuild +# of customrescuecd-x86_64 + +crcd="/usr/share/systemrescuecd/systemrescuecd-x86_64-newest.iso" + +longname="CustomRescueCD" +bootops=")" + +if [ ! -z "${CRCD_BOOTOPTIONS}" ]; then + bootops=" with bootoptions)" +fi + +if [ -f "${crcd}" ]; then + + device=$(${grub_probe} --target=device "${crcd}") + path=$(make_system_path_relative_to_its_root "${crcd}") + grub_string=$(prepare_grub_to_access_device "${device}" | grub_add_tab | grub_add_tab) + + gettext_printf "Found %s on %s\n" "${longname}" "${device}" >&2 + onstr=$(gettext_printf "(on %s)" "${device}") + + cat << EOF +submenu "${longname}" --class submenu { + menuentry "${longname} (64bit ${bootops}" --class rescue { +${grub_string} + set isofile=${path} + loopback loop \${isofile} + linux (loop)/boot/x86_64/customrescue64 ${CRCD_BOOTOPTIONS} customisobasedir=customresccd customisolabel=CRC64 vga=791 net.ifnames=0 + } +} +EOF + +fi diff --git a/sys-boot/customrescuecd-x86_64-grub/metadata.xml b/sys-boot/customrescuecd-x86_64-grub/metadata.xml new file mode 100644 index 000000000000..e8f15959abf5 --- /dev/null +++ b/sys-boot/customrescuecd-x86_64-grub/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>andrea.postiglione@gmail.com</email> + <name>Andrea Postiglione</name> + </maintainer> + <longdescription lang="en"> + This package adds menu entries in GRUB for the CustomRescueCD. You can + add custom bootoptions for CustomRescueCD in a special config file. + </longdescription> + <upstream> + <remote-id type="sourceforge">customrescuecd</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/drbl/Manifest b/sys-boot/drbl/Manifest new file mode 100644 index 000000000000..702a74086051 --- /dev/null +++ b/sys-boot/drbl/Manifest @@ -0,0 +1 @@ +DIST drbl-5.4.2.tar.gz 2150559 BLAKE2B d6d0741808d0308914b364a32a1d8f77039705a90c0b0d2c79cabddacd41a83eb0afa30893e485f6624fba43880c2f7332d6ce9fcc324f66ecdb1c4b73b50521 SHA512 5b1fbb3696fbd2437c7b19f2d9db5cf64183e611efd924f0896cc7d0c667fbfd3eb1f5175282661ae47aa49b6b7fb002f2b7a5cab684f8e887bc52bc19fbf84c diff --git a/sys-boot/drbl/drbl-5.4.2.ebuild b/sys-boot/drbl/drbl-5.4.2.ebuild new file mode 100644 index 000000000000..9bd9aac19a49 --- /dev/null +++ b/sys-boot/drbl/drbl-5.4.2.ebuild @@ -0,0 +1,20 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Diskless Remote Boot in Linux" +HOMEPAGE="https://drbl.org" +SRC_URI="https://github.com/stevenshiau/drbl/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND=" + net-misc/ipcalc + sys-devel/bc + sys-fs/e2fsprogs + net-misc/wakeonlan +" +BDEPEND="app-editors/vim-core" diff --git a/sys-boot/drbl/metadata.xml b/sys-boot/drbl/metadata.xml new file mode 100644 index 000000000000..4d88a0684381 --- /dev/null +++ b/sys-boot/drbl/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <remote-id type="github">stevenshiau/drbl</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/dvhtool/Manifest b/sys-boot/dvhtool/Manifest new file mode 100644 index 000000000000..3c6f389ba248 --- /dev/null +++ b/sys-boot/dvhtool/Manifest @@ -0,0 +1 @@ +DIST dvhtool_1.0.1.orig.tar.gz 53283 BLAKE2B 7268d3bda57988ab9432d88c3c220a450a4726fd5b2560315e731b50d9088f66821a2629f7d0059305c880e429b77f40f609ea0798d362fb7b5831002a453967 SHA512 e81c4427f98a7aa79b9e8cee6fad35822d5fa48fda17f656407d1d6de50658ff2c8b6c3a890ae07afafebf126b5388c98ebf63af4a93bf1091161a27ea09d140 diff --git a/sys-boot/dvhtool/dvhtool-1.0.1-r2.ebuild b/sys-boot/dvhtool/dvhtool-1.0.1-r2.ebuild new file mode 100644 index 000000000000..86fe693b70db --- /dev/null +++ b/sys-boot/dvhtool/dvhtool-1.0.1-r2.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools toolchain-funcs + +DESCRIPTION="Tool to copy kernel(s) into the volume header on SGI MIPS-based workstations" +HOMEPAGE="http://packages.debian.org/unstable/utils/dvhtool" +SRC_URI="mirror://debian/pool/main/d/dvhtool/dvhtool_${PV}.orig.tar.gz" +S="${S}.orig" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~mips ~x86" + +PATCHES=( + "${FILESDIR}/${P}-debian.diff" + "${FILESDIR}/${P}-debian-warn_type_guess.diff" + "${FILESDIR}/${P}-debian-xopen_source.diff" + "${FILESDIR}/${P}-add-raid-lvm-parttypes.patch" +) + +src_prepare() { + default + + # Fix automake warning + mv configure.{in,ac} || die + + eautoreconf +} + +src_configure() { + CC="$(tc-getCC)" LD="$(tc-getLD)" \ + econf +} + +src_compile() { + CC="$(tc-getCC)" LD="$(tc-getLD)" \ + emake +} diff --git a/sys-boot/dvhtool/files/dvhtool-1.0.1-add-raid-lvm-parttypes.patch b/sys-boot/dvhtool/files/dvhtool-1.0.1-add-raid-lvm-parttypes.patch new file mode 100644 index 000000000000..2a3cd753252b --- /dev/null +++ b/sys-boot/dvhtool/files/dvhtool-1.0.1-add-raid-lvm-parttypes.patch @@ -0,0 +1,24 @@ +diff -Naurp dvhtool-1.0.1.orig-A/dvh.h dvhtool-1.0.1.orig/dvh.h +--- dvhtool-1.0.1.orig-A/dvh.h 2005-09-28 02:45:56 -0400 ++++ dvhtool-1.0.1.orig/dvh.h 2005-09-28 02:41:15 -0400 +@@ -129,6 +129,8 @@ struct partition_table { /* one per log + #define PTYPE_XVM 13 /* partition is sgi XVM */ + #define PTYPE_LSWAP 0x82 /* partition is Linux swap */ + #define PTYPE_LINUX 0x83 /* partition is Linux native */ ++#define PTYPE_LLVM 0x8e /* partition is Linux LVM */ ++#define PTYPE_LRAID 0xfd /* partition is Linux RAID */ + #define NPTYPES 16 + + #define VHMAGIC 0xbe5a941 /* randomly chosen value */ +diff -Naurp dvhtool-1.0.1.orig-A/dvhlib.c dvhtool-1.0.1.orig/dvhlib.c +--- dvhtool-1.0.1.orig-A/dvhlib.c 2005-09-28 02:45:56 -0400 ++++ dvhtool-1.0.1.orig/dvhlib.c 2005-09-28 02:41:45 -0400 +@@ -52,6 +52,8 @@ ptype2str(int ptype) + case PTYPE_XVM: return "XVM Volume"; + case PTYPE_LSWAP: return "Linux Swap"; + case PTYPE_LINUX: return "Linux Native"; ++ case PTYPE_LLVM: return "Linux LVM"; ++ case PTYPE_LRAID: return "Linux RAID"; + } + return "Unknown Partition Type"; + } diff --git a/sys-boot/dvhtool/files/dvhtool-1.0.1-debian-warn_type_guess.diff b/sys-boot/dvhtool/files/dvhtool-1.0.1-debian-warn_type_guess.diff new file mode 100644 index 000000000000..bab2a305be92 --- /dev/null +++ b/sys-boot/dvhtool/files/dvhtool-1.0.1-debian-warn_type_guess.diff @@ -0,0 +1,12 @@ +--- a/dvhlib.h ++++ b/dvhlib.h +@@ -3,7 +3,8 @@ #include "config.h" + #ifdef HAVE_INTTYPES_H + #include <inttypes.h> + #else +-typedef unsigned int uint32_t; /* A guess ... */ ++ #warning Guessing type of uint32_t ++ typedef unsigned int uint32_t; /* A guess ... */ + #endif + + #include "dvh.h" diff --git a/sys-boot/dvhtool/files/dvhtool-1.0.1-debian-xopen_source.diff b/sys-boot/dvhtool/files/dvhtool-1.0.1-debian-xopen_source.diff new file mode 100644 index 000000000000..333eb2a74064 --- /dev/null +++ b/sys-boot/dvhtool/files/dvhtool-1.0.1-debian-xopen_source.diff @@ -0,0 +1,11 @@ +diff --git a/dvhlib.c b/dvhlib.c +--- a/dvhlib.c ++++ b/dvhlib.c +@@ -1,6 +1,7 @@ + /* + * Disk Volume Header Library + */ ++#define _XOPEN_SOURCE 500 + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/sys-boot/dvhtool/files/dvhtool-1.0.1-debian.diff b/sys-boot/dvhtool/files/dvhtool-1.0.1-debian.diff new file mode 100644 index 000000000000..43f33ffc2596 --- /dev/null +++ b/sys-boot/dvhtool/files/dvhtool-1.0.1-debian.diff @@ -0,0 +1,135 @@ +--- dvhtool-1.0.1.orig/dvh.h ++++ dvhtool-1.0.1/dvh.h +@@ -127,6 +127,8 @@ + #define PTYPE_XFSLOG 11 /* partition is sgi XFS log */ + #define PTYPE_XLV 12 /* partition is part of an XLV vol */ + #define PTYPE_XVM 13 /* partition is sgi XVM */ ++#define PTYPE_LSWAP 0x82 /* partition is Linux swap */ ++#define PTYPE_LINUX 0x83 /* partition is Linux native */ + #define NPTYPES 16 + + #define VHMAGIC 0xbe5a941 /* randomly chosen value */ +--- dvhtool-1.0.1.orig/dvhlib.c ++++ dvhtool-1.0.1/dvhlib.c +@@ -50,6 +50,8 @@ + case PTYPE_XFSLOG: return "XFS Log"; + case PTYPE_XLV: return "XLV Volume"; + case PTYPE_XVM: return "XVM Volume"; ++ case PTYPE_LSWAP: return "Linux Swap"; ++ case PTYPE_LINUX: return "Linux Native"; + } + return "Unknown Partition Type"; + } +@@ -325,8 +327,10 @@ + if (res == -1) + die("Couldn't stat source file"); + +- /* XXX pad to blocksize? */ +- size = vh->vh_pt[8].pt_nblks * blksize - istat.st_size; ++ /* calculate free blocks in vh */ ++ size = vh->vh_pt[8].pt_nblks /* total vh size */ ++ - ( vh->vh_pt[8].pt_firstlbn + 4 ) /* reserved area */ ++ - (( istat.st_size + blksize - 1 ) / blksize ); /* pad to blocksize */ + /* + * Are we replacing an existing file, check for enough space and free + * entry in volume header +@@ -336,16 +340,15 @@ + /* It's an existing file, delete it. */ + memset(vd->vd_name, 0, VDNAMESIZE); + vd->vd_nbytes = 0; +- break; + } + if ( vd->vd_nbytes ) { +- size -= vd->vd_nbytes; ++ size -= (vd->vd_nbytes + blksize - 1 ) / blksize; /* pad to blocksize */ + num++; + } + vd++; + } + +- if ( num == NVDIR ) ++ if ( num == NVDIR ) + die("No more free entries in volume header"); + if ( size <= 0 ) + die("Not enough space left in volume header"); +@@ -403,7 +406,7 @@ + die("Short write"); + } + } +- dest += (vd->vd_nbytes + 511) / 512; /* XXX Blocksize */ ++ dest += (vd->vd_nbytes + blksize - 1) / blksize; + vd++; + } + +--- dvhtool-1.0.1.orig/dvhtool.8 ++++ dvhtool-1.0.1/dvhtool.8 +@@ -1,4 +1,4 @@ +-.TH DVHTOOL 1 "July 2000" ++.TH DVHTOOL 8 "July 2000" + .UC 4 + .SH NAME + dvhtool \- Disk volume header manipulation tool +@@ -85,4 +85,4 @@ + .PP + .I dvhtool + was written by Ralf Baechle <ralf@oss.sgi.com>, Keith M. Wesolowski <wesolows@foobazco.org>, +-Tor Arntsen <tor@spacetec.no>, Guido Guenther <guido.guenther@gmx.net>. ++Tor Arntsen <tor@spacetec.no>, Guido Guenther <agx@debian.org>. +--- dvhtool-1.0.1.orig/Makefile.in ++++ dvhtool-1.0.1/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4a from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -46,10 +46,9 @@ + AUTOHEADER = @AUTOHEADER@ + + INSTALL = @INSTALL@ +-INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ +-INSTALL_STRIP_FLAG = + transform = @program_transform_name@ + + NORMAL_INSTALL = : +@@ -104,7 +103,7 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + DEP_FILES = .deps/dvhlib.P .deps/dvhtool.P .deps/getopt.P \ + .deps/getopt1.P .deps/pread.P +@@ -124,7 +123,7 @@ + $(ACLOCAL_M4): configure.in acinclude.m4 + cd $(srcdir) && $(ACLOCAL) + +-config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) +@@ -173,8 +172,8 @@ + $(mkinstalldirs) $(DESTDIR)$(sbindir) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ +- echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ +- $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ ++ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ ++ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +@@ -382,7 +381,7 @@ + all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) config.h + all-redirect: all-am + install-strip: +- $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install ++ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install + installdirs: + $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 + diff --git a/sys-boot/dvhtool/metadata.xml b/sys-boot/dvhtool/metadata.xml new file mode 100644 index 000000000000..3325920484ba --- /dev/null +++ b/sys-boot/dvhtool/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>mips@gentoo.org</email> + <name>MIPS architecture team</name> + </maintainer> +</pkgmetadata> diff --git a/sys-boot/efibootmgr/Manifest b/sys-boot/efibootmgr/Manifest new file mode 100644 index 000000000000..07d8e0fab978 --- /dev/null +++ b/sys-boot/efibootmgr/Manifest @@ -0,0 +1,2 @@ +DIST efibootmgr-17.tar.gz 41643 BLAKE2B a1995a5df74766f762d2eb971fd6095edea8d0a498c9dd1100515866b40c38ae2f299aae51f12767850ec23fbe4709c2c7428dd48755fbec499669b69f6432c9 SHA512 10c7ad9a79f23dcd4708dc4f42701196af7aa11f5e9a6468ea51f7013d4caeba6c92527ba1304f6e3b2ef3b51b3b69ea1a30f81bb099a8aea49eeb30eb631e1d +DIST efibootmgr-18.tar.gz 45220 BLAKE2B 6bc3f39ee395d2045e78b19876fd9404ba41443259e9ad7446671d768a63dc1418d5a192600392fd95251159d80479008a2c22b4cd503bba2f4a869850cb3652 SHA512 04e40a705cb82440fd823043b598ef9fd1acc2ceda3e8d043a93e49d43ea9481b7386cad0f46de9862beff19b8a5480d79e7d6522ae584aff6655472f967764d diff --git a/sys-boot/efibootmgr/efibootmgr-17-r1.ebuild b/sys-boot/efibootmgr/efibootmgr-17-r1.ebuild new file mode 100644 index 000000000000..2bbe95968795 --- /dev/null +++ b/sys-boot/efibootmgr/efibootmgr-17-r1.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit toolchain-funcs + +DESCRIPTION="User-space application to modify the EFI boot manager" +HOMEPAGE="https://github.com/rhinstaller/efibootmgr" +SRC_URI="https://github.com/rhboot/efibootmgr/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 ~arm arm64 ~loong ~riscv x86" + +RDEPEND=" + dev-libs/popt + sys-apps/pciutils + >=sys-libs/efivar-37:= +" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}/${P}-fix-efivar-37-conflict.patch" + "${FILESDIR}/${P}-clang.patch" +) + +src_prepare() { + default + sed -i 's/-Werror //' Make.defaults || die +} + +src_configure() { + tc-export CC + export EFIDIR="Gentoo" +} + +src_compile() { + emake PKG_CONFIG="$(tc-getPKG_CONFIG)" +} diff --git a/sys-boot/efibootmgr/efibootmgr-18-r2.ebuild b/sys-boot/efibootmgr/efibootmgr-18-r2.ebuild new file mode 100644 index 000000000000..c2d815de8d80 --- /dev/null +++ b/sys-boot/efibootmgr/efibootmgr-18-r2.ebuild @@ -0,0 +1,40 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="User-space application to modify the EFI boot manager" +HOMEPAGE="https://github.com/rhinstaller/efibootmgr" +SRC_URI="https://github.com/rhboot/efibootmgr/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm arm64 ~loong ~riscv x86" + +RDEPEND=" + dev-libs/popt + sys-apps/pciutils + >=sys-libs/efivar-37:= +" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}"/efibootmgr-18-backports.patch +) + +src_prepare() { + default + sed -i 's/-Werror //' Make.defaults || die +} + +src_configure() { + tc-export CC + export EFIDIR="Gentoo" +} + +src_compile() { + emake PKG_CONFIG="$(tc-getPKG_CONFIG)" +} diff --git a/sys-boot/efibootmgr/files/efibootmgr-17-clang.patch b/sys-boot/efibootmgr/files/efibootmgr-17-clang.patch new file mode 100644 index 000000000000..687b294c3339 --- /dev/null +++ b/sys-boot/efibootmgr/files/efibootmgr-17-clang.patch @@ -0,0 +1,82 @@ +From 97668ae0bce776a36ea2001dea63d376be8274ac Mon Sep 17 00:00:00 2001 +From: Peter Jones <pjones@redhat.com> +Date: Wed, 6 Mar 2019 13:08:33 -0500 +Subject: [PATCH] Make sure PKGS= is propogated into the submake for "make + deps" + +When we're doing make deps with "$(CC) -MF", gcc and clang have different +behavior, both broken in different ways, which we're hitting because of a +missing -I argument for libefivar's includes. On clang, when a header can't +be found, it emits a rule with the header as a prerequisite without a path, +such as efivar.h here: + +efibootmgr.o: efibootmgr.c fix_coverity.h efivar.h efiboot.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/list.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/unparse_path.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efibootmgr.h \ + error.h + +Then the build that utilizes that rule will fail to find the +prerequisite and tell you something like: + +make[1]: *** No rule to make target 'efivar.h', needed by 'efibootmgr.o'. Stop. +make[1]: Leaving directory '/home/pjones/devel/github.com/efibootmgr/master/src' + +With gcc, when a header can't be found, it emits a rule without that header +as a prerequisite, as such (again with efivar.h): + +efibootmgr.o: efibootmgr.c fix_coverity.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/list.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/unparse_path.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efibootmgr.h \ + error.h + +And then your build will fail if you haven't adjusted CFLAGS to tell it +where to find the header. + +Both of these would be better just erroring, but at least gcc's doesn't +insert a *wrong* dependency. + +This patch adds "PKGS=efivar efibootmgr popt" for all deps under src/. +Technically that's overkill, as efibootmgr itself doesn't need popt, but it +doesn't hurt anything to have the extra part there. The resulting +.efibootmgr.d file has the prerequisites expressed correctly: + +efibootmgr.o: efibootmgr.c fix_coverity.h /usr/include/efivar/efivar.h \ + /usr/include/efivar/efiboot.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/list.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/unparse_path.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \ + /home/pjones/devel/github.com/efibootmgr/master/src/include/efibootmgr.h \ + error.h + +This fixes the issue described in github PR #96 + +Signed-off-by: Peter Jones <pjones@redhat.com> +--- + src/Makefile | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/Makefile b/src/Makefile +index 258bac1..32fa188 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -31,8 +31,13 @@ efibootdump : PKGS=efivar efiboot popt + efibootnext : $(call objects-of,$(EFIBOOTNEXT_SOURCES)) + efibootnext : PKGS=efivar efiboot popt + ++deps : PKGS=efivar efiboot popt + deps : $(ALL_SOURCES) +- $(MAKE) -f $(TOPDIR)/Make.deps deps SOURCES="$(ALL_SOURCES)" SUBDIR_CFLAGS="$(SUBDIR_CFLAGS)" ++ $(MAKE) -f $(TOPDIR)/Make.deps \ ++ SOURCES="$(ALL_SOURCES)" \ ++ SUBDIR_CFLAGS="$(SUBDIR_CFLAGS)" \ ++ PKGS="$(PKGS)" \ ++ deps + + clean : + @rm -rfv *.o *.a *.so $(TARGETS) diff --git a/sys-boot/efibootmgr/files/efibootmgr-17-fix-efivar-37-conflict.patch b/sys-boot/efibootmgr/files/efibootmgr-17-fix-efivar-37-conflict.patch new file mode 100644 index 000000000000..614195f3c99d --- /dev/null +++ b/sys-boot/efibootmgr/files/efibootmgr-17-fix-efivar-37-conflict.patch @@ -0,0 +1,14 @@ +diff --git a/src/efibootmgr.c b/src/efibootmgr.c +index de38f01..4e1a680 100644 +--- a/src/efibootmgr.c ++++ b/src/efibootmgr.c +@@ -1536,9 +1536,6 @@ parse_opts(int argc, char **argv) + "invalid numeric value %s\n", + optarg); + } +- /* XXX efivar-36 accidentally doesn't have a public +- * header for this */ +- extern int efi_set_verbose(int verbosity, FILE *errlog); + efi_set_verbose(opts.verbose - 2, stderr); + break; + case 'V': diff --git a/sys-boot/efibootmgr/files/efibootmgr-18-backports.patch b/sys-boot/efibootmgr/files/efibootmgr-18-backports.patch new file mode 100644 index 000000000000..70422efd1165 --- /dev/null +++ b/sys-boot/efibootmgr/files/efibootmgr-18-backports.patch @@ -0,0 +1,76 @@ +From dcd232d0458b962627f727dc8a1cef3c000a5bf4 Mon Sep 17 00:00:00 2001 +From: kmicki <1463619+kmicki@users.noreply.github.com> +Date: Tue, 15 Nov 2022 14:37:25 +0100 +Subject: [PATCH] Update efibootmgr.c + +get_entry: return entry if it was found before reaching the end of the list + +Signed-off-by: kmicki <1463619+kmicki@users.noreply.github.com> +--- + src/efibootmgr.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/efibootmgr.c b/src/efibootmgr.c +index b980bcd..4b15d6d 100644 +--- a/src/efibootmgr.c ++++ b/src/efibootmgr.c +@@ -1192,6 +1192,7 @@ get_entry(list_t *entries, uint16_t num) + entry = NULL; + continue; + } ++ return entry; + } + + return entry; +From c2ef7876f4cc0ad5a52f40577e7636a841100bec Mon Sep 17 00:00:00 2001 +From: kamillo <kamilgolunski@gmail.com> +Date: Fri, 17 Feb 2023 21:55:17 +0100 +Subject: [PATCH 1/2] Add missing short option handling for --index (-I) + +Signed-off-by: kamillo <kamilgolunski@gmail.com> +--- + src/efibootmgr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/efibootmgr.c b/src/efibootmgr.c +index 4b15d6d..255f61f 100644 +--- a/src/efibootmgr.c ++++ b/src/efibootmgr.c +@@ -1509,7 +1509,7 @@ parse_opts(int argc, char **argv) + }; + + c = getopt_long(argc, argv, +- "aAb:BcCd:De:E:fFgi:kl:L:m:M:n:No:Op:qrt:Tuv::Vwy@:h", ++ "aAb:BcCd:De:E:fFgi:I:kl:L:m:M:n:No:Op:qrt:Tuv::Vwy@:h", + long_options, &option_index); + if (c == -1) + break; + +From fe0a2c9569bd22e51000081226998419cb07c6ce Mon Sep 17 00:00:00 2001 +From: kamillo <kamilgolunski@gmail.com> +Date: Fri, 17 Feb 2023 22:02:22 +0100 +Subject: [PATCH 2/2] Fix segfault when passed --index is greater than current + boot order size + +Size of the order entry size (uint16_t) hasn't been taken into account for all calculations and caused memory corruption. + +Signed-off-by: kamillo <kamilgolunski@gmail.com> +--- + src/efibootmgr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/efibootmgr.c b/src/efibootmgr.c +index 255f61f..ded21a1 100644 +--- a/src/efibootmgr.c ++++ b/src/efibootmgr.c +@@ -420,8 +420,8 @@ add_to_order(const char *name, uint16_t num, uint16_t insert_at) + return -1; + + if (insert_at != 0) { +- if (insert_at > order->data_size) +- insert_at = order->data_size; ++ if (insert_at * sizeof(uint16_t) > order->data_size) ++ insert_at = order->data_size / sizeof(uint16_t); + memcpy(new_data, old_data, insert_at * sizeof(uint16_t)); + } + new_data[insert_at] = num; diff --git a/sys-boot/efibootmgr/metadata.xml b/sys-boot/efibootmgr/metadata.xml new file mode 100644 index 000000000000..9414143fc014 --- /dev/null +++ b/sys-boot/efibootmgr/metadata.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>floppym@gentoo.org</email> + <name>Mike Gilbert</name> + </maintainer> + <longdescription> + This is efibootmgr, a Linux user-space application to modify the Intel + Extensible Firmware Interface (EFI) Boot Manager. This application + can create and destroy boot entries, change the boot order, change + the next running boot option, and more. + </longdescription> + <upstream> + <remote-id type="github">rhinstaller/efibootmgr</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/elilo/Manifest b/sys-boot/elilo/Manifest new file mode 100644 index 000000000000..41b5e2e78a3e --- /dev/null +++ b/sys-boot/elilo/Manifest @@ -0,0 +1,2 @@ +DIST elilo-3.16-all.tar.gz 485844 BLAKE2B 813762ffef32a640c074973a07d886e0de137be10ff08e9375cd894b0d83dd8bc96cc33f80da1e698db49cc9f105a905abb2fa04048eaca394d3d70e79cb8534 SHA512 4289b45f2e40b2a12167f2efd9a482cf97baedb13fc24813f360f375296d0d3f107d6c980b4b31262816f664a2536353fa124e689cbd65093da9b16fdddaf842 +DIST elilo_3.14-3.debian.tar.gz 32179 BLAKE2B 84f8055d3e33b99ce91079768da80a8800c3c2f569ce5619641a983efb943055dfd9a8fb2fda8e5e6d60009ffefbcc1573098f022f06635d4d5304bc3bfddf1e SHA512 b2d5927bf84d61cc432fc916301ddb3be74db16d3e5ba4f13039e2925606b8870991fbb17f837005d8f2b655b7dcd2b2311dfacd7f02183762caf7081ede638f diff --git a/sys-boot/elilo/elilo-3.16-r6.ebuild b/sys-boot/elilo/elilo-3.16-r6.ebuild new file mode 100644 index 000000000000..e4363db96609 --- /dev/null +++ b/sys-boot/elilo/elilo-3.16-r6.ebuild @@ -0,0 +1,94 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit secureboot toolchain-funcs + +DESCRIPTION="Linux boot loader for EFI-based systems such as IA-64" +HOMEPAGE="https://sourceforge.net/projects/elilo/" +SRC_URI="https://downloads.sourceforge.net/elilo/${P}-all.tar.gz + mirror://debian/pool/main/e/elilo/elilo_3.14-3.debian.tar.gz" +S="${WORKDIR}/${P}-source" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +# gnu-efi contains only static libs, so there's no run-time dep on it +DEPEND=">=sys-boot/gnu-efi-3.0g + dev-util/patchutils" +# dosfstools[compat] to enable 'dosfsck' symlink +RDEPEND="sys-boot/efibootmgr + sys-fs/dosfstools[compat]" + +PATCHES=( + "${FILESDIR}"/${PN}-3.16-elilo-loop.patch #299665 + "${FILESDIR}"/${PN}-3.16-gnu-efi-3.0.6-ia64.patch + "${FILESDIR}"/${PN}-3.16-strncpy-clash.patch + "${FILESDIR}"/${PN}-3.16-FLAGS.patch + "${FILESDIR}"/${PN}-3.16-ARCH.patch +) + +src_unpack() { + unpack ${A} ./${P}-source.tar.gz + mv debian "${S}"/ || die +} + +src_prepare() { + default + + case $(tc-arch) in + ia64) iarch=ia64 ;; + x86) iarch=ia32 ;; + amd64) iarch=x86_64 ;; + *) die "unknown architecture: $(tc-arch)" ;; + esac + + # Now Gentooize it. + sed -i \ + -e '1s:/bin/sh:/bin/bash:' \ + -e "s:##VERSION##:${PV}:" \ + -e 's:Debian GNU/:Gentoo :g' \ + -e 's:Debian:Gentoo:g' \ + -e 's:debian:gentoo:g' \ + -e "s:dpkg --print-architecture:echo ${iarch}:" \ + debian/elilo.sh || die +} + +src_compile() { + # "prefix" on the next line specifies where to find gcc, as, ld, + # etc. It's not the usual meaning of "prefix". By blanking it we + # allow PATH to be searched. + local libdir="${ESYSROOT}/usr/$(get_libdir)" + emake -j1 \ + prefix= \ + AS="$(tc-getAS)" \ + CC="$(tc-getCC)" \ + LD="$(tc-getLD)" \ + OBJCOPY="$(tc-getOBJCOPY)" \ + HOSTARCH=${iarch} \ + ARCH=${iarch} \ + EFIINC="${ESYSROOT}/usr/include/efi" \ + GNUEFILIB="${libdir}" \ + EFILIB="${libdir}" \ + EFICRT0="${libdir}" \ + NATIVE_CFLAGS="${CFLAGS}" \ + NATIVE_LDFLAGS="${LDFLAGS}" +} + +src_install() { + exeinto /usr/lib/elilo + doexe elilo.efi + + newsbin debian/elilo.sh elilo + dosbin tools/eliloalt + + insinto /etc + newins "${FILESDIR}"/elilo.conf.sample elilo.conf + + dodoc docs/* "${FILESDIR}"/elilo.conf.sample + doman debian/*.[0-9] + + secureboot_auto_sign --in-place +} diff --git a/sys-boot/elilo/files/elilo-3.16-ARCH.patch b/sys-boot/elilo/files/elilo-3.16-ARCH.patch new file mode 100644 index 000000000000..935cf7adbe4e --- /dev/null +++ b/sys-boot/elilo/files/elilo-3.16-ARCH.patch @@ -0,0 +1,12 @@ +Allow for easier override from make's commandline. +--- a/Make.defaults ++++ b/Make.defaults +@@ -64,7 +64,7 @@ TOPDIR = + ALLSUBDIRS = ia32 ia64 x86_64 fs choosers devschemes tools + + HOSTARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH | sed s,i[3456789]86,ia32, | sed s,amd64,x86_64, ) +-ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH | sed s,i[3456789]86,ia32, | sed s,amd64,x86_64, ) ++ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH | sed s,i[3456789]86,ia32, | sed s,amd64,x86_64, ) + INCDIR = -I. -I$(TOPDIR) -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -I$(TOPDIR)/efi110 + CPPFLAGS = -DCONFIG_$(ARCH) + diff --git a/sys-boot/elilo/files/elilo-3.16-FLAGS.patch b/sys-boot/elilo/files/elilo-3.16-FLAGS.patch new file mode 100644 index 000000000000..a77e44d0b186 --- /dev/null +++ b/sys-boot/elilo/files/elilo-3.16-FLAGS.patch @@ -0,0 +1,19 @@ +eliloalt is a rare native tool. Allow user to explicitly pass +standart optimization flags via + $ make NATIIVE_CFLAGS=${CFLAGS} NATIVE_LDFLAGS +https://bugs.gentoo.org/744931 +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -42,10 +42,10 @@ all: $(TARGET) + # redefine local rule (we build a Linux/ia64 binary here) + # + %.o: %.c +- $(CC) $(OPTIMFLAGS) $(DEBUGFLAGS) -c $< -o $@ ++ $(CC) $(OPTIMFLAGS) $(NATIVE_CFLAGS) $(DEBUGFLAGS) -c $< -o $@ + + $(TARGET): %:%.o +- $(CC) -o $@ $(OPTIMFLAGS) $(DEBUGFLAGS) $^ ++ $(CC) -o $@ $(OPTIMFLAGS) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $(DEBUGFLAGS) $^ + + clean: + $(RM) -f $(TARGET) $(FILES) diff --git a/sys-boot/elilo/files/elilo-3.16-elilo-loop.patch b/sys-boot/elilo/files/elilo-3.16-elilo-loop.patch new file mode 100644 index 000000000000..b574c29f220b --- /dev/null +++ b/sys-boot/elilo/files/elilo-3.16-elilo-loop.patch @@ -0,0 +1,15 @@ +https://bugs.gentoo.org/299665 + +patch by Dennis Schridde <devurandom@gmx.net> + +--- a/debian/elilo.sh ++++ b/debian/elilo.sh +@@ -321,6 +321,8 @@ + + mnt() + { ++ local loop ++ + ## we can even create bootstrap filesystem images directly if you + ## ever wanted too. + if [ -f "$boot" ] ; then diff --git a/sys-boot/elilo/files/elilo-3.16-gnu-efi-3.0.6-ia64.patch b/sys-boot/elilo/files/elilo-3.16-gnu-efi-3.0.6-ia64.patch new file mode 100644 index 000000000000..21f10f316441 --- /dev/null +++ b/sys-boot/elilo/files/elilo-3.16-gnu-efi-3.0.6-ia64.patch @@ -0,0 +1,112 @@ +Disambiguate setpjmp()/longjmp()/jmp_buf across elilo copy and gnu-efi-3.0.6. + +In order not to chang the behaviour I'm keeping elilo's implementation +as the jmp_buf passing ABI is slightly different scross the two. + + setjmp.h:25:14: error: conflicting types for 'jmp_buf' + typedef long jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */ + ^~~~~~~ + In file included from /usr/include/efi/efisetjmp.h:5:0, + from /usr/include/efi/efi.h:60, + from gzip.c:29: + /usr/include/efi/ia64/efisetjmp_arch.h:45:23: note: previous declaration of 'jmp_buf' was here + } ALIGN(JMPBUF_ALIGN) jmp_buf; + ^~~~~~~ +diff --git a/ia64/gzip.c b/ia64/gzip.c +index cc0c943..e2d40f6 100644 +--- a/ia64/gzip.c ++++ b/ia64/gzip.c +@@ -138,3 +138,3 @@ static void error(char *m); + +-static jmp_buf jbuf; ++static jmp_buf_ia64_elilo jbuf; + static int error_return; +@@ -598,3 +598,3 @@ load_abort: + error_return = ELILO_LOAD_ABORTED; +- longjmp(jbuf, 1); ++ longjmp_ia64_elilo(jbuf, 1); + } +@@ -606,3 +606,3 @@ error(char *x) + /* will eventually exit with error from gunzip() */ +- longjmp(jbuf,1); ++ longjmp_ia64_elilo(jbuf,1); + } +@@ -645,3 +645,3 @@ gunzip_kernel(fops_fd_t fd, kdesc_t *kd) + +- if (setjmp(jbuf) == 1) goto error; ++ if (setjmp_ia64_elilo(jbuf) == 1) goto error; + +diff --git a/ia64/longjmp.S b/ia64/longjmp.S +index 23dec86..5341632 100644 +--- a/ia64/longjmp.S ++++ b/ia64/longjmp.S +@@ -18,5 +18,5 @@ + +- Note that __sigsetjmp() did NOT flush the register stack. Instead, +- we do it here since __longjmp() is usually much less frequently +- invoked than __sigsetjmp(). The only difficulty is that __sigsetjmp() ++ Note that __sigsetjmp_ia64_elilo() did NOT flush the register stack. Instead, ++ we do it here since __longjmp_ia64_elilo() is usually much less frequently ++ invoked than __sigsetjmp(). The only difficulty is that __sigsetjmp_ia64_elilo() + didn't (and wouldn't be able to) save ar.rnat either. This is a problem +@@ -40,8 +40,8 @@ + +- /* __longjmp(__jmp_buf buf, int val) */ ++ /* __longjmp_ia64_elilo(__jmp_buf_ia64_elilo buf, int val) */ + + .text +- .global longjmp +- .proc longjmp +-longjmp: ++ .global longjmp_ia64_elilo ++ .proc longjmp_ia64_elilo ++longjmp_ia64_elilo: + alloc r8=ar.pfs,2,1,0,0 +@@ -161,2 +161,2 @@ longjmp: + br.ret.dptk.few rp +- .endp longjmp ++ .endp longjmp_ia64_elilo +diff --git a/ia64/setjmp.S b/ia64/setjmp.S +index 4c83d03..57f5542 100644 +--- a/ia64/setjmp.S ++++ b/ia64/setjmp.S +@@ -70,14 +70,14 @@ + .text +- .global setjmp +- .proc setjmp +-setjmp: ++ .global setjmp_ia64_elilo ++ .proc setjmp_ia64_elilo ++setjmp_ia64_elilo: + alloc r8=ar.pfs,2,0,0,0 + mov in1=1 +- br.cond.sptk.many __sigsetjmp +- .endp setjmp ++ br.cond.sptk.many __sigsetjmp_ia64_elilo ++ .endp setjmp_ia64_elilo + +- /* __sigsetjmp(__jmp_buf buf, int savemask) */ ++ /* __sigsetjmp_ia64_elilo(__jmp_buf buf, int savemask) */ + +- .proc __sigsetjmp +-__sigsetjmp: ++ .proc __sigsetjmp_ia64_elilo ++__sigsetjmp_ia64_elilo: + //.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2) +@@ -173,2 +173,2 @@ __sigsetjmp: + +- .endp __sigsetjmp ++ .endp __sigsetjmp_ia64_elilo +diff --git a/ia64/setjmp.h b/ia64/setjmp.h +index 91bbfc1..f9e654d 100644 +--- a/ia64/setjmp.h ++++ b/ia64/setjmp.h +@@ -24,5 +24,5 @@ + /* the __jmp_buf element type should be __float80 per ABI... */ +-typedef long jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */ ++typedef long jmp_buf_ia64_elilo[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */ + +-extern int setjmp (jmp_buf __env); +-extern void longjmp (jmp_buf __env, int __val); ++extern int setjmp_ia64_elilo (jmp_buf_ia64_elilo __env); ++extern void longjmp_ia64_elilo (jmp_buf_ia64_elilo __env, int __val); diff --git a/sys-boot/elilo/files/elilo-3.16-strncpy-clash.patch b/sys-boot/elilo/files/elilo-3.16-strncpy-clash.patch new file mode 100644 index 000000000000..fb2f6878be03 --- /dev/null +++ b/sys-boot/elilo/files/elilo-3.16-strncpy-clash.patch @@ -0,0 +1,23 @@ +gnu-efi-3.0.8 added StrnCpy. This caused conflict with elilo's definition: + ./../fs/../strops.h:30:16: error: conflicting types for 'StrnCpy' + extern CHAR16 *StrnCpy(OUT CHAR16 *dst, IN const CHAR16 *src, UINTN count); + ^~~~~~~ + +Work it around by always using private copy. + +Reported-by: Bill Glessner +--- a/strops.h ++++ b/strops.h +@@ -29,3 +29,4 @@ + extern CHAR16 *StrChr(IN const CHAR16 *s, const CHAR16 c); ++#define StrnCpy elilo_StrnCpy + extern CHAR16 *StrnCpy(OUT CHAR16 *dst, IN const CHAR16 *src, UINTN count); + extern CHAR8 *StrnXCpy(OUT CHAR8 *dst, IN const CHAR16 *src, UINTN count); +--- a/strops.c ++++ b/strops.c +@@ -27,4 +27,6 @@ + #include <efilib.h> + ++#include "strops.h" ++ + //#define CHAR_NULL (CHAR16)'\0' diff --git a/sys-boot/elilo/files/elilo.conf.sample b/sys-boot/elilo/files/elilo.conf.sample new file mode 100644 index 000000000000..ed97975c69d7 --- /dev/null +++ b/sys-boot/elilo/files/elilo.conf.sample @@ -0,0 +1,9 @@ +boot=/dev/sda1 +install=/usr/lib/elilo/elilo.efi +delay=20 +default=gentoo + +image=/boot/kernel-2.6.12-gentoo-r6 + label=gentoo + root=/dev/sda3 + read-only diff --git a/sys-boot/elilo/metadata.xml b/sys-boot/elilo/metadata.xml new file mode 100644 index 000000000000..d291a48d5832 --- /dev/null +++ b/sys-boot/elilo/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <remote-id type="sourceforge">elilo</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/etcher-bin/Manifest b/sys-boot/etcher-bin/Manifest new file mode 100644 index 000000000000..7d72a9fc35ae --- /dev/null +++ b/sys-boot/etcher-bin/Manifest @@ -0,0 +1,2 @@ +DIST balena-etcher_2.1.4_amd64.deb 123924010 BLAKE2B 882e989d8f391da0c1c5d52aa5dd9d3b14353bbeeafba0b59e3202f0dd21e163457a82bbfbbb6daf2e39e9bf347b5c13421192f91827938d35b2c34bfaceea89 SHA512 e3a9a1c51409092fb8a182f8ed4eed214ef4f3217d7d078d40ec54c0f20795848fb18e80b02f5c0816bbbc09221cba4cdb3307744f8e01ea85ad3fada13f131f +DIST balena-etcher_2.1.6_amd64.deb 123910696 BLAKE2B beca750e83a0cd6d0a7b5d4606a4d896d61d03a22d0784c8f7fb1207b07f5fe4924d08366938d1232e2885f6045e88c342d94e44fcceff1ee766bea6e772d910 SHA512 e57ea16db49544b89a8e2e36fdc23d5e1b93941d99f2cd5244b5b0c5845cbf0f8f6343abf1343e5c271e20a580133871753248cc8c3dc3b18b1bda7e7e470f54 diff --git a/sys-boot/etcher-bin/etcher-bin-2.1.4-r1.ebuild b/sys-boot/etcher-bin/etcher-bin-2.1.4-r1.ebuild new file mode 100644 index 000000000000..1de78d203911 --- /dev/null +++ b/sys-boot/etcher-bin/etcher-bin-2.1.4-r1.ebuild @@ -0,0 +1,76 @@ +# Copyright 2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit unpacker xdg + +DESCRIPTION="Flash OS images to SD cards & USB drives, safely and easily." +HOMEPAGE="https://etcher.balena.io" +SRC_URI="https://github.com/balena-io/etcher/releases/download/v${PV}/balena-etcher_${PV}_amd64.deb" +S="${WORKDIR}" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="-* ~amd64" + +RESTRICT="mirror strip test" + +RDEPEND=" + app-accessibility/at-spi2-core:2 + app-arch/xz-utils + dev-libs/expat + dev-libs/glib:2 + dev-libs/nspr + dev-libs/nss + media-libs/alsa-lib + media-libs/mesa + net-print/cups + sys-apps/dbus + sys-auth/polkit + sys-libs/glibc + virtual/libudev + x11-libs/cairo + x11-libs/gtk+:3 + x11-libs/libnotify + x11-libs/libX11 + x11-libs/libXcomposite + x11-libs/libXdamage + x11-libs/libXext + x11-libs/libXfixes + x11-libs/libXrandr + x11-libs/libXScrnSaver + x11-libs/libdrm + x11-libs/libxcb + x11-libs/libxkbcommon + x11-libs/pango +" +BDEPEND=" + dev-util/patchelf +" + +QA_PREBUILT=" + usr/lib/balena-etcher/balena-etcher + usr/lib/balena-etcher/resources/etcher-util +" +QA_PRESTRIPPED=" + usr/lib/balena-etcher/resources/app.asar.unpacked/.webpack/renderer/native_modules/prebuilds/linux-x64/node.napi.node + usr/lib/balena-etcher/resources/app.asar.unpacked/.webpack/renderer/native_modules/prebuilds/linux-x64/node.napi1.node +" + +src_unpack() { + unpack_deb ${A} +} + +src_prepare() { + mv "${WORKDIR}/usr/share/doc/balena-etcher/" "${WORKDIR}/usr/share/doc/${PF}" || die + + # Weird symlink + rm "${WORKDIR}/usr/lib/balena-etcher/balenaEtcher" || die + + default +} + +src_install() { + mv * "${D}" || die +} diff --git a/sys-boot/etcher-bin/etcher-bin-2.1.6.ebuild b/sys-boot/etcher-bin/etcher-bin-2.1.6.ebuild new file mode 100644 index 000000000000..4bb9b2f4c0ef --- /dev/null +++ b/sys-boot/etcher-bin/etcher-bin-2.1.6.ebuild @@ -0,0 +1,69 @@ +# Copyright 2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit unpacker xdg + +DESCRIPTION="Flash OS images to SD cards & USB drives, safely and easily." +HOMEPAGE="https://etcher.balena.io" +SRC_URI="https://github.com/balena-io/etcher/releases/download/v${PV}/balena-etcher_${PV}_amd64.deb" +S="${WORKDIR}" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="-* ~amd64" + +RESTRICT="mirror strip test" + +RDEPEND=" + app-accessibility/at-spi2-core:2 + app-arch/xz-utils + dev-libs/expat + dev-libs/glib:2 + dev-libs/nspr + dev-libs/nss + media-libs/alsa-lib + media-libs/mesa + net-print/cups + sys-apps/dbus + sys-auth/polkit + sys-libs/glibc + virtual/libudev + x11-libs/cairo + x11-libs/gtk+:3 + x11-libs/libnotify + x11-libs/libX11 + x11-libs/libXcomposite + x11-libs/libXdamage + x11-libs/libXext + x11-libs/libXfixes + x11-libs/libXrandr + x11-libs/libXScrnSaver + x11-libs/libdrm + x11-libs/libxcb + x11-libs/libxkbcommon + x11-libs/pango +" +BDEPEND=" + dev-util/patchelf +" + +QA_PREBUILT="*" + +src_unpack() { + unpack_deb ${A} +} + +src_prepare() { + mv "${WORKDIR}/usr/share/doc/balena-etcher/" "${WORKDIR}/usr/share/doc/${PF}" || die + + # Weird symlink + rm "${WORKDIR}/usr/lib/balena-etcher/balenaEtcher" || die + + default +} + +src_install() { + mv * "${D}" || die +} diff --git a/sys-boot/etcher-bin/metadata.xml b/sys-boot/etcher-bin/metadata.xml new file mode 100644 index 000000000000..18d10f9c5def --- /dev/null +++ b/sys-boot/etcher-bin/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>sighunter@gmx.de</email> + <name>Sebastian Engel</name> + </maintainer> + <upstream> + <remote-id type="github">balena-io/etcher</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/gnu-efi/Manifest b/sys-boot/gnu-efi/Manifest new file mode 100644 index 000000000000..407f7fa0335e --- /dev/null +++ b/sys-boot/gnu-efi/Manifest @@ -0,0 +1,2 @@ +DIST gnu-efi-3.0.19.tar.gz 218588 BLAKE2B 78db87904e644406ce2eb1a0ef0f325e7ad0f004dd56199e319985c5d035b4755d545c1a6bcf749da08c7670132de28a3e53ba059956b841034c6b059e39042b SHA512 78a79f51bd271043edbf534427d8fbba3d8099e831a9643019899453e8363ebd4d43f6e5448cdde31d43a6bdb94ec32e73425138bfb614617b8886df90fc1665 +DIST gnu-efi-4.0.4.tar.gz 245519 BLAKE2B a636ec81a830206b4d793689b6b4b85ab88b9061224691d47076b096e4502f4625fdc759c351d3e8b0a93fc26c33dd4862c2383d7620bb1704649c275da322f7 SHA512 4ed273ef8203f1b2fd90855821576523b070236911a26199eec220f1bad34f63759a32b06f11a681e532a2c793339d9e66bcb90e5cde5de02d8842a40c471a06 diff --git a/sys-boot/gnu-efi/files/gnu-efi-3.0.18-clang.patch b/sys-boot/gnu-efi/files/gnu-efi-3.0.18-clang.patch new file mode 100644 index 000000000000..7819351928c5 --- /dev/null +++ b/sys-boot/gnu-efi/files/gnu-efi-3.0.18-clang.patch @@ -0,0 +1,26 @@ +https://bugs.gentoo.org/930538 +https://github.com/ncroxon/gnu-efi/issues/4 +https://github.com/ncroxon/gnu-efi/pull/5 +https://github.com/ncroxon/gnu-efi/commit/a0111e0df165d49cf34fc4f5fae46fc0921a756d + +From a0111e0df165d49cf34fc4f5fae46fc0921a756d Mon Sep 17 00:00:00 2001 +From: Callum Farmer <gmbr3@opensuse.org> +Date: Wed, 24 Apr 2024 12:04:48 +0100 +Subject: [PATCH] Disable RELRO + +No point having PT_GNU_RELRO as ELF data won't exist when merging into PE32+ file + +Unbreaks lld usage which complains about linker script +Fixes ncroxon/gnu-efi#4 +--- a/Make.defaults ++++ b/Make.defaults +@@ -199,7 +199,7 @@ endif + ARFLAGS := rDv + ASFLAGS += $(ARCH3264) + LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings \ +- --build-id=sha1 -z nocombreloc ++ --build-id=sha1 -z nocombreloc -z norelro + + ifneq ($(ARCH),arm) + export LIBGCC=$(shell $(CC) $(CFLAGS) $(ARCH3264) -print-libgcc-file-name) + diff --git a/sys-boot/gnu-efi/files/gnu-efi-3.0.18-remove-linux-headers.patch b/sys-boot/gnu-efi/files/gnu-efi-3.0.18-remove-linux-headers.patch new file mode 100644 index 000000000000..e997aae58836 --- /dev/null +++ b/sys-boot/gnu-efi/files/gnu-efi-3.0.18-remove-linux-headers.patch @@ -0,0 +1,14 @@ +https://bugs.gentoo.org/888829 + +--- a/apps/Makefile ++++ b/apps/Makefile +@@ -41,9 +41,7 @@ + + include $(SRCDIR)/../Make.defaults + +-LINUX_HEADERS = /usr/src/sys/build + APPSDIR = $(LIBDIR)/gnuefi/apps +-CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include + CRTOBJS = $(TOPDIR)/$(ARCH)/gnuefi/crt0-efi-$(ARCH).o + + LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds diff --git a/sys-boot/gnu-efi/files/gnu-efi-3.0.19-fix-binutils-2.46.patch b/sys-boot/gnu-efi/files/gnu-efi-3.0.19-fix-binutils-2.46.patch new file mode 100644 index 000000000000..3499371cfa81 --- /dev/null +++ b/sys-boot/gnu-efi/files/gnu-efi-3.0.19-fix-binutils-2.46.patch @@ -0,0 +1,19 @@ +Backport the fix from gnu-efi 4.0.4 to build with binutils-2.46. + +https://bugs.gentoo.org/970040 + +--- a/apps/Makefile ++++ b/apps/Makefile +@@ -66,9 +66,9 @@ + + ifneq ($(HAVE_EFI_OBJCOPY),) + +-FORMAT := --target efi-app-$(ARCH) +-$(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(ARCH) +-$(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(ARCH) ++FORMAT := -O efi-app-$(ARCH) ++$(TARGET_BSDRIVERS): FORMAT=-O efi-bsdrv-$(ARCH) ++$(TARGET_RTDRIVERS): FORMAT=-O efi-rtdrv-$(ARCH) + + else + diff --git a/sys-boot/gnu-efi/files/gnu-efi-4.0.2-remove-linux-headers.patch b/sys-boot/gnu-efi/files/gnu-efi-4.0.2-remove-linux-headers.patch new file mode 100644 index 000000000000..e53c8c87315b --- /dev/null +++ b/sys-boot/gnu-efi/files/gnu-efi-4.0.2-remove-linux-headers.patch @@ -0,0 +1,14 @@ +https://bugs.gentoo.org/888829 + +--- a/apps/Makefile ++++ b/apps/Makefile +@@ -41,9 +41,7 @@ + + include $(SRCDIR)/../Make.defaults + +-LINUX_HEADERS = /usr/src/sys/build + APPSDIR = $(LIBDIR)/gnuefi/apps +-EFI_CFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include + + ifneq ($(HAVE_EFI_OBJCOPY),) + ifeq ($(SYSTEM_HAS_EFI_OBJCOPY),0) diff --git a/sys-boot/gnu-efi/gnu-efi-3.0.19.ebuild b/sys-boot/gnu-efi/gnu-efi-3.0.19.ebuild new file mode 100644 index 000000000000..61a919b1b4aa --- /dev/null +++ b/sys-boot/gnu-efi/gnu-efi-3.0.19.ebuild @@ -0,0 +1,151 @@ +# Copyright 2004-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic toolchain-funcs + +DESCRIPTION="Library for build EFI Applications" +HOMEPAGE="https://sourceforge.net/projects/gnu-efi/" +SRC_URI="https://github.com/ncroxon/gnu-efi/archive/${PV}.tar.gz -> ${P}.tar.gz" + +# inc/, lib/ dirs (README.efilib) +# - BSD-2 +# gnuefi dir: +# - BSD (3-cluase): crt0-efi-ia32.S +# - GPL-2+ : setjmp_ia32.S +LICENSE="GPL-2+ BSD BSD-2" +SLOT="0" +KEYWORDS="-* amd64 arm arm64 ~loong ~riscv x86" +IUSE="abi_x86_32 abi_x86_64 custom-cflags" +REQUIRED_USE=" + amd64? ( || ( abi_x86_32 abi_x86_64 ) ) + x86? ( || ( abi_x86_32 abi_x86_64 ) ) +" + +# for ld.bfd and objcopy +BDEPEND="sys-devel/binutils" + +# These objects get run early boot (i.e. not inside of Linux), +# so doing these QA checks on them doesn't make sense. +QA_EXECSTACK="usr/*/lib*efi.a:* usr/*/crt*.o" +RESTRICT="strip" + +PATCHES=( + "${FILESDIR}"/${PN}-3.0.18-clang.patch + "${FILESDIR}"/${PN}-3.0.18-remove-linux-headers.patch + "${FILESDIR}"/${PN}-3.0.19-fix-binutils-2.46.patch +) + +check_and_set_objcopy() { + if [[ ${MERGE_TYPE} != "binary" ]]; then + + if use arm || use riscv; then + # bug #939338 + # objcopy does not understand PE/COFF on these arches: arm32, riscv64 and mips64le + # gnu-efi containes a workaround + return 0 + fi + + # bug #931792 + # llvm-objcopy does not support EFI target, try to use binutils objcopy or fail + tc-export OBJCOPY + # Test OBJCOPY to see if it supports EFI targets, and return if it does + LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' && return 0 + + # If OBJCOPY does not support EFI targets, it is possible that the 'objcopy' on our path is + # still LLVM if the 'binutils-plugin' USE flag is set. In this case, we check to see if the + # '(prefix)/usr/bin/objcopy' binary is available (it should be, it's a dependency), and if + # so, we use the absolute path explicitly. + local binutils_objcopy="${EPREFIX}"/usr/bin/objcopy + if [[ -e "${binutils_objcopy}" ]]; then + OBJCOPY="${binutils_objcopy}" + einfo "Forcing OBJCOPY=${OBJCOPY}" + fi + + # Test OBJCOPY again to see if it supports EFI targets, and fail if it doesn't + LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' || die "${OBJCOPY} (objcopy) does not support EFI target" + fi +} + +check_compiler() { + if [[ ${MERGE_TYPE} != "binary" ]]; then + tc-is-gcc || tc-is-clang || die "Unsupported compiler" + fi +} + +pkg_pretend() { + check_compiler +} + +pkg_setup() { + check_compiler + check_and_set_objcopy +} + +src_prepare() { + default + sed -i -e "s/-Werror//" Make.defaults || die +} + +efimake() { + local arch= + case ${CHOST} in + arm*) arch=arm ;; + aarch64*) arch=aarch64 ;; + ia64*) arch=ia64 ;; + i?86*) arch=ia32 ;; + loongarch64*) arch=loongarch64 ;; + riscv64*) arch=riscv64;; + x86_64*) arch=x86_64 ;; + *) die "Unknown CHOST" ;; + esac + + local args=( + ARCH="${arch}" + HOSTCC="${BUILD_CC}" + CC="${CC}" + AS="${AS}" + LD="${LD}" + AR="${AR}" + OBJCOPY="${OBJCOPY}" + PREFIX="${EPREFIX}/usr" + LIBDIR='$(PREFIX)'/$(get_libdir) + ) + emake -j1 "${args[@]}" "$@" +} + +src_compile() { + tc-export BUILD_CC AR AS CC LD OBJCOPY + + if ! use custom-cflags; then + unset CFLAGS CPPFLAGS LDFLAGS + fi + + # work around musl: include first the compiler include dir, then the system one + # bug #933080, #938012 + local CPPINCLUDEDIR + if tc-is-gcc; then + CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-search-dirs 2> /dev/null | grep ^install: | cut -f2 -d' ')/include + elif tc-is-clang; then + CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-resource-dir 2> /dev/null)/include + fi + append-cflags "-nostdinc -isystem ${CPPINCLUDEDIR} -isystem ${ESYSROOT}/usr/include" + + if use amd64 || use x86; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake + use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake + else + efimake + fi +} + +src_install() { + if use amd64 || use x86; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake INSTALLROOT="${D}" install + use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake INSTALLROOT="${D}" install + else + efimake INSTALLROOT="${D}" install + fi + einstalldocs +} diff --git a/sys-boot/gnu-efi/gnu-efi-4.0.4.ebuild b/sys-boot/gnu-efi/gnu-efi-4.0.4.ebuild new file mode 100644 index 000000000000..208715ffce39 --- /dev/null +++ b/sys-boot/gnu-efi/gnu-efi-4.0.4.ebuild @@ -0,0 +1,153 @@ +# Copyright 2004-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic toolchain-funcs + +DESCRIPTION="Library for build EFI Applications" +HOMEPAGE="https://sourceforge.net/projects/gnu-efi/" +SRC_URI="https://github.com/ncroxon/gnu-efi/archive/${PV}.tar.gz -> ${P}.tar.gz" + +# inc/, lib/ dirs (README.efilib) +# - BSD-2 +# gnuefi dir: +# - BSD (3-cluase): crt0-efi-ia32.S +# - GPL-2+ : setjmp_ia32.S +LICENSE="GPL-2+ BSD BSD-2" +SLOT="0" +KEYWORDS="-* amd64 arm arm64 ~loong ~riscv x86" +IUSE="abi_x86_32 abi_x86_64 custom-cflags" +REQUIRED_USE=" + amd64? ( || ( abi_x86_32 abi_x86_64 ) ) + x86? ( || ( abi_x86_32 abi_x86_64 ) ) +" + +# for ld.bfd and objcopy +BDEPEND="sys-devel/binutils" + +# These objects get run early boot (i.e. not inside of Linux), +# so doing these QA checks on them doesn't make sense. +QA_EXECSTACK="usr/*/lib*efi.a:* usr/*/crt*.o" +RESTRICT="strip" + +PATCHES=( + "${FILESDIR}"/${PN}-4.0.2-remove-linux-headers.patch +) + +DOCS="README* SECURITY* docs/*" + +check_and_set_objcopy() { + if [[ ${MERGE_TYPE} != "binary" ]]; then + + if use arm || use riscv; then + # bug #939338 + # objcopy does not understand PE/COFF on these arches: arm32, riscv64 and mips64le + # gnu-efi containes a workaround + return 0 + fi + + # bug #931792 + # llvm-objcopy does not support EFI target, try to use binutils objcopy or fail + tc-export OBJCOPY + # Test OBJCOPY to see if it supports EFI targets, and return if it does + LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' && return 0 + + # If OBJCOPY does not support EFI targets, it is possible that the 'objcopy' on our path is + # still LLVM if the 'binutils-plugin' USE flag is set. In this case, we check to see if the + # '(prefix)/usr/bin/objcopy' binary is available (it should be, it's a dependency), and if + # so, we use the absolute path explicitly. + local binutils_objcopy="${EPREFIX}"/usr/bin/objcopy + if [[ -e "${binutils_objcopy}" ]]; then + OBJCOPY="${binutils_objcopy}" + einfo "Forcing OBJCOPY=${OBJCOPY}" + fi + + # Test OBJCOPY again to see if it supports EFI targets, and fail if it doesn't + LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' || die "${OBJCOPY} (objcopy) does not support EFI target" + fi +} + +check_compiler() { + if [[ ${MERGE_TYPE} != "binary" ]]; then + tc-is-gcc || tc-is-clang || die "Unsupported compiler" + fi +} + +pkg_pretend() { + check_compiler +} + +pkg_setup() { + check_compiler + check_and_set_objcopy +} + +src_prepare() { + default + sed -i -e "s/-Werror//" Make.defaults || die +} + +efimake() { + local arch= + case ${CHOST} in + arm*) arch=arm ;; + aarch64*) arch=aarch64 ;; + ia64*) arch=ia64 ;; + i?86*) arch=ia32 ;; + loongarch64*) arch=loongarch64 ;; + riscv64*) arch=riscv64;; + x86_64*) arch=x86_64 ;; + *) die "Unknown CHOST" ;; + esac + + local args=( + ARCH="${arch}" + HOSTCC="${BUILD_CC}" + CC="${CC}" + AS="${AS}" + LD="${LD}" + AR="${AR}" + OBJCOPY="${OBJCOPY}" + PREFIX="${EPREFIX}/usr" + LIBDIR='$(PREFIX)'/$(get_libdir) + ) + emake -j1 "${args[@]}" "$@" +} + +src_compile() { + tc-export BUILD_CC AR AS CC LD OBJCOPY + + if use custom-cflags; then + LDFLAGS="$(raw-ldflags)" + else + unset CFLAGS CPPFLAGS LDFLAGS + fi + + # work around musl: include first the compiler include dir, then the system one + # bug #933080, #938012 + local CPPINCLUDEDIR + if tc-is-gcc; then + CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-search-dirs 2> /dev/null | grep ^install: | cut -f2 -d' ')/include + elif tc-is-clang; then + CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-resource-dir 2> /dev/null)/include + fi + append-cflags "-nostdinc -isystem ${CPPINCLUDEDIR} -isystem ${ESYSROOT}/usr/include" + + if use amd64 || use x86; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake + use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake + else + efimake + fi +} + +src_install() { + if use amd64 || use x86; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake INSTALLROOT="${D}" install + use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake INSTALLROOT="${D}" install + else + efimake INSTALLROOT="${D}" install + fi + einstalldocs +} diff --git a/sys-boot/gnu-efi/metadata.xml b/sys-boot/gnu-efi/metadata.xml new file mode 100644 index 000000000000..4363ae4d2754 --- /dev/null +++ b/sys-boot/gnu-efi/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>ceamac@gentoo.org</email> + <name>Viorel Munteanu</name> + </maintainer> + <upstream> + <remote-id type="sourceforge">gnu-efi</remote-id> + <remote-id type="github">ncroxon/gnu-efi</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/grml-rescueboot/Manifest b/sys-boot/grml-rescueboot/Manifest new file mode 100644 index 000000000000..f2a51b3893eb --- /dev/null +++ b/sys-boot/grml-rescueboot/Manifest @@ -0,0 +1 @@ +DIST grml-rescueboot_0.6.7+gh.tar.xz 9616 BLAKE2B 35d688f17b0d86eed1c2dfea9e269af195155ae02e819884847afe8a3b4ce3079818e69dfbaa7815bbb65fee3d733ab100f51300599f260ac0eb52833f29876f SHA512 ef23ec1ddccc9699dc93f53da73dcb05894690f31449a046ac89ebdd116411b1e71424fd20051fbab908530426dec89c28e3f414ca6a12d712fb2eef30f872bf diff --git a/sys-boot/grml-rescueboot/grml-rescueboot-0.6.7.ebuild b/sys-boot/grml-rescueboot/grml-rescueboot-0.6.7.ebuild new file mode 100644 index 000000000000..46dc1982fab3 --- /dev/null +++ b/sys-boot/grml-rescueboot/grml-rescueboot-0.6.7.ebuild @@ -0,0 +1,38 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="grub2 script to add ISO images to the grub2 boot menu" +HOMEPAGE="https://wiki.grml.org/doku.php?id=rescueboot" +SRC_URI="https://github.com/grml/grml-rescueboot/releases/download/v${PV}/${PN}_${PV}+gh.tar.xz" +S="${WORKDIR}"/workspace + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND="sys-boot/grub" +BDEPEND="app-text/xmltoman" + +src_install() { + insinto /etc/default + doins etc/default/grml-rescueboot + + exeinto /etc/grub.d/ + doexe 42_grml +} + +pkg_postinst() { + einfo "Default folder for ISOs is /boot/grml/" + einfo "You can change it in /etc/default/grml-rescueboot" + einfo "Put some ISOs to the folder," + einfo "mount your /boot:" + einfo "mount /dev/sda1 /boot/" + einfo "and run" + einfo "grub-mkconfig -o /boot/grub/grub.cfg" + einfo "Not all ISOs are bootable this way" + einfo "Works for Ubuntu, Debian (not all ISOs)" + einfo "https://grml.org/download/" + einfo "but not for Gentoo ISO, see https://bugs.gentoo.org/568464" +} diff --git a/sys-boot/grml-rescueboot/metadata.xml b/sys-boot/grml-rescueboot/metadata.xml new file mode 100644 index 000000000000..fbbc44905daa --- /dev/null +++ b/sys-boot/grml-rescueboot/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <remote-id type="github">grml/grml-rescueboot</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/grub-themes-gentoo/Manifest b/sys-boot/grub-themes-gentoo/Manifest new file mode 100644 index 000000000000..a675befa1cd7 --- /dev/null +++ b/sys-boot/grub-themes-gentoo/Manifest @@ -0,0 +1 @@ +DIST grub-themes-gentoo-1.0.tgz 5238921 BLAKE2B f4cef76f1ea4ef40fdcacfa53d28bbdf48130151e9aa8705494d591669edc85fabff5106d03a43b12dfb986b37a3d89048a2b9028094238d378e7e6fe6597f93 SHA512 51ca2d7716335f771b4aeeb188f1e2e1386d3f3f6c943ce8bbb05248a71e1d56fa128fe8db460adfc0bd235b9e12179c36e7b6eea24078a73e77d625b046f2c9 diff --git a/sys-boot/grub-themes-gentoo/grub-themes-gentoo-1.0-r2.ebuild b/sys-boot/grub-themes-gentoo/grub-themes-gentoo-1.0-r2.ebuild new file mode 100644 index 000000000000..6e9cf630ad7f --- /dev/null +++ b/sys-boot/grub-themes-gentoo/grub-themes-gentoo-1.0-r2.ebuild @@ -0,0 +1,27 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot + +MY_PN=gentoo-grub-themes + +DESCRIPTION="Grub2 Themes for Gentoo" +HOMEPAGE="https://github.com/Telemin/gentoo-grub-themes" +SRC_URI="https://github.com/Telemin/${MY_PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tgz" +S="${WORKDIR}/${MY_PN}-${PV}" +LICENSE="MIT CC-BY-SA-2.5" +SLOT="0" + +KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv ~sparc x86" + +PDEPEND="sys-boot/grub" + +src_install() { + local d + for d in /boot /usr/share; do + insinto "${d}"/grub/themes + doins -r gentoo_frosted gentoo_glass gentoo_minimalist + done +} diff --git a/sys-boot/grub-themes-gentoo/metadata.xml b/sys-boot/grub-themes-gentoo/metadata.xml new file mode 100644 index 000000000000..e59201789cd6 --- /dev/null +++ b/sys-boot/grub-themes-gentoo/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>base-system@gentoo.org</email> + <name>Gentoo Base System</name> +</maintainer> +<maintainer type="person"> + <email>dilfridge@gentoo.org</email> +</maintainer> +<upstream> + <remote-id type="github">Telemin/gentoo-grub-themes</remote-id> +</upstream> +</pkgmetadata> diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest new file mode 100644 index 000000000000..7b096489df03 --- /dev/null +++ b/sys-boot/grub/Manifest @@ -0,0 +1,11 @@ +DIST dejavu-fonts-ttf-2.37.tar.bz2 5429777 BLAKE2B d8614907887f20967fc7c75cb33b636a0eb5c682a076ccc7aef09f4ac243507afc005ef90d0b2aeee6a4a6a1ff3d5ce4fac0d1722a382525b3883ef53cdec26a SHA512 bafa39321021097432777f0825d700190c23f917d754a4504722cd8946716c22c083836294dab7f3ae7cf20af63c4d0944f3423bf4aa25dbca562d1f30e00654 +DIST dejavu-sans-ttf-2.37.zip 417746 BLAKE2B c8904f3cd5a49370a7dc10e456684c88aeae998a99090bf4d0a5baa4f36cc8fb8f70586cf6d610a5ffeee97261d28c80f55bbe9dcfc3ed796d5c2d60e79adb58 SHA512 ede5899daa1984c5aa8cacb1c850eb53f189dddef3d9bb78bf9774d8976b7c0d6eb0bcf86237cd7d11f5b36cf5b5058d42cd94d3bd76f2bd0931c7ceb1271fae +DIST grub-2.12-bash-completion.patch.gz 3627 BLAKE2B 6ba80fd4fb4b28ae2e5a2387133d815da126a4eaa4b5cb24b13f4ba5a2499ab4099d10ada366ed39f84be2c38774122f48e1a1894768c5bee29149528610d095 SHA512 a9ee6d2253ae48d7f90907a9e975a3a1d01346bc621d8b8cddf7cc815cd91e078f6c61392724d13556ee64f099fa15c94fcb88a49ff02d4a90ebd376252cea5c +DIST grub-2.12.tar.xz 6675608 BLAKE2B a678f7fafb945d325c8cf47aa086f48357a8f6335b762f77038c30a3896b3b05491598d9931d5335841d224fffcbe4a9a43ca1479057c1f1ce52b8d2a952c431 SHA512 761c060a4c3da9c0e810b0ea967e3ebc66baa4ddd682a503ae3d30a83707626bccaf49359304a16b3a26fc4435fe6bea1ee90be910c84de3c2b5485a31a15be3 +DIST grub-2.12.tar.xz.sig 566 BLAKE2B 9b77fe53041b99f1196743aa6d9fc9c727b17c6512129bab2b35005f2c70f371e30521ddd804bf0c666e36cf2667247980f385ca1ac911fa9b8e0311427dc01c SHA512 fbe971d8c382578b49d33902234edd9cbd084b70820a1a56a59df4ec30874c0dd4fe27f8dc44bb380716bb7480ca68a87d120a25b92a6a10ff6c8ec1b60548d3 +DIST grub-2.14-patches.tar.xz 10700 BLAKE2B 6a8850da59a56427c4e8159332e89b18c9c4f49fe95ecf4c7d8e9c8c905fea9d40a9c294e24cc4aa32f12175426f7e95fac16b16345092f8b9848c7f34b6a19e SHA512 eff9a7007f2230d642763ee8e9005da4041fffd9eb0527b909e871bf7681747f9e71ab5459b54f7ce5b9bb64a6d0659beb6fd0fb172488f62fe4148d4e73a86e +DIST grub-2.14.tar.xz 7725668 BLAKE2B 724bb430d8824bec39e6a025cf354a780b79260684c7c4e3d28beb08c8bee10d082a089fcb799f8f5eb6e83abcf8675fb7c5f5ddf443c5c0e61d6f180ee341af SHA512 5008e3b70072798d2b34301219fe174cc6bcfead40a9ab25fe32f30c62a392ffb7bf2eb629d481f4a6c19c2925324af3f08d7043e62623e746be2d8b3cbd1182 +DIST grub-2.14.tar.xz.sig 566 BLAKE2B a26d44082a94b95efd13738a47dc37c33142f1d486b1643100c5e61f280464513679407c13ad3d362caf83ca63dc47ad0249a4291660dbc5aa47b739502cc6b5 SHA512 3087cc4c9abd4c16e5d57f3f9fcea83af471c1a5950d487ecb93908feac537df8720bc83854328891c46f26b202a16eadeec8d1ab343c6fe269986b6f9dd2de8 +DIST unifont-15.0.06.pcf.gz 1358322 BLAKE2B 81811e3de390ca35d1a2dc1f1dee73464e97f44907ba522c218ba9c5e39ca3c9d767552780a257a97c156eb623c17786d9c0d2b67786d61df5ca33a1e10db7ca SHA512 0a28a406629c604f5cbf51f501528239a7ed50d19f93ea505bc5bdc72639e4b926b03f4b8782a5733041f7cdb4aebb9948ac7cfd5a8ad9a0fe309944e595517b +DIST unifont-17.0.02.pcf.gz 1357145 BLAKE2B 6043055b10273930454b95bea847f4cd9cbceb7fa5f4b903a92d1e05093ed8d36b0be6cdcc96089d910b3af9b826d8bc0491070d7af568801e829fb69238d787 SHA512 8c325b8f1b872ced2a8ceffa89ce81858c4c768562711610529ae0be488dc335e333f8674cad78fe9550de222247816c435b0079bc959e6e1caebf4c7ecd2faf +DIST unifont-17.0.02.pcf.gz.sig 566 BLAKE2B b20c3b498862b5f652bea95ca240a279674de583b2f03dc0b9ee0bac46da2513d54ca8fdcacc222adf5360da6fe919060bf41d977335d7c11a1bf9407c84c99d SHA512 f31792427adf73c0cf16f890faa579fda5315cbc0c9ac17b4d19555255f49dbf89f6333012ce99fec9819252fd7b81e07a65a2cd0d3aa54a54ded8d7c50ac186 diff --git a/sys-boot/grub/files/gfxpayload.patch b/sys-boot/grub/files/gfxpayload.patch new file mode 100644 index 000000000000..59e4a45e4917 --- /dev/null +++ b/sys-boot/grub/files/gfxpayload.patch @@ -0,0 +1,33 @@ +https://bugs.gentoo.org/528826 +http://lists.gnu.org/archive/html/grub-devel/2014-10/msg00031.html +https://gitlab.freedesktop.org/gnu-grub/grub/-/merge_requests/98 + +From e2d5bf1bc6aaaabeba538c1ca94ea8601e4e1474 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Thu, 16 Oct 2014 23:43:51 -0400 +Subject: [PATCH] 10_linux: Default gfxpayload=keep only when booting using efi + +vesafb seems to be unreliable when using BIOS compat mode. + +--- + util/grub.d/10_linux.in | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index d2e2a8f..a54b888 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -104,7 +104,9 @@ linux_entry () + echo " load_video" | sed "s/^/$submenu_indentation/" + if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \ + && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then +- echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" ++ echo ' if [ "x$grub_platform" = xefi ]; then' | sed "s/^/$submenu_indentation/" ++ echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" ++ echo ' fi' | sed "s/^/$submenu_indentation/" + fi + else + if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then +-- +2.7.2 + diff --git a/sys-boot/grub/files/grub-2.02_beta2-KERNEL_GLOBS.patch b/sys-boot/grub/files/grub-2.02_beta2-KERNEL_GLOBS.patch new file mode 100644 index 000000000000..0d2b96d76c11 --- /dev/null +++ b/sys-boot/grub/files/grub-2.02_beta2-KERNEL_GLOBS.patch @@ -0,0 +1,74 @@ +From 43e3295aaad5278a1e53c5282e2660b72cd76d28 Mon Sep 17 00:00:00 2001 +From: "Robin H. Johnson" <robbat2@gentoo.org> +Date: Tue, 29 Dec 2015 15:29:14 -0800 +Subject: [PATCH] GRUB_LINUX_KERNEL_GLOBS: configurable kernel selection + +* util/grub.d/10_linux.in: Implement GRUB_LINUX_KERNEL_GLOBS +* docs/grub.texi: Document GRUB_LINUX_KERNEL_GLOBS + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> +--- + docs/grub.texi | 5 +++++ + util/grub.d/10_linux.in | 21 +++++++++++---------- + 2 files changed, 16 insertions(+), 10 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 9a25a0b..d1129ec 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -1490,6 +1490,11 @@ This option may be set to a list of GRUB module names separated by spaces. + Each module will be loaded as early as possible, at the start of + @file{grub.cfg}. + ++@item GRUB_LINUX_KERNEL_GLOBS ++This option may be set to override the list of path globs used to find Linux ++kernels. The defaults vary by architecture, and generally include both ++@file{/boot} and @file{/}. ++ + @end table + + The following options are still accepted for compatibility with existing +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 859b608..e5ac11d 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -145,18 +145,19 @@ EOF + } + + machine=`uname -m` +-case "x$machine" in ++globs="$GRUB_LINUX_KERNEL_GLOBS" ++[ -z "$globs" ] && case "x$machine" in + xi?86 | xx86_64) +- list= +- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done ;; +- *) +- list= +- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done ;; ++ globs="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ++ ;; ++ *) ++ globs="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-*" ++ ;; + esac ++list= ++for i in ${globs} ; do ++ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi ++done + + case "$machine" in + i?86) GENKERNEL_ARCH="x86" ;; +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -252,6 +252,7 @@ + GRUB_BADRAM \ + GRUB_OS_PROBER_SKIP_LIST \ + GRUB_DISABLE_SUBMENU ++export GRUB_LINUX_KERNEL_GLOBS + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" diff --git a/sys-boot/grub/files/grub-2.06-test-words.patch b/sys-boot/grub/files/grub-2.06-test-words.patch new file mode 100644 index 000000000000..a3fe0602d2b4 --- /dev/null +++ b/sys-boot/grub/files/grub-2.06-test-words.patch @@ -0,0 +1,25 @@ +From 0f5080a2f3c952e2ee00bd271f42c56bb955dc19 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Sun, 14 Mar 2021 12:44:52 -0400 +Subject: [PATCH] Use /usr/share/dict/words as a 'compressible' file + +--- + tests/util/grub-fs-tester.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in +index bfc425e1f..efd2977b0 100644 +--- a/tests/util/grub-fs-tester.in ++++ b/tests/util/grub-fs-tester.in +@@ -265,7 +265,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do + MASTER="${tempdir}/master" + FSLABEL="grub_;/testé莭莽茝😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewrewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfew" + CFILESRC= +- for cand in /usr/share/dict/american-english /usr/share/dict/linux.words /data/data/com.termux/files/usr/share/hunspell/en_US.dic; do ++ for cand in /usr/share/dict/words; do + if test -f "$cand" ; then + CFILESRC="$cand" + break +-- +2.31.0.rc1 + diff --git a/sys-boot/grub/files/grub-2.12-fix-for-bash-completion-_split_longopt.patch b/sys-boot/grub/files/grub-2.12-fix-for-bash-completion-_split_longopt.patch new file mode 100644 index 000000000000..4496135c6603 --- /dev/null +++ b/sys-boot/grub/files/grub-2.12-fix-for-bash-completion-_split_longopt.patch @@ -0,0 +1,191 @@ +From 0876fdf215292a06ad087f862ae7677c85ae444f Mon Sep 17 00:00:00 2001 +From: Gary Lin <glin@suse.com> +Date: Mon, 25 Mar 2024 10:11:34 +0800 +Subject: util/bash-completion: Fix for bash-completion 2.12 + +_split_longopt() was the bash-completion private API and removed since +bash-completion 2.12. This commit initializes the bash-completion +general variables with _init_completion() to avoid the potential +"command not found" error. + +Although bash-completion 2.12 introduces _comp_initialize() to deprecate +_init_completion(), _init_completion() is still chosen for the better +backward compatibility. + +Signed-off-by: Gary Lin <glin@suse.com> +Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> +--- + util/bash-completion.d/grub-completion.bash.in | 61 ++++++++++---------------- + 1 file changed, 22 insertions(+), 39 deletions(-) + +(limited to 'util/bash-completion.d/grub-completion.bash.in') + +diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in +index 4c88ee901..749a5d3cf 100644 +--- a/util/bash-completion.d/grub-completion.bash.in ++++ b/util/bash-completion.d/grub-completion.bash.in +@@ -151,13 +151,10 @@ __grub_list_modules () { + # grub-set-default & grub-reboot + # + __grub_set_entry () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + --boot-directory) +@@ -180,11 +177,10 @@ __grub_set_entry () { + # grub-editenv + # + __grub_editenv () { +- local cur prev ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + create|list|set|unset) +@@ -201,10 +197,10 @@ __grub_editenv () { + # grub-mkconfig + # + __grub_mkconfig () { +- local cur prev ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +@@ -217,13 +213,10 @@ __grub_mkconfig () { + # grub-setup + # + __grub_setup () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + -d|--directory) +@@ -246,15 +239,12 @@ __grub_setup () { + # grub-install + # + __grub_install () { +- local cur prev last split=false ++ local cur prev words cword split last ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} + last=$(__grub_get_last_option) + +- _split_longopt && split=true +- + case "$prev" in + --boot-directory) + _filedir -d +@@ -287,10 +277,10 @@ __grub_install () { + # grub-mkfont + # + __grub_mkfont () { +- local cur ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +@@ -304,11 +294,10 @@ __grub_mkfont () { + # grub-mkrescue + # + __grub_mkrescue () { +- local cur prev last ++ local cur prev words cword last ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} + last=$(__grub_get_last_option) + + if [[ "$cur" == -* ]]; then +@@ -330,13 +319,10 @@ __grub_mkrescue () { + # grub-mkimage + # + __grub_mkimage () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + -d|--directory|-p|--prefix) +@@ -367,10 +353,10 @@ __grub_mkimage () { + # grub-mkpasswd-pbkdf2 + # + __grub_mkpasswd_pbkdf2 () { +- local cur ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +@@ -384,13 +370,10 @@ __grub_mkpasswd_pbkdf2 () { + # grub-probe + # + __grub_probe () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + -t|--target) +@@ -417,10 +400,10 @@ __grub_probe () { + # grub-script-check + # + __grub_script_check () { +- local cur ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +-- +cgit v1.2.3 + diff --git a/sys-boot/grub/files/grub-2.12-fwsetup.patch b/sys-boot/grub/files/grub-2.12-fwsetup.patch new file mode 100644 index 000000000000..d328d3f110ae --- /dev/null +++ b/sys-boot/grub/files/grub-2.12-fwsetup.patch @@ -0,0 +1,38 @@ +From 6e0b2277eba062bf7950536cd27f9789c545d20f Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Thu, 11 Apr 2024 15:33:45 -0400 +Subject: [PATCH] grub.d: avoid calling fwsetup unconditionally + +This causes grub to enter the firmware setup on boot when using a +grub core that does not support the 'fwsetup --is-supported' option. + +Upstream has rejected attempts to resolve this, so we will carry this as +a distro patch for a bit. + +Bug: https://bugs.gentoo.org/925370 +--- + util/grub.d/30_uefi-firmware.in | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in +index 1c2365ddb..b6041b55e 100644 +--- a/util/grub.d/30_uefi-firmware.in ++++ b/util/grub.d/30_uefi-firmware.in +@@ -32,11 +32,8 @@ gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 + + cat << EOF + if [ "\$grub_platform" = "efi" ]; then +- fwsetup --is-supported +- if [ "\$?" = 0 ]; then +- menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { +- fwsetup +- } +- fi ++ menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { ++ fwsetup ++ } + fi + EOF +-- +2.44.0 + diff --git a/sys-boot/grub/files/grub-2.12-zfs-zstd-compression-support.patch b/sys-boot/grub/files/grub-2.12-zfs-zstd-compression-support.patch new file mode 100644 index 000000000000..63862e7ab8f6 --- /dev/null +++ b/sys-boot/grub/files/grub-2.12-zfs-zstd-compression-support.patch @@ -0,0 +1,101 @@ +Patch fixes ZFS root filesystem dataset identification issues. + +This patch was mostly extracted from gub upstream commit f96df6fe9f6faa328c82820af88f14af07b2c9b9. +See Gentoo Bugzilla https://bugs.gentoo.org/956414 for further details. + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 7fa9446bd..705d73fab 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -1601,6 +1601,7 @@ module = { + common = fs/zfs/zfs_lz4.c; + common = fs/zfs/zfs_sha256.c; + common = fs/zfs/zfs_fletcher.c; ++ cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/zstd'; + }; + + module = { +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index b5453e006..3fdf9bda8 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -57,6 +57,8 @@ + #include <grub/i18n.h> + #include <grub/safemath.h> + ++#include <zstd.h> ++ + GRUB_MOD_LICENSE ("GPLv3+"); + + #define ZPOOL_PROP_BOOTFS "bootfs" +@@ -291,6 +293,9 @@ static const char *spa_feature_names[] = { + "com.delphix:embedded_data", + "com.delphix:extensible_dataset", + "org.open-zfs:large_blocks", ++ "com.klarasystems:vdev_zaps_v2", ++ "com.delphix:head_errlog", ++ "org.freebsd:zstd_compress", + NULL + }; + +@@ -312,6 +317,40 @@ zlib_decompress (void *s, void *d, + return grub_errno; + } + ++static grub_err_t ++zstd_decompress (void *ibuf, void *obuf, grub_size_t isize, ++ grub_size_t osize) ++{ ++ grub_size_t zstd_ret; ++ grub_uint32_t c_len; ++ grub_uint8_t *byte_buf = (grub_uint8_t *) ibuf; ++ ++ if (isize < 8) ++ return grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, "zstd data too short"); ++ ++ c_len = grub_be_to_cpu32 (grub_get_unaligned32 (byte_buf)); ++ ++ if (c_len > isize - 8) ++ return grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, ++ "zstd data announced size overflow"); ++ ++ /* ++ * ZFS uses non-stadard magic for zstd streams. Rather than adjusting ++ * library functions, replace non-standard magic with standard one. ++ */ ++ byte_buf[4] = 0x28; ++ byte_buf[5] = 0xb5; ++ byte_buf[6] = 0x2f; ++ byte_buf[7] = 0xfd; ++ zstd_ret = ZSTD_decompress (obuf, osize, byte_buf + 4, c_len + 4); ++ ++ if (ZSTD_isError (zstd_ret)) ++ return grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, ++ "zstd data corrupted (error %d)", (int) zstd_ret); ++ ++ return GRUB_ERR_NONE; ++} ++ + static grub_err_t + zle_decompress (void *s, void *d, + grub_size_t slen, grub_size_t dlen) +@@ -362,6 +401,7 @@ static decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = { + {"gzip-9", zlib_decompress}, /* ZIO_COMPRESS_GZIP9 */ + {"zle", zle_decompress}, /* ZIO_COMPRESS_ZLE */ + {"lz4", lz4_decompress}, /* ZIO_COMPRESS_LZ4 */ ++ {"zstd", zstd_decompress}, /* ZIO_COMPRESS_ZSTD */ + }; + + static grub_err_t zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian, +diff --git a/include/grub/zfs/zio.h b/include/grub/zfs/zio.h +index 19ce136bb..997b0c4d4 100644 +--- a/include/grub/zfs/zio.h ++++ b/include/grub/zfs/zio.h +@@ -89,6 +89,7 @@ enum zio_compress { + ZIO_COMPRESS_GZIP9, + ZIO_COMPRESS_ZLE, + ZIO_COMPRESS_LZ4, ++ ZIO_COMPRESS_ZSTD, + ZIO_COMPRESS_FUNCTIONS + }; + diff --git a/sys-boot/grub/files/grub-2.14-efi_uga.patch b/sys-boot/grub/files/grub-2.14-efi_uga.patch new file mode 100644 index 000000000000..51819d043184 --- /dev/null +++ b/sys-boot/grub/files/grub-2.14-efi_uga.patch @@ -0,0 +1,41 @@ +https://gitlab.freedesktop.org/gnu-grub/grub/-/merge_requests/10 + +From 129588e498647842c6f13f7809ef9ac583e2351b Mon Sep 17 00:00:00 2001 +From: Egor Ignatov <egori@altlinux.org> +Date: Thu, 19 Mar 2026 17:22:11 +0500 +Subject: [PATCH] util/grub.d/00_header.in: Load efi_uga only on x86 EFI + platforms + +The efi_uga module is only built for i386-efi and x86_64-efi firmware), but +commit ea0b76dc4a ("Disable loading all_video for EFI") loads it unconditionally +on all EFI platforms. This causes a "file not found" error on aarch64-efi and +other non-x86 EFI targets. + +Guard the insmod with a $grub_cpu check so the module is only +loaded where it is actually available. + +Fixes: ea0b76dc4 ("util/grub.d/00_header.in: Disable loading all_video for EFI") + +Signed-off-by: Egor Ignatov <egori@altlinux.org> +--- + util/grub.d/00_header.in | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index 77834cfaf..1afe41e67 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -135,7 +135,9 @@ else # GRUB_FORCE_EFI_ALL_VIDEO is not set true + cat <<EOF + if [ x\$grub_platform = xefi ]; then + insmod efi_gop +- insmod efi_uga ++ if [ x\$grub_cpu = xi386 -o x\$grub_cpu = xx86_64 ]; then ++ insmod efi_uga ++ fi + elif [ x\$feature_all_video_module = xy ]; then + EOF + fi # end GRUB_FORCE_EFI_ALL_VIDEO +-- +GitLab + diff --git a/sys-boot/grub/files/grub-2.14-gfxpayload.patch b/sys-boot/grub/files/grub-2.14-gfxpayload.patch new file mode 100644 index 000000000000..fd6722521bb9 --- /dev/null +++ b/sys-boot/grub/files/grub-2.14-gfxpayload.patch @@ -0,0 +1,39 @@ +https://bugs.gentoo.org/528826 +http://lists.gnu.org/archive/html/grub-devel/2014-10/msg00031.html +https://gitlab.freedesktop.org/gnu-grub/grub/-/merge_requests/98 + +From bcc760dc5de65fe2ae6ed37f68c01fc6a9793484 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Thu, 16 Oct 2014 23:43:51 -0400 +Subject: [PATCH] 10_linux: default gfxpayload=keep only when booting using EFI + +A given kernel may be compiled with CONFIG_FB_EFI, but may be booted in +legacy PC-BIOS mode. It is not safe to set gfxmode=keep under these +conditions, and this may result in a black screen once the kernel +starts. + +Signed-off-by: Mike Gilbert <floppym@gentoo.org> +Reviewed-by: Neal Gompa <neal@gompa.dev> +Reviewed-by: Leo Sandoval <lsandova@redhat.com> +--- + util/grub.d/10_linux.in | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 1233b112b..737e1c30c 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -118,7 +118,9 @@ linux_entry () + echo " load_video" | sed "s/^/$submenu_indentation/" + if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \ + && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then +- echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" ++ echo ' if [ "x$grub_platform" = xefi ]; then' | sed "s/^/$submenu_indentation/" ++ echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" ++ echo ' fi' | sed "s/^/$submenu_indentation/" + fi + else + if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then +-- +GitLab + diff --git a/sys-boot/grub/files/grub.default-4 b/sys-boot/grub/files/grub.default-4 new file mode 100644 index 000000000000..74f5d10aea3b --- /dev/null +++ b/sys-boot/grub/files/grub.default-4 @@ -0,0 +1,76 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# +# To populate all changes in this file you need to regenerate your +# grub configuration file afterwards: +# 'grub-mkconfig -o /boot/grub/grub.cfg' +# +# See the grub info page for documentation on possible variables and +# their associated values. + +GRUB_DISTRIBUTOR="Gentoo" + +# Default menu entry +#GRUB_DEFAULT=0 + +# Boot the default entry this many seconds after the menu is displayed +#GRUB_TIMEOUT=5 +#GRUB_TIMEOUT_STYLE=menu + +# Append parameters to the linux kernel command line +#GRUB_CMDLINE_LINUX="" +# +# Examples: +# +# Boot with network interface renaming disabled +# GRUB_CMDLINE_LINUX="net.ifnames=0" +# +# Boot with systemd instead of sysvinit (openrc) +# GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd" + +# Append parameters to the linux kernel command line for non-recovery entries +#GRUB_CMDLINE_LINUX_DEFAULT="" + +# Uncomment to disable graphical terminal (grub-pc only) +#GRUB_TERMINAL=console + +# Resolution used on graphical terminal. +# The list of valid modes may be obtained using the 'vbeinfo' (PC BIOS) or +# 'videoinfo' (EFI) command from a GRUB boot prompt. +#GRUB_GFXMODE=640x480 + +# Set to 'text' to force the Linux kernel to boot in normal text +# mode, 'keep' to preserve the graphics mode set using +# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular +# graphics mode, or a sequence of these separated by commas or +# semicolons to try several modes in sequence. +#GRUB_GFXPAYLOAD_LINUX= + +# Path to theme spec txt file. +# The starfield is by default provided with use truetype. +# NOTE: when enabling custom theme, ensure you have required font/etc. +#GRUB_THEME="/boot/grub/themes/starfield/theme.txt" + +# Background image used on graphical terminal. +# Can be in various bitmap formats. +#GRUB_BACKGROUND="/boot/grub/mybackground.png" + +# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel +#GRUB_DISABLE_LINUX_UUID=true + +# Comment if you don't want GRUB to pass "root=PARTUUID=xxx" parameter to kernel +GRUB_DISABLE_LINUX_PARTUUID=false + +# Uncomment to disable generation of recovery mode menu entries +#GRUB_DISABLE_RECOVERY=true + +# Uncomment to disable generation of the submenu and put all choices on +# the top-level menu. +# Besides the visual affect of no sub menu, this makes navigation of the +# menu easier for a user who can't see the screen. +#GRUB_DISABLE_SUBMENU=y + +# Uncomment to play a tone when the main menu is displayed. +# This is useful, for example, to allow users who can't see the screen +# to know when they can make a choice on the menu. +#GRUB_INIT_TUNE="60 800 1" diff --git a/sys-boot/grub/files/sbat.csv.in b/sys-boot/grub/files/sbat.csv.in new file mode 100644 index 000000000000..1c112393e8eb --- /dev/null +++ b/sys-boot/grub/files/sbat.csv.in @@ -0,0 +1,3 @@ +sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md +grub,@GEN_GRUB@,Free Software Foundation,grub,@PV@,https://www.gnu.org/software/grub/ +grub.gentoo,@GEN_GENTOO@,Gentoo,grub,@PVR@,https://bugs.gentoo.org/ diff --git a/sys-boot/grub/grub-2.12-r12.ebuild b/sys-boot/grub/grub-2.12-r12.ebuild new file mode 100644 index 000000000000..11be687c47ab --- /dev/null +++ b/sys-boot/grub/grub-2.12-r12.ebuild @@ -0,0 +1,446 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +# This ebuild uses 3 special global variables: +# GRUB_BOOTSTRAP: Depend on python and invoke bootstrap (gnulib). +# GRUB_AUTOGEN: Depend on python and invoke autogen.sh. +# GRUB_AUTORECONF: Inherit autotools and invoke eautoreconf. +# +# When applying patches: +# If gnulib is updated, set GRUB_BOOTSTRAP=1 +# If gentpl.py or *.def is updated, set GRUB_AUTOGEN=1 +# If gnulib, gentpl.py, *.def, or any autotools files are updated, set GRUB_AUTORECONF=1 +# +# If any of the above applies to a user patch, the user should set the +# corresponding variable in make.conf or the environment. + +GRUB_AUTOGEN=1 +GRUB_AUTORECONF=1 +PYTHON_COMPAT=( python3_{13..14} ) +WANT_LIBTOOL=none +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/grub.asc + +if [[ -n ${GRUB_AUTORECONF} ]]; then + inherit autotools +fi + +inherit bash-completion-r1 eapi9-ver flag-o-matic multibuild optfeature +inherit python-any-r1 secureboot toolchain-funcs + +DESCRIPTION="GNU GRUB boot loader" +HOMEPAGE="https://www.gnu.org/software/grub/" + +MY_P=${P} +if [[ ${PV} != 9999 ]]; then + inherit verify-sig + + if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then + # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860 + MY_P=${P/_/'~'} + SRC_URI=" + https://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz + verify-sig? ( https://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz.sig ) + " + S=${WORKDIR}/${MY_P} + else + SRC_URI=" + mirror://gnu/${PN}/${P}.tar.xz + https://dev.gentoo.org/~floppym/dist/${P}-bash-completion.patch.gz + verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig ) + " + S=${WORKDIR}/${P%_*} + fi + BDEPEND="verify-sig? ( sec-keys/openpgp-keys-grub )" + KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv ~sparc x86" +else + inherit git-r3 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/grub.git" +fi + +PATCHES=( + "${FILESDIR}"/gfxpayload.patch + "${FILESDIR}"/grub-2.02_beta2-KERNEL_GLOBS.patch + "${FILESDIR}"/grub-2.06-test-words.patch + "${FILESDIR}"/grub-2.12-fwsetup.patch + "${WORKDIR}"/grub-2.12-bash-completion.patch + "${FILESDIR}"/grub-2.12-zfs-zstd-compression-support.patch + "${FILESDIR}"/grub-2.12-fix-for-bash-completion-_split_longopt.patch +) + +DEJAVU=dejavu-sans-ttf-2.37 +UNIFONT=unifont-15.0.06 +SRC_URI+=" fonts? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz ) + themes? ( https://downloads.sourceforge.net/dejavu/${DEJAVU}.zip )" + +# Includes licenses for dejavu and unifont +LICENSE="GPL-3+ BSD MIT fonts? ( GPL-2-with-font-exception ) themes? ( CC-BY-SA-3.0 BitstreamVera )" +SLOT="2/${PVR}" +IUSE="+branding +device-mapper doc efiemu +fonts mount nls sdl test +themes truetype libzfs" + +GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot + qemu qemu-mips pc uboot xen xen-32 xen-pvh ) +IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}" + +REQUIRED_USE=" + grub_platforms_coreboot? ( fonts ) + grub_platforms_qemu? ( fonts ) + grub_platforms_ieee1275? ( fonts ) + grub_platforms_loongson? ( fonts ) +" + +BDEPEND+=" + ${PYTHON_DEPS} + >=sys-devel/flex-2.5.35 + sys-devel/bison + sys-apps/help2man + sys-apps/texinfo + fonts? ( + media-libs/freetype:2 + virtual/pkgconfig + ) + test? ( + app-admin/genromfs + app-alternatives/cpio + app-arch/lzop + app-emulation/qemu + dev-libs/libisoburn + sys-apps/miscfiles + sys-block/parted + sys-fs/squashfs-tools + ) + themes? ( + app-arch/unzip + media-libs/freetype:2 + virtual/pkgconfig + ) + truetype? ( virtual/pkgconfig ) +" +DEPEND=" + app-arch/xz-utils + >=sys-libs/ncurses-5.2-r5:0= + grub_platforms_emu? ( + sdl? ( media-libs/libsdl2 ) + ) + device-mapper? ( >=sys-fs/lvm2-2.02.45 ) + libzfs? ( sys-fs/zfs:= ) + mount? ( sys-fs/fuse:3= ) + truetype? ( media-libs/freetype:2= ) + ppc? ( >=sys-apps/ibm-powerpc-utils-1.3.5 ) + ppc64? ( >=sys-apps/ibm-powerpc-utils-1.3.5 ) +" +RDEPEND="${DEPEND} + branding? ( >=sys-boot/grub-themes-gentoo-1.0-r1 ) + kernel_linux? ( + grub_platforms_efi-32? ( sys-boot/efibootmgr ) + grub_platforms_efi-64? ( sys-boot/efibootmgr ) + ) + !sys-boot/grub:0 + nls? ( sys-devel/gettext ) +" + +RESTRICT="!test? ( test ) test? ( userpriv )" + +QA_EXECSTACK="usr/bin/grub-emu* usr/lib/grub/*" +QA_PRESTRIPPED="usr/lib/grub/.*" +QA_MULTILIB_PATHS="usr/lib/grub/.*" +QA_WX_LOAD="usr/lib/grub/*" + +pkg_setup() { + # skip python-any-r1_pkg_setup: python_setup is called in src_prepare + secureboot_pkg_setup +} + +src_unpack() { + if [[ ${PV} == 9999 ]]; then + git-r3_src_unpack + pushd "${P}" >/dev/null || die + local GNULIB_URI="https://git.savannah.gnu.org/git/gnulib.git" + local GNULIB_REVISION=$(source bootstrap.conf >/dev/null; echo "${GNULIB_REVISION}") + git-r3_fetch "${GNULIB_URI}" "${GNULIB_REVISION}" + git-r3_checkout "${GNULIB_URI}" gnulib + popd >/dev/null || die + elif use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.sig} + fi + default +} + +src_prepare() { + default + + python_setup + + if [[ -n ${GRUB_BOOTSTRAP} ]]; then + eautopoint --force + AUTOPOINT=: AUTORECONF=: ./bootstrap || die + elif [[ -n ${GRUB_AUTOGEN} ]]; then + FROM_BOOTSTRAP=1 ./autogen.sh || die + fi + + if [[ -n ${GRUB_AUTORECONF} ]]; then + eautoreconf + fi + + # Avoid error due to extra_deps.lst missing from source tarball: + # make[3]: *** No rule to make target 'grub-core/extra_deps.lst', needed by 'syminfo.lst'. Stop. + echo "depends bli part_gpt" > grub-core/extra_deps.lst || die +} + +grub_do() { + multibuild_foreach_variant run_in_build_dir "$@" +} + +grub_do_once() { + multibuild_for_best_variant run_in_build_dir "$@" +} + +grub_configure() { + local platform + + case ${MULTIBUILD_VARIANT} in + efi*) platform=efi ;; + xen-pvh) platform=xen_pvh ;; + xen*) platform=xen ;; + guessed) ;; + *) platform=${MULTIBUILD_VARIANT} ;; + esac + + case ${MULTIBUILD_VARIANT} in + *-32) + if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then + local CTARGET=i386 + fi ;; + *-64) + if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then + local CTARGET=x86_64 + local -x TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}" + local -x TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}" + fi ;; + esac + + local myeconfargs=( + --disable-werror + --program-prefix= + --libdir="${EPREFIX}"/usr/lib + $(use_enable device-mapper) + $(use_enable mount grub-mount) + $(use_enable nls) + $(use_enable themes grub-themes) + $(use_enable truetype grub-mkfont) + $(use_enable libzfs) + --enable-grub-emu-sdl=no + $(use_enable sdl grub-emu-sdl2) + ${platform:+--with-platform=}${platform} + + # Let configure detect this where supported + $(usex efiemu '' '--disable-efiemu') + ) + + if use fonts; then + ln -rs "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die + fi + + if use themes; then + ln -rs "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die + fi + + local ECONF_SOURCE="${S}" + econf "${myeconfargs[@]}" +} + +src_configure() { + # Bug 508758. + replace-flags -O3 -O2 + + # Workaround for bug 829165. + filter-ldflags -pie + + # We don't want to leak flags onto boot code. + export HOST_CCASFLAGS=${CCASFLAGS} + export HOST_CFLAGS=${CFLAGS} + export HOST_CPPFLAGS=${CPPFLAGS} + export HOST_LDFLAGS=${LDFLAGS} + unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS + + tc-ld-disable-gold #439082 #466536 #526348 + export TARGET_LDFLAGS="${TARGET_LDFLAGS} ${LDFLAGS}" + unset LDFLAGS + + tc-export CC NM OBJCOPY RANLIB STRIP + tc-export BUILD_CC BUILD_PKG_CONFIG + + # Force configure to use flex & bison, bug 887211. + export LEX=flex + unset YACC + + local sedargs=( + -e "s/@PV@/${PV}/" + -e "s/@PVR@/${PVR}/" + -e "s/@GEN_GRUB@/4/" + -e "s/@GEN_GENTOO@/1/" + ) + sed "${sedargs[@]}" "${FILESDIR}/sbat.csv.in" > "${WORKDIR}/sbat.csv" || die + + MULTIBUILD_VARIANTS=() + local p + for p in "${GRUB_ALL_PLATFORMS[@]}"; do + use "grub_platforms_${p}" && MULTIBUILD_VARIANTS+=( "${p}" ) + done + [[ ${#MULTIBUILD_VARIANTS[@]} -eq 0 ]] && MULTIBUILD_VARIANTS=( guessed ) + grub_do grub_configure +} + +src_compile() { + # Sandbox bug 404013. + use libzfs && { addpredict /etc/dfs; addpredict /dev/zfs; } + + grub_do emake + use doc && grub_do_once emake -C docs html +} + +src_test() { + # The qemu dependency is a bit complex. + # You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform. + local SANDBOX_WRITE=${SANDBOX_WRITE} + addwrite /dev + grub_do emake -j1 check +} + +grub_mkstandalone_secureboot() { + use secureboot || return + + if tc-is-cross-compiler; then + ewarn "USE=secureboot is not supported when cross-compiling." + ewarn "No standalone EFI executable will be built." + return 1 + fi + + local standalone_targets + + case ${CTARGET:-${CHOST}} in + i?86* | x86_64*) + use grub_platforms_efi-32 && standalone_targets+=( i386-efi ) + use grub_platforms_efi-64 && standalone_targets+=( x86_64-efi ) + ;; + arm* | aarch64*) + use grub_platforms_efi-32 && standalone_targets+=( arm-efi ) + use grub_platforms_efi-64 && standalone_targets+=( arm64-efi ) + ;; + riscv*) + use grub_platforms_efi-32 && standalone_targets+=( riscv32-efi ) + use grub_platforms_efi-64 && standalone_targets+=( riscv64-efi ) + ;; + ia64*) + use grub_platforms_efi-64 && standalone_targets+=( ia64-efi ) + ;; + loongarch64*) + use grub_platforms_efi-64 && standalone_targets+=( loongarch64-efi ) + ;; + esac + + if [[ ${#standalone_targets[@]} -eq 0 ]]; then + ewarn "USE=secureboot is enabled, but no suitable EFI target in GRUB_PLATFORMS." + ewarn "No standalone EFI executable will be built." + return 1 + fi + + local target mkstandalone_args + + # grub-mkstandalone embeds a config file, make this config file chainload + # a config file in the same directory grub is installed in. This requires + # pre-loading the part_gpt and part_msdos modules. + echo 'configfile ${cmdpath}/grub.cfg' > "${T}/grub.cfg" || die + for target in "${standalone_targets[@]}"; do + ebegin "Building standalone EFI executable for ${target}" + mkstandalone_args=( + --verbose + --directory="${ED}/usr/lib/grub/${target}" + --locale-directory="${ED}/usr/share/locale" + --format="${target}" + --modules="part_gpt part_msdos" + --sbat="${ED}/usr/share/grub/sbat.csv" + --output="${ED}/usr/lib/grub/grub-${target%-efi}.efi" + "boot/grub/grub.cfg=${T}/grub.cfg" + ) + + "${ED}/usr/bin/grub-mkstandalone" "${mkstandalone_args[@]}" + eend ${?} || die "grub-mkstandalone failed to build EFI executable" + done + + secureboot_auto_sign +} + +src_install() { + grub_do emake install DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)" + use doc && grub_do_once emake -C docs install-html DESTDIR="${D}" + + einstalldocs + + insinto /etc/default + newins "${FILESDIR}"/grub.default-4 grub + + if use branding && use themes ; then + sed -i -e 's:^#GRUB_THEME=.*$:GRUB_THEME="/boot/grub/themes/gentoo_glass/theme.txt":g' \ + "${ED}/etc/default/grub" || die + fi + + # https://bugs.gentoo.org/231935 + dostrip -x /usr/lib/grub + + insinto /usr/share/grub + doins "${WORKDIR}/sbat.csv" + + if use elibc_musl; then + # https://bugs.gentoo.org/900348 + QA_CONFIG_IMPL_DECL_SKIP=( re_{compile_pattern,match,search,set_syntax} ) + fi + + grub_mkstandalone_secureboot +} + +pkg_postinst() { + elog "For information on how to configure GRUB2 please refer to the guide:" + elog " https://wiki.gentoo.org/wiki/GRUB2_Quick_Start" + + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog + optfeature "detecting other operating systems (grub-mkconfig)" sys-boot/os-prober + optfeature "creating rescue media (grub-mkrescue)" dev-libs/libisoburn sys-fs/mtools + optfeature "enabling RAID device detection" sys-fs/mdadm + optfeature "automatically updating GRUB's configuration on each kernel installation" "sys-kernel/installkernel[grub]" + elif ver_replacing -lt ${PVR}; then + ewarn + ewarn "Re-run grub-install to update installed boot code!" + ewarn "Re-run grub-mkconfig to update grub.cfg!" + ewarn + fi + + if has_version 'sys-boot/grub:0'; then + elog "A migration guide for GRUB Legacy users is available:" + elog " https://wiki.gentoo.org/wiki/GRUB2_Migration" + fi + + if has_version sys-boot/os-prober; then + ewarn "Due to security concerns, os-prober is disabled by default." + ewarn "Set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub to enable it." + fi + + if use secureboot; then + elog + elog "The signed standalone grub EFI executable(s) are available in:" + elog " /usr/lib/grub/grub-<target>.efi(.signed)" + elog "These EFI executables should be copied to the usual location at:" + elog " ESP/EFI/Gentoo/grub<arch>.efi" + elog "Note that 'grub-install' does not install these images." + elog + elog "These standalone grub executables read the grub config file from" + elog "the grub.cfg in the same directory instead of the default" + elog "/boot/grub/grub.cfg. When sys-kernel/installkernel[grub] is used," + elog "the location of the grub.cfg may be overridden by setting the" + elog "GRUB_CFG environment variable:" + elog " GRUB_CFG=ESP/EFI/Gentoo/grub.cfg" + elog + fi +} diff --git a/sys-boot/grub/grub-2.14-r5.ebuild b/sys-boot/grub/grub-2.14-r5.ebuild new file mode 100644 index 000000000000..db9cd2c7e1d2 --- /dev/null +++ b/sys-boot/grub/grub-2.14-r5.ebuild @@ -0,0 +1,464 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# This ebuild uses 3 special global variables: +# GRUB_BOOTSTRAP: Invoke bootstrap (gnulib) +# GRUB_AUTOGEN: Invoke autogen.sh +# GRUB_AUTORECONF: Inherit autotools and invoke eautoreconf +# +# When applying patches: +# If gnulib is updated, set GRUB_BOOTSTRAP=1 +# If gentpl.py or *.def is updated, set GRUB_AUTOGEN=1 +# If gnulib, gentpl.py, *.def, or any autotools files are updated, set GRUB_AUTORECONF=1 +# +# If any of the above applies to a user patch, the user should set the +# corresponding variable in make.conf or the environment. + +GRUB_AUTOGEN=1 +GRUB_AUTORECONF=1 + +PYTHON_COMPAT=( python3_{13..14} ) +WANT_LIBTOOL=none + +if [[ -n ${GRUB_AUTORECONF} ]]; then + inherit autotools +fi + +inherit bash-completion-r1 eapi9-pipestatus eapi9-ver flag-o-matic multibuild optfeature +inherit python-any-r1 secureboot toolchain-funcs verify-sig + +DESCRIPTION="GNU GRUB boot loader" +HOMEPAGE="https://www.gnu.org/software/grub/" + +MY_P=${P} +if [[ ${PV} != 9999 ]]; then + if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then + # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860 + MY_P=${P/_/'~'} + SRC_URI=" + https://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz + verify-sig? ( https://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz.sig ) + " + S=${WORKDIR}/${MY_P} + else + SRC_URI=" + mirror://gnu/${PN}/${P}.tar.xz + verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig ) + https://dev.gentoo.org/~floppym/dist/${P}-patches.tar.xz + " + S=${WORKDIR}/${P%_*} + fi + BDEPEND=" + verify-sig? ( + sec-keys/openpgp-keys-grub + sec-keys/openpgp-keys-unifont + ) + " + KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv ~sparc x86" +else + inherit git-r3 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/grub.git" +fi + +DEJAVU_VER=2.37 +DEJAVU=dejavu-fonts-ttf-${DEJAVU_VER} +UNIFONT=unifont-17.0.02 +SRC_URI+=" + fonts? ( + mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz + verify-sig? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz.sig ) + ) + themes? ( https://downloads.sourceforge.net/project/dejavu/dejavu/${DEJAVU_VER}/${DEJAVU}.tar.bz2 ) +" + +# Includes licenses for dejavu and unifont +LICENSE="GPL-3+ BSD MIT fonts? ( GPL-2-with-font-exception ) themes? ( CC-BY-SA-3.0 BitstreamVera )" +SLOT="2/${PVR}" +IUSE="+branding +device-mapper doc efiemu +fonts mount nls protect sdl test +themes truetype libzfs" + +GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot + qemu qemu-mips pc uboot xen xen-32 xen-pvh ) +IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}" + +REQUIRED_USE=" + grub_platforms_coreboot? ( fonts ) + grub_platforms_qemu? ( fonts ) + grub_platforms_ieee1275? ( fonts ) + grub_platforms_loongson? ( fonts ) +" + +BDEPEND+=" + ${PYTHON_DEPS} + >=sys-devel/flex-2.5.35 + sys-devel/bison + sys-apps/help2man + sys-apps/texinfo + fonts? ( + media-libs/freetype:2 + virtual/pkgconfig + ) + test? ( + app-admin/genromfs + app-alternatives/cpio + app-arch/lzop + app-emulation/qemu + dev-libs/libisoburn + sys-apps/miscfiles + sys-block/parted + sys-fs/squashfs-tools + ) + themes? ( + media-libs/freetype:2 + virtual/pkgconfig + ) + truetype? ( virtual/pkgconfig ) +" +DEPEND=" + app-arch/xz-utils + >=sys-libs/ncurses-5.2-r5:0= + grub_platforms_emu? ( + sdl? ( media-libs/libsdl2 ) + ) + device-mapper? ( >=sys-fs/lvm2-2.02.45 ) + libzfs? ( sys-fs/zfs:= ) + mount? ( sys-fs/fuse:3= ) + truetype? ( media-libs/freetype:2= ) + ppc? ( >=sys-apps/ibm-powerpc-utils-1.3.5 ) + ppc64? ( >=sys-apps/ibm-powerpc-utils-1.3.5 ) + protect? ( dev-libs/libtasn1:= ) +" +RDEPEND="${DEPEND} + branding? ( themes? ( >=sys-boot/grub-themes-gentoo-1.0-r1 ) ) + kernel_linux? ( + grub_platforms_efi-32? ( sys-boot/efibootmgr ) + grub_platforms_efi-64? ( sys-boot/efibootmgr ) + ) + !sys-boot/grub:0 + nls? ( sys-devel/gettext ) +" + +RESTRICT="!test? ( test ) test? ( userpriv )" + +QA_EXECSTACK="usr/bin/grub-emu* usr/lib/grub/*" +QA_PRESTRIPPED="usr/lib/grub/.*" +QA_MULTILIB_PATHS="usr/lib/grub/.*" +QA_WX_LOAD="usr/lib/grub/*" + +pkg_setup() { + # skip python-any-r1_pkg_setup: python_setup is called in src_prepare + secureboot_pkg_setup +} + +src_unpack() { + if [[ ${PV} == 9999 ]]; then + git-r3_src_unpack + pushd "${P}" >/dev/null || die + local GNULIB_URI="https://git.savannah.gnu.org/git/gnulib.git" + local GNULIB_REVISION=$(source bootstrap.conf >/dev/null; echo "${GNULIB_REVISION}") + git-r3_fetch "${GNULIB_URI}" "${GNULIB_REVISION}" + git-r3_checkout "${GNULIB_URI}" gnulib + if use nls; then + sh linguas.sh || die + fi + popd >/dev/null || die + elif use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.sig} \ + "${BROOT}"/usr/share/openpgp-keys/grub.asc + fi + if use fonts && use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${UNIFONT}.pcf.gz{,.sig} \ + "${BROOT}"/usr/share/openpgp-keys/unifont.asc + fi + default +} + +src_prepare() { + # Bug 971544 + find grub-core/lib/gnulib -name '*.in.h' | sed 's/.in.h$/.h/' | xargs rm -fv + pipestatus || die + + local PATCHES=( + "${WORKDIR}/${P}-patches" + "${FILESDIR}/${P}-efi_uga.patch" + "${FILESDIR}/${P}-gfxpayload.patch" + ) + + default + + python_setup + + if [[ -n ${GRUB_BOOTSTRAP} ]]; then + eautopoint --force + AUTOPOINT=: AUTORECONF=: ./bootstrap --skip-po || die + elif [[ -n ${GRUB_AUTOGEN} ]]; then + FROM_BOOTSTRAP=1 ./autogen.sh || die + fi + + if [[ -n ${GRUB_AUTORECONF} ]]; then + eautoreconf + fi +} + +grub_do() { + multibuild_foreach_variant run_in_build_dir "$@" +} + +grub_do_once() { + multibuild_for_best_variant run_in_build_dir "$@" +} + +grub_configure() { + local platform + + case ${MULTIBUILD_VARIANT} in + efi*) platform=efi ;; + xen-pvh) platform=xen_pvh ;; + xen*) platform=xen ;; + guessed) ;; + *) platform=${MULTIBUILD_VARIANT} ;; + esac + + case ${MULTIBUILD_VARIANT} in + *-32) + if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then + local CTARGET=i386 + fi ;; + *-64) + if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then + local CTARGET=x86_64 + local -x TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}" + local -x TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}" + fi ;; + esac + + local myeconfargs=( + --disable-werror + --program-prefix= + --libdir="${EPREFIX}"/usr/lib + $(use_enable device-mapper) + $(use_enable mount grub-mount) + $(use_enable nls) + $(use_enable protect grub-protect) + $(use_enable themes grub-themes) + $(use_enable truetype grub-mkfont) + $(use_enable libzfs) + --enable-grub-emu-sdl=no + $(use_enable sdl grub-emu-sdl2) + ${platform:+--with-platform=}${platform} + + # Let configure detect this where supported + $(usex efiemu '' '--disable-efiemu') + ) + + if use fonts; then + cp "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die + fi + + if use themes; then + cp "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die + fi + + local ECONF_SOURCE="${S}" + econf "${myeconfargs[@]}" +} + +src_configure() { + # Bug 508758. + replace-flags -O3 -O2 + + # Workaround for bug 829165. + filter-ldflags -pie + + # We don't want to leak flags onto boot code. + export HOST_CCASFLAGS=${CCASFLAGS} + export HOST_CFLAGS=${CFLAGS} + export HOST_CPPFLAGS=${CPPFLAGS} + export HOST_LDFLAGS=${LDFLAGS} + unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS + + tc-ld-disable-gold #439082 #466536 #526348 + export TARGET_LDFLAGS="${TARGET_LDFLAGS} ${LDFLAGS}" + unset LDFLAGS + + tc-export CC NM OBJCOPY RANLIB STRIP + tc-export BUILD_CC BUILD_PKG_CONFIG + + # Force configure to use flex & bison, bug 887211. + export LEX=flex + unset YACC + + local sedargs=( + -e "s/@PV@/${PV}/" + -e "s/@PVR@/${PVR}/" + -e "s/@GEN_GRUB@/5/" + -e "s/@GEN_GENTOO@/1/" + ) + sed "${sedargs[@]}" "${FILESDIR}/sbat.csv.in" > "${WORKDIR}/sbat.csv" || die + + MULTIBUILD_VARIANTS=() + local p + for p in "${GRUB_ALL_PLATFORMS[@]}"; do + use "grub_platforms_${p}" && MULTIBUILD_VARIANTS+=( "${p}" ) + done + [[ ${#MULTIBUILD_VARIANTS[@]} -eq 0 ]] && MULTIBUILD_VARIANTS=( guessed ) + grub_do grub_configure +} + +src_compile() { + # Sandbox bug 404013. + if use libzfs; then + addpredict /etc/dfs + addpredict /dev/zfs + fi + + grub_do emake + use doc && grub_do_once emake -C docs html +} + +src_test() { + # The qemu dependency is a bit complex. + # You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform. + local SANDBOX_WRITE=${SANDBOX_WRITE} + addwrite /dev + grub_do emake -j1 check +} + +grub_mkstandalone_secureboot() { + use secureboot || return + + if tc-is-cross-compiler; then + ewarn "USE=secureboot is not supported when cross-compiling." + ewarn "No standalone EFI executable will be built." + return 1 + fi + + local standalone_targets + + case ${CTARGET:-${CHOST}} in + i?86* | x86_64*) + use grub_platforms_efi-32 && standalone_targets+=( i386-efi ) + use grub_platforms_efi-64 && standalone_targets+=( x86_64-efi ) + ;; + arm* | aarch64*) + use grub_platforms_efi-32 && standalone_targets+=( arm-efi ) + use grub_platforms_efi-64 && standalone_targets+=( arm64-efi ) + ;; + riscv*) + use grub_platforms_efi-32 && standalone_targets+=( riscv32-efi ) + use grub_platforms_efi-64 && standalone_targets+=( riscv64-efi ) + ;; + ia64*) + use grub_platforms_efi-64 && standalone_targets+=( ia64-efi ) + ;; + loongarch64*) + use grub_platforms_efi-64 && standalone_targets+=( loongarch64-efi ) + ;; + esac + + if [[ ${#standalone_targets[@]} -eq 0 ]]; then + ewarn "USE=secureboot is enabled, but no suitable EFI target in GRUB_PLATFORMS." + ewarn "No standalone EFI executable will be built." + return 1 + fi + + local target mkstandalone_args + + # grub-mkstandalone embeds a config file, make this config file chainload + # a config file in the same directory grub is installed in. This requires + # pre-loading the part_gpt and part_msdos modules. + echo 'configfile ${cmdpath}/grub.cfg' > "${T}/grub.cfg" || die + for target in "${standalone_targets[@]}"; do + ebegin "Building standalone EFI executable for ${target}" + mkstandalone_args=( + --verbose + --directory="${ED}/usr/lib/grub/${target}" + --locale-directory="${ED}/usr/share/locale" + --format="${target}" + --modules="part_gpt part_msdos" + --sbat="${ED}/usr/share/grub/sbat.csv" + --output="${ED}/usr/lib/grub/grub-${target%-efi}.efi" + "boot/grub/grub.cfg=${T}/grub.cfg" + ) + + "${ED}/usr/bin/grub-mkstandalone" "${mkstandalone_args[@]}" + eend ${?} || die "grub-mkstandalone failed to build EFI executable" + done + + secureboot_auto_sign +} + +src_install() { + grub_do emake install DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)" + use doc && grub_do_once emake -C docs install-html DESTDIR="${D}" + + einstalldocs + + insinto /etc/default + newins "${FILESDIR}"/grub.default-4 grub + + if use branding && use themes ; then + sed -i -e 's:^#GRUB_THEME=.*$:GRUB_THEME="/boot/grub/themes/gentoo_glass/theme.txt":g' \ + "${ED}/etc/default/grub" || die + fi + + # https://bugs.gentoo.org/231935 + dostrip -x /usr/lib/grub + + insinto /usr/share/grub + doins "${WORKDIR}/sbat.csv" + + if use elibc_musl; then + # https://bugs.gentoo.org/900348 + QA_CONFIG_IMPL_DECL_SKIP=( re_{compile_pattern,match,search,set_syntax} ) + fi + + grub_mkstandalone_secureboot +} + +pkg_postinst() { + elog "For information on how to configure GRUB2 please refer to the guide:" + elog " https://wiki.gentoo.org/wiki/GRUB2_Quick_Start" + + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog + optfeature "detecting other operating systems (grub-mkconfig)" sys-boot/os-prober + optfeature "creating rescue media (grub-mkrescue)" dev-libs/libisoburn sys-fs/mtools + optfeature "enabling RAID device detection" sys-fs/mdadm + optfeature "automatically updating GRUB's configuration on each kernel installation" "sys-kernel/installkernel[grub]" + elif ver_replacing -lt ${PVR}; then + ewarn + ewarn "Re-run grub-install to update installed boot code!" + ewarn "Re-run grub-mkconfig to update grub.cfg!" + ewarn + fi + + if has_version sys-boot/os-prober; then + ewarn "Due to security concerns, os-prober is disabled by default." + ewarn "Set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub to enable it." + fi + + if grep -q GRUB_LINUX_KERNEL_GLOBS "${EROOT}"/etc/default/grub; then + ewarn "Support for GRUB_LINUX_KERNEL_GLOBS has been dropped." + ewarn "Ensure that your kernels are named appropriately or edit" + ewarn "/etc/grub.d/10_linux to compensate." + fi + + if use secureboot; then + elog + elog "The signed standalone grub EFI executable(s) are available in:" + elog " /usr/lib/grub/grub-<target>.efi(.signed)" + elog "These EFI executables should be copied to the usual location at:" + elog " ESP/EFI/Gentoo/grub<arch>.efi" + elog "Note that 'grub-install' does not install these images." + elog + elog "These standalone grub executables read the grub config file from" + elog "the grub.cfg in the same directory instead of the default" + elog "/boot/grub/grub.cfg. When sys-kernel/installkernel[grub] is used," + elog "the location of the grub.cfg may be overridden by setting the" + elog "GRUB_CFG environment variable:" + elog " GRUB_CFG=ESP/EFI/Gentoo/grub.cfg" + elog + fi +} diff --git a/sys-boot/grub/grub-9999.ebuild b/sys-boot/grub/grub-9999.ebuild new file mode 100644 index 000000000000..1db1921bc15e --- /dev/null +++ b/sys-boot/grub/grub-9999.ebuild @@ -0,0 +1,455 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# This ebuild uses 3 special global variables: +# GRUB_BOOTSTRAP: Invoke bootstrap (gnulib) +# GRUB_AUTOGEN: Invoke autogen.sh +# GRUB_AUTORECONF: Inherit autotools and invoke eautoreconf +# +# When applying patches: +# If gnulib is updated, set GRUB_BOOTSTRAP=1 +# If gentpl.py or *.def is updated, set GRUB_AUTOGEN=1 +# If gnulib, gentpl.py, *.def, or any autotools files are updated, set GRUB_AUTORECONF=1 +# +# If any of the above applies to a user patch, the user should set the +# corresponding variable in make.conf or the environment. + +if [[ ${PV} == 9999 ]]; then + GRUB_AUTORECONF=1 + GRUB_BOOTSTRAP=1 +fi + +PYTHON_COMPAT=( python3_{13..14} ) +WANT_LIBTOOL=none + +if [[ -n ${GRUB_AUTORECONF} ]]; then + inherit autotools +fi + +inherit bash-completion-r1 eapi9-ver flag-o-matic multibuild optfeature +inherit python-any-r1 secureboot toolchain-funcs verify-sig + +DESCRIPTION="GNU GRUB boot loader" +HOMEPAGE="https://gnu-grub.freedesktop.org/" + +MY_P=${P} +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.freedesktop.org/gnu-grub/grub.git" +else + if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then + # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860 + MY_P=${P/_/'~'} + SRC_URI=" + https://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz + verify-sig? ( https://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz.sig ) + " + S=${WORKDIR}/${MY_P} + else + SRC_URI=" + mirror://gnu/${PN}/${P}.tar.xz + verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig ) + " + S=${WORKDIR}/${P%_*} + fi + BDEPEND=" + verify-sig? ( + sec-keys/openpgp-keys-grub + sec-keys/openpgp-keys-unifont + ) + " + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +DEJAVU_VER=2.37 +DEJAVU=dejavu-fonts-ttf-${DEJAVU_VER} +UNIFONT=unifont-17.0.02 +SRC_URI+=" + fonts? ( + mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz + verify-sig? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz.sig ) + ) + themes? ( https://downloads.sourceforge.net/project/dejavu/dejavu/${DEJAVU_VER}/${DEJAVU}.tar.bz2 ) +" + +# Includes licenses for dejavu and unifont +LICENSE="GPL-3+ BSD MIT fonts? ( GPL-2-with-font-exception ) themes? ( CC-BY-SA-3.0 BitstreamVera )" +SLOT="2/${PVR}" +IUSE="+branding +device-mapper doc efiemu +fonts mount nls protect sdl test +themes truetype libzfs" + +GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot + qemu qemu-mips pc uboot xen xen-32 xen-pvh ) +IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}" + +REQUIRED_USE=" + grub_platforms_coreboot? ( fonts ) + grub_platforms_qemu? ( fonts ) + grub_platforms_ieee1275? ( fonts ) + grub_platforms_loongson? ( fonts ) +" + +BDEPEND+=" + ${PYTHON_DEPS} + >=sys-devel/flex-2.5.35 + sys-devel/bison + sys-apps/help2man + sys-apps/texinfo + fonts? ( + media-libs/freetype:2 + virtual/pkgconfig + ) + test? ( + app-admin/genromfs + app-alternatives/cpio + app-arch/lzop + app-emulation/qemu + dev-libs/libisoburn + sys-apps/miscfiles + sys-block/parted + sys-fs/squashfs-tools + ) + themes? ( + media-libs/freetype:2 + virtual/pkgconfig + ) + truetype? ( virtual/pkgconfig ) +" +DEPEND=" + app-arch/xz-utils + >=sys-libs/ncurses-5.2-r5:0= + grub_platforms_emu? ( + sdl? ( media-libs/libsdl2 ) + ) + device-mapper? ( >=sys-fs/lvm2-2.02.45 ) + libzfs? ( sys-fs/zfs:= ) + mount? ( sys-fs/fuse:3= ) + truetype? ( media-libs/freetype:2= ) + ppc? ( >=sys-apps/ibm-powerpc-utils-1.3.5 ) + ppc64? ( >=sys-apps/ibm-powerpc-utils-1.3.5 ) + protect? ( dev-libs/libtasn1:= ) +" +RDEPEND="${DEPEND} + branding? ( themes? ( >=sys-boot/grub-themes-gentoo-1.0-r1 ) ) + kernel_linux? ( + grub_platforms_efi-32? ( sys-boot/efibootmgr ) + grub_platforms_efi-64? ( sys-boot/efibootmgr ) + ) + !sys-boot/grub:0 + nls? ( sys-devel/gettext ) +" + +RESTRICT="!test? ( test ) test? ( userpriv )" + +QA_EXECSTACK="usr/bin/grub-emu* usr/lib/grub/*" +QA_PRESTRIPPED="usr/lib/grub/.*" +QA_MULTILIB_PATHS="usr/lib/grub/.*" +QA_WX_LOAD="usr/lib/grub/*" + +pkg_setup() { + # skip python-any-r1_pkg_setup: python_setup is called in src_prepare + secureboot_pkg_setup +} + +src_unpack() { + if [[ ${PV} == 9999 ]]; then + git-r3_src_unpack + pushd "${P}" >/dev/null || die + local GNULIB_URI="https://git.savannah.gnu.org/git/gnulib.git" + local GNULIB_REVISION=$(source bootstrap.conf >/dev/null; echo "${GNULIB_REVISION}") + git-r3_fetch "${GNULIB_URI}" "${GNULIB_REVISION}" + git-r3_checkout "${GNULIB_URI}" gnulib + if use nls; then + sh linguas.sh || die + fi + popd >/dev/null || die + elif use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.sig} \ + "${BROOT}"/usr/share/openpgp-keys/grub.asc + fi + if use fonts && use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${UNIFONT}.pcf.gz{,.sig} \ + "${BROOT}"/usr/share/openpgp-keys/unifont.asc + fi + default +} + +src_prepare() { + default + + python_setup + + if [[ -n ${GRUB_BOOTSTRAP} ]]; then + eautopoint --force + AUTOPOINT=: AUTORECONF=: ./bootstrap --skip-po || die + elif [[ -n ${GRUB_AUTOGEN} ]]; then + FROM_BOOTSTRAP=1 ./autogen.sh || die + fi + + if [[ -n ${GRUB_AUTORECONF} ]]; then + eautoreconf + fi +} + +grub_do() { + multibuild_foreach_variant run_in_build_dir "$@" +} + +grub_do_once() { + multibuild_for_best_variant run_in_build_dir "$@" +} + +grub_configure() { + local platform + + case ${MULTIBUILD_VARIANT} in + efi*) platform=efi ;; + xen-pvh) platform=xen_pvh ;; + xen*) platform=xen ;; + guessed) ;; + *) platform=${MULTIBUILD_VARIANT} ;; + esac + + case ${MULTIBUILD_VARIANT} in + *-32) + if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then + local CTARGET=i386 + fi ;; + *-64) + if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then + local CTARGET=x86_64 + local -x TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}" + local -x TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}" + fi ;; + esac + + local myeconfargs=( + --disable-werror + --program-prefix= + --libdir="${EPREFIX}"/usr/lib + $(use_enable device-mapper) + $(use_enable mount grub-mount) + $(use_enable nls) + $(use_enable protect grub-protect) + $(use_enable themes grub-themes) + $(use_enable truetype grub-mkfont) + $(use_enable libzfs) + --enable-grub-emu-sdl=no + $(use_enable sdl grub-emu-sdl2) + ${platform:+--with-platform=}${platform} + + # Let configure detect this where supported + $(usex efiemu '' '--disable-efiemu') + ) + + if use fonts; then + cp "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die + fi + + if use themes; then + cp "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die + fi + + local ECONF_SOURCE="${S}" + econf "${myeconfargs[@]}" +} + +src_configure() { + # Bug 508758. + replace-flags -O3 -O2 + + # Workaround for bug 829165. + filter-ldflags -pie + + # We don't want to leak flags onto boot code. + export HOST_CCASFLAGS=${CCASFLAGS} + export HOST_CFLAGS=${CFLAGS} + export HOST_CPPFLAGS=${CPPFLAGS} + export HOST_LDFLAGS=${LDFLAGS} + unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS + + tc-ld-disable-gold #439082 #466536 #526348 + export TARGET_LDFLAGS="${TARGET_LDFLAGS} ${LDFLAGS}" + unset LDFLAGS + + tc-export CC NM OBJCOPY RANLIB STRIP + tc-export BUILD_CC BUILD_PKG_CONFIG + + # Force configure to use flex & bison, bug 887211. + export LEX=flex + unset YACC + + local sedargs=( + -e "s/@PV@/${PV}/" + -e "s/@PVR@/${PVR}/" + -e "s/@GEN_GRUB@/5/" + -e "s/@GEN_GENTOO@/1/" + ) + sed "${sedargs[@]}" "${FILESDIR}/sbat.csv.in" > "${WORKDIR}/sbat.csv" || die + + MULTIBUILD_VARIANTS=() + local p + for p in "${GRUB_ALL_PLATFORMS[@]}"; do + use "grub_platforms_${p}" && MULTIBUILD_VARIANTS+=( "${p}" ) + done + [[ ${#MULTIBUILD_VARIANTS[@]} -eq 0 ]] && MULTIBUILD_VARIANTS=( guessed ) + grub_do grub_configure +} + +src_compile() { + # Sandbox bug 404013. + if use libzfs; then + addpredict /etc/dfs + addpredict /dev/zfs + fi + + grub_do emake + use doc && grub_do_once emake -C docs html +} + +src_test() { + # The qemu dependency is a bit complex. + # You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform. + local SANDBOX_WRITE=${SANDBOX_WRITE} + addwrite /dev + grub_do emake -j1 check +} + +grub_mkstandalone_secureboot() { + use secureboot || return + + if tc-is-cross-compiler; then + ewarn "USE=secureboot is not supported when cross-compiling." + ewarn "No standalone EFI executable will be built." + return 1 + fi + + local standalone_targets + + case ${CTARGET:-${CHOST}} in + i?86* | x86_64*) + use grub_platforms_efi-32 && standalone_targets+=( i386-efi ) + use grub_platforms_efi-64 && standalone_targets+=( x86_64-efi ) + ;; + arm* | aarch64*) + use grub_platforms_efi-32 && standalone_targets+=( arm-efi ) + use grub_platforms_efi-64 && standalone_targets+=( arm64-efi ) + ;; + riscv*) + use grub_platforms_efi-32 && standalone_targets+=( riscv32-efi ) + use grub_platforms_efi-64 && standalone_targets+=( riscv64-efi ) + ;; + ia64*) + use grub_platforms_efi-64 && standalone_targets+=( ia64-efi ) + ;; + loongarch64*) + use grub_platforms_efi-64 && standalone_targets+=( loongarch64-efi ) + ;; + esac + + if [[ ${#standalone_targets[@]} -eq 0 ]]; then + ewarn "USE=secureboot is enabled, but no suitable EFI target in GRUB_PLATFORMS." + ewarn "No standalone EFI executable will be built." + return 1 + fi + + local target mkstandalone_args + + # grub-mkstandalone embeds a config file, make this config file chainload + # a config file in the same directory grub is installed in. This requires + # pre-loading the part_gpt and part_msdos modules. + echo 'configfile ${cmdpath}/grub.cfg' > "${T}/grub.cfg" || die + for target in "${standalone_targets[@]}"; do + ebegin "Building standalone EFI executable for ${target}" + mkstandalone_args=( + --verbose + --directory="${ED}/usr/lib/grub/${target}" + --locale-directory="${ED}/usr/share/locale" + --format="${target}" + --modules="part_gpt part_msdos" + --sbat="${ED}/usr/share/grub/sbat.csv" + --output="${ED}/usr/lib/grub/grub-${target%-efi}.efi" + "boot/grub/grub.cfg=${T}/grub.cfg" + ) + + "${ED}/usr/bin/grub-mkstandalone" "${mkstandalone_args[@]}" + eend ${?} || die "grub-mkstandalone failed to build EFI executable" + done + + secureboot_auto_sign +} + +src_install() { + grub_do emake install DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)" + use doc && grub_do_once emake -C docs install-html DESTDIR="${D}" + + einstalldocs + + insinto /etc/default + newins "${FILESDIR}"/grub.default-4 grub + + if use branding && use themes ; then + sed -i -e 's:^#GRUB_THEME=.*$:GRUB_THEME="/boot/grub/themes/gentoo_glass/theme.txt":g' \ + "${ED}/etc/default/grub" || die + fi + + # https://bugs.gentoo.org/231935 + dostrip -x /usr/lib/grub + + insinto /usr/share/grub + doins "${WORKDIR}/sbat.csv" + + if use elibc_musl; then + # https://bugs.gentoo.org/900348 + QA_CONFIG_IMPL_DECL_SKIP=( re_{compile_pattern,match,search,set_syntax} ) + fi + + grub_mkstandalone_secureboot +} + +pkg_postinst() { + elog "For information on how to configure GRUB2 please refer to the guide:" + elog " https://wiki.gentoo.org/wiki/GRUB2_Quick_Start" + + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog + optfeature "detecting other operating systems (grub-mkconfig)" sys-boot/os-prober + optfeature "creating rescue media (grub-mkrescue)" dev-libs/libisoburn sys-fs/mtools + optfeature "enabling RAID device detection" sys-fs/mdadm + optfeature "automatically updating GRUB's configuration on each kernel installation" "sys-kernel/installkernel[grub]" + elif ver_replacing -lt ${PVR}; then + ewarn + ewarn "Re-run grub-install to update installed boot code!" + ewarn "Re-run grub-mkconfig to update grub.cfg!" + ewarn + fi + + if has_version sys-boot/os-prober; then + ewarn "Due to security concerns, os-prober is disabled by default." + ewarn "Set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub to enable it." + fi + + if grep -q GRUB_LINUX_KERNEL_GLOBS "${EROOT}"/etc/default/grub; then + ewarn "Support for GRUB_LINUX_KERNEL_GLOBS has been dropped." + ewarn "Ensure that your kernels are named appropriately or edit" + ewarn "/etc/grub.d/10_linux to compensate." + fi + + if use secureboot; then + elog + elog "The signed standalone grub EFI executable(s) are available in:" + elog " /usr/lib/grub/grub-<target>.efi(.signed)" + elog "These EFI executables should be copied to the usual location at:" + elog " ESP/EFI/Gentoo/grub<arch>.efi" + elog "Note that 'grub-install' does not install these images." + elog + elog "These standalone grub executables read the grub config file from" + elog "the grub.cfg in the same directory instead of the default" + elog "/boot/grub/grub.cfg. When sys-kernel/installkernel[grub] is used," + elog "the location of the grub.cfg may be overridden by setting the" + elog "GRUB_CFG environment variable:" + elog " GRUB_CFG=ESP/EFI/Gentoo/grub.cfg" + elog + fi +} diff --git a/sys-boot/grub/metadata.xml b/sys-boot/grub/metadata.xml new file mode 100644 index 000000000000..406e9873468f --- /dev/null +++ b/sys-boot/grub/metadata.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="person"> + <email>floppym@gentoo.org</email> + <name>Mike Gilbert</name> +</maintainer> +<maintainer type="project"> + <email>base-system@gentoo.org</email> + <name>Gentoo Base System</name> +</maintainer> +<use> + <flag name="device-mapper">Enable support for devmapper; required for LUKS or LVM volume detection</flag> + <flag name="efiemu">Build and install the efiemu runtimes</flag> + <flag name="fonts">Build and install fonts for the gfxterm module</flag> + <flag name="mount">Build and install the grub-mount utility</flag> + <flag name="libzfs">Enable support for <pkg>sys-fs/zfs</pkg></flag> + <flag name="protect">Build and install the grub-protect utility</flag> + <flag name="themes">Build and install GRUB themes (starfield)</flag> + <flag name="truetype">Build and install grub-mkfont conversion utility</flag> +</use> +<upstream> + <remote-id type="cpe">cpe:/a:gnu:grub</remote-id> +</upstream> +</pkgmetadata> diff --git a/sys-boot/lilo/Manifest b/sys-boot/lilo/Manifest new file mode 100644 index 000000000000..4260ab014b47 --- /dev/null +++ b/sys-boot/lilo/Manifest @@ -0,0 +1,2 @@ +DIST dolilo-0.6.tar.bz2 3817 BLAKE2B 35c41f5eac8e02d4381db517a9b230d037da184f9ae409bc76307e689ad6b82928ea3794db54c3137afe6c770db86ba0cde78c33d89e775ddea464905070bfd6 SHA512 1b59ea5f2e2ac52d62635c9f7d5fb5b2aff6757e6ea6c0950480d8a11832b872115907abe6d8fb3fa5436e2e8971d9a1dda103dc6a15db6fc310c8f4730ab936 +DIST lilo-24.2.tar.gz 777400 BLAKE2B 71c74235d5df10eed65b67dc1ce2af21163651c752d799da419077025304abf9352535a70f3fb60d086609d8a1c25bf394e29453c338ab022cb2be3cb21af75f SHA512 4437cae21345f483194a5dc95f686f3f3cb2beec78faae3fba959db25eae29fe2c56732e055c05f1d101682c5d442cdc9561fae8074f61f5537dde0413204c54 diff --git a/sys-boot/lilo/files/lilo-24.1-novga.patch b/sys-boot/lilo/files/lilo-24.1-novga.patch new file mode 100644 index 000000000000..512fac694fdb --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.1-novga.patch @@ -0,0 +1,12 @@ +diff -uNr lilo-24.1.ORIG/make.vars lilo-24.1/make.vars +--- lilo-24.1.ORIG/make.vars 2015-01-22 10:36:54.656904227 +0000 ++++ lilo-24.1/make.vars 2015-01-22 10:37:16.516903935 +0000 +@@ -71,7 +71,7 @@ + + CONFIG=-DBDATA -DDSECS=3 -DEVMS -DIGNORECASE -DLVM -DNOKEYBOARD -DONE_SHOT \ + -DPASS160 -DREISERFS -DREWRITE_TABLE -DSOLO_CHAIN -DVERSION -DVIRTUAL \ +- -DMDPRAID -DDEVMAPPER ++ -DMDPRAID -DDEVMAPPER -DNOVGA + + # set the following if you wish LILO.COM to be installed + DOS_DIR=/dosC/boot diff --git a/sys-boot/lilo/files/lilo-24.2-Makefile-tweaks.patch b/sys-boot/lilo/files/lilo-24.2-Makefile-tweaks.patch new file mode 100644 index 000000000000..1a0c5350c5fe --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.2-Makefile-tweaks.patch @@ -0,0 +1,40 @@ +Do not strip, have parallel make, and do not rebuild images +--- a/Makefile ++++ b/Makefile +@@ -12,7 +12,6 @@ + # + all: test + make -C src all +- make -C images all + + # + # make help +@@ -45,7 +44,6 @@ + # + alles: test + $(MAKE) -C src alles +- $(MAKE) -C images all + + # + # documentation files +@@ -104,7 +102,6 @@ + # + install: all + $(MAKE) -C src install +- $(MAKE) -C images install + $(MAKE) -C hooks install + $(MAKE) -C sample install + $(MAKE) -C scripts install +--- a/src/Makefile ++++ b/src/Makefile +@@ -242,10 +242,8 @@ + if [ -f diag1.img ]; then cp -f diag1.img $$DESTDIR$(BOOT_DIR); fi + if [ -f diag2.img ]; then cp -f diag2.img $$DESTDIR$(BOOT_DIR); fi + +- strip lilo + cp lilo $$DESTDIR$(SBIN_DIR)/lilo + if [ -f lilo.static ]; then \ +- strip lilo.static; \ + cp lilo.static $$DESTDIR$(SBIN_DIR)/lilo.static; \ + fi + cp ../mkrescue $$DESTDIR$(USRSBIN_DIR)/mkrescue diff --git a/sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch b/sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch new file mode 100644 index 000000000000..b4d54ec9bc95 --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch @@ -0,0 +1,70 @@ +diff -Naurp lilo-24.2.orig/src/common.h lilo-24.2/src/common.h +--- lilo-24.2.orig/src/common.h 2015-11-21 18:50:23.000000000 -0500 ++++ lilo-24.2/src/common.h 2020-07-30 23:20:05.611122665 -0400 +@@ -386,7 +386,7 @@ extern char *config_file; + extern FILE *errstd; + extern FILE *pp_fd; + extern char *identify; /* in identify.c */ +-extern int dm_major_list[16]; ++extern int dm_major_list[32]; + extern int dm_major_nr; + + #define crc(a,b) (~crc32((a),(b),CRC_POLY1)) +diff -Naurp lilo-24.2.orig/src/geometry.c lilo-24.2/src/geometry.c +--- lilo-24.2.orig/src/geometry.c 2015-11-21 18:50:18.000000000 -0500 ++++ lilo-24.2/src/geometry.c 2020-07-30 23:20:05.611122665 -0400 +@@ -84,8 +84,9 @@ DM_TABLE *dmtab = NULL; + int dm_version_nr = 0; + #endif + +-int dm_major_list[16]; ++int dm_major_list[32]; /* increased from 16 to allow for nvme disks */ + int dm_major_nr; ++int nvme_pr = 0; /* set to none zero after geo_init if nvme disk present */ + + #ifdef LCF_LVM + struct lv_bmap { +@@ -200,6 +201,9 @@ void geo_init(char *name) + + while(fgets(line, (sizeof line)-1, file)) { + if (sscanf(line, "%d %31s\n", &major, major_name) != 2) continue; ++ if (strcmp(major_name, "nvme") !=0) { /* set if nvme drive is present */ ++ nvme_pr=-1; ++ } + if (strcmp(major_name, "device-mapper") != 0) continue; + dm_major_list[dm_major_nr] = major; + if (verbose >= 3) { +@@ -708,6 +712,22 @@ void geo_query_dev(GEOMETRY *geo,int dev + geo->start = hdprm.start; + break; + case MAJOR_SATA1: ++ /* check for nvme device and assume boot/this device is nvme if present */ ++ if (nvme_pr != 0) { ++ geo->device = 0x80 + last_dev(MAJOR_IDE,64) + (MINOR(device) >> 4); ++ if (!get_all) break; ++ if (ioctl(fd,HDIO_GETGEO,&hdprm) < 0) ++ die("geo_query_dev HDIO_GETGEO (dev 0x%04x): %s",device, ++ strerror(errno)); ++ if (all && !hdprm.sectors) ++ die("HDIO_REQ not supported for your NVME controller. Please " ++ "use a DISK section"); ++ geo->heads = hdprm.heads; ++ geo->cylinders = hdprm.cylinders; ++ geo->sectors = hdprm.sectors; ++ geo->start = hdprm.start; ++ break; ++ } + case MAJOR_SATA2: + printf("WARNING: SATA partition in the high region (>15):\n"); + printf("LILO needs the kernel in one of the first 15 SATA partitions. If \n"); +diff -Naurp lilo-24.2.orig/src/lilo.h lilo-24.2/src/lilo.h +--- lilo-24.2.orig/src/lilo.h 2015-11-21 18:50:20.000000000 -0500 ++++ lilo-24.2/src/lilo.h 2020-07-30 23:20:05.611122665 -0400 +@@ -245,6 +245,7 @@ + + /* high partitions (>15) on SATA hard disks */ + #define MAJOR_SATA1 259 /* high SATA disk partitions (Block Extended Major) */ ++ /* also used by kernel for nvme disks */ + #define MAJOR_SATA2 260 /* high SATA disk partitions (Block Extended Major) (obsolete) */ + + diff --git a/sys-boot/lilo/files/lilo-24.2-fix-gcc-15.patch b/sys-boot/lilo/files/lilo-24.2-fix-gcc-15.patch new file mode 100644 index 000000000000..a10e41687cec --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.2-fix-gcc-15.patch @@ -0,0 +1,12 @@ +Adapted from https://mirrors.slackware.com/slackware/slackware-current/source/a/lilo/lilo.gcc15.diff +--- a/make.vars ++++ b/make.vars +@@ -80,7 +80,7 @@ + MAN_DIR=/usr/share/man + + # set the compiler optimization level +-OPT=-Os ++OPT=-Os -std=gnu17 + + ### End of configuration variables for makefiles ### + diff --git a/sys-boot/lilo/files/lilo-24.2-musl.patch b/sys-boot/lilo/files/lilo-24.2-musl.patch new file mode 100644 index 000000000000..c542e27ea1c3 --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.2-musl.patch @@ -0,0 +1,17 @@ +Adapted from https://git.sr.ht/~kqz/repo/tree/b8808d806c887c0b800d3548f0c6201440b25a5e/item/server/lilo/patches/musl.patch +--- a/src/common.h ++++ b/src/common.h +@@ -23,12 +23,7 @@ + # define PAGE_SIZE 4096U + #endif + +-#ifdef O_ACCMODE +-# define O_NOACCESS O_ACCMODE +-#else +-/* open a file for "no access" */ +-# define O_NOACCESS 3 +-#endif ++#define O_NOACCESS O_RDONLY + + /* special for LILO, bypass the actual open in dev_open( , ,-1) */ + #define O_BYPASS -1 diff --git a/sys-boot/lilo/files/lilo-24.2-remove-gcc-ver-check.patch b/sys-boot/lilo/files/lilo-24.2-remove-gcc-ver-check.patch new file mode 100644 index 000000000000..44883cdcdab5 --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.2-remove-gcc-ver-check.patch @@ -0,0 +1,25 @@ +Drop explicit GCC invocation for version check (of 3.3.5...). +Adapted from https://753605.bugs.gentoo.org/attachment.cgi?id=773618 +--- a/checkit ++++ b/checkit +@@ -47,20 +47,6 @@ + } + + #echo +-echo GCC version $gccmin or later is required +-gcc -v 1>foo1 2>foo2 +-V=`cat foo1 foo2 | cut -d' ' -f1-3 | grep -i version | tr '-' ' ' | cut -d' ' -f 3` +-rm -f foo1 foo2 +-if [ -z "$V" ]; then +- echo gcc is not present +- ret=1 +-else +- vers_min $V $gccmin +- echo gcc version $V +- if [ $rc = 0 ]; then echo OKAY; else echo ERROR; ret=1; fi +-fi +- +-echo + echo AS86 version $bccmin or later is required + as86 -v 1>foo1 2>foo2 + A=`cat foo1 foo2 | grep version | cut -d " " -f 3` diff --git a/sys-boot/lilo/files/lilo-24.x-check-for-__GLIBC__.patch b/sys-boot/lilo/files/lilo-24.x-check-for-__GLIBC__.patch new file mode 100644 index 000000000000..be3443629cfa --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.x-check-for-__GLIBC__.patch @@ -0,0 +1,18 @@ +diff -Naurp lilo-24.2.orig/src/lilo.c lilo-24.2/src/lilo.c +--- lilo-24.2.orig/src/lilo.c 2021-06-06 15:53:52.389730145 -0400 ++++ lilo-24.2/src/lilo.c 2021-06-06 15:53:28.309159571 -0400 +@@ -182,7 +182,14 @@ extern int has_partitions_beta(dev_t dev + printf("Without"); + #endif + printf(" device-mapper\n"); ++#ifdef __GLIBC__ ++ /* ++ * __GLIBC__ is defined in features.h, which should be pulled ++ * in by stdio.h, but this is not guaranteed nor apparently ++ * documented anywhere. ++ */ + printf("\nglibc version %d.%d\n", __GLIBC__, __GLIBC_MINOR__); ++#endif + printf("Kernel Headers included from %d.%d.%d\n", + LINUX_VERSION_CODE>>16, + LINUX_VERSION_CODE>>8 & 255, diff --git a/sys-boot/lilo/files/lilo-24.x-fix-gcc-10.patch b/sys-boot/lilo/files/lilo-24.x-fix-gcc-10.patch new file mode 100644 index 000000000000..c46b9eebdea0 --- /dev/null +++ b/sys-boot/lilo/files/lilo-24.x-fix-gcc-10.patch @@ -0,0 +1,51 @@ +Description: Fix ftbfs with GCC-10 + +Author: Ryan Finnie <ryan@finnie.org> +Bug-Debian: https://bugs.debian.org/957490 +Forwarded: no + +--- + +--- a/src/raid.h ++++ b/src/raid.h +@@ -8,7 +8,7 @@ + * in the source directory. + */ + +-int do_md_install, ndisk, md_bios; ++extern int ndisk, md_bios; + + int raid_setup(void); + void raid_final(void); +--- a/src/bsect.c ++++ b/src/bsect.c +@@ -54,8 +54,6 @@ + #endif + + +-int boot_dev_nr; +- + static BOOT_SECTOR bsect,bsect_orig; + static MENUTABLE menuparams; + static DESCR_SECTORS descrs; +--- a/src/identify.c ++++ b/src/identify.c +@@ -19,7 +19,6 @@ + #include "common.h" + #include "cfg.h" + +-char *identify; + static char *opt; + static char *first, *dflt; + static int idefault; +--- a/src/raid.c ++++ b/src/raid.c +@@ -41,7 +41,7 @@ + static int raid_bios[MAX_RAID+1]; + static int device; + enum {MD_NULL=0, MD_PARALLEL, MD_MIXED, MD_SKEWED}; +-int do_md_install, ndisk, md_bios; ++int ndisk, md_bios; + static char *raid_list[MAX_RAID]; + static int list_index[MAX_RAID]; + static int nlist, faulty; diff --git a/sys-boot/lilo/files/lilo.conf b/sys-boot/lilo/files/lilo.conf new file mode 100644 index 000000000000..a65ae24252dc --- /dev/null +++ b/sys-boot/lilo/files/lilo.conf @@ -0,0 +1,72 @@ +# Author: Ultanium + +# +# Start LILO global section +# + +# Faster, but won't work on all systems: +#compact +# Should work for most systems, and do not have the sector limit: +lba32 +# If lba32 do not work, use linear: +#linear + +# MBR to install LILO to: +boot = /dev/sda +map = /boot/.map + +# If you are having problems booting from a hardware raid-array +# or have a unusual setup, try this: +#disk=/dev/ataraid/disc0/disc bios=0x80 # see this as the first BIOS disk +#disk=/dev/sda bios=0x81 # see this as the second BIOS disk +#disk=/dev/hda bios=0x82 # see this as the third BIOS disk + +# Here you can select the secondary loader to install. A few +# examples is: +# +# boot-text.b +# boot-menu.b +# boot-bmp.b +# +install = /boot/boot-menu.b # Note that for lilo-22.5.5 or later you + # do not need boot-{text,menu,bmp}.b in + # /boot, as they are linked into the lilo + # binary. + +menu-scheme=Wb +prompt +# If you always want to see the prompt with a 15 second timeout: +#timeout=150 +delay = 50 +# Normal VGA console +vga = normal +# VESA console with size 1024x768x16: +#vga = 791 + +# +# End LILO global section +# + +# +# Linux bootable partition config begins +# +image = /boot/bzImage + root = /dev/sda3 + #root = /devices/discs/disc0/part3 + label = Gentoo + read-only # read-only for checking +# +# Linux bootable partition config ends +# + +# +# DOS bootable partition config begins +# +other = /dev/sda1 + #other = /devices/discs/disc0/part1 + label = Windows + table = /dev/sda +# +# DOS bootable partition config ends +# + diff --git a/sys-boot/lilo/lilo-24.2-r2.ebuild b/sys-boot/lilo/lilo-24.2-r2.ebuild new file mode 100644 index 000000000000..7f26cefbf275 --- /dev/null +++ b/sys-boot/lilo/lilo-24.2-r2.ebuild @@ -0,0 +1,200 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit optfeature toolchain-funcs + +DOLILO_V="0.6" + +DESCRIPTION="LInux LOader, the original Linux bootloader" +HOMEPAGE="https://www.joonet.de/lilo/" + +DOLILO_TAR="dolilo-${DOLILO_V}.tar.bz2" +SRC_URI=" + https://www.joonet.de/lilo/ftp/sources/${P}.tar.gz + mirror://gentoo/${DOLILO_TAR} +" + +LICENSE="BSD GPL-2" +SLOT="0" +KEYWORDS="-* amd64 x86" + +IUSE="static minimal pxeserial device-mapper" + +DEPEND=">=sys-devel/bin86-0.15.5" +RDEPEND="device-mapper? ( >=sys-fs/lvm2-2.02.45 )" + +# Bootloaders should not be using arbitrary CFLAGS without good reason. A bootloader +# is typically only executed once to boot the system, and it should work the first time. +QA_FLAGS_IGNORED="/sbin/lilo" + +src_prepare() { + default + + # this patch is needed when booting PXE and the device you're using + # emulates vga console via serial console. + # IE.. B.B.o.o.o.o.t.t.i.i.n.n.g.g....l.l.i.i.n.n.u.u.x.x and stair stepping. + use pxeserial && eapply "${FILESDIR}/${PN}-24.1-novga.patch" + + eapply "${FILESDIR}/${PN}-24.2-add-nvme-support.patch" + eapply "${FILESDIR}/${PN}-24.x-fix-gcc-10.patch" + eapply "${FILESDIR}/${PN}-24.x-check-for-__GLIBC__.patch" + + # Do not strip and have parallel make + # FIXME: images/Makefile does weird stuff + sed -i Makefile src/Makefile \ + -e '/strip/d;s|^ make| $(MAKE)|g' \ + -e '/images install/d' \ + -e '/images all/d' \ + || die "sed strip failed" +} + +src_configure() { + if ! use device-mapper; then + sed -i make.vars -e 's|-DDEVMAPPER||g' || die + fi +} + +src_compile() { + # lilo needs this. bug #140209 + export LC_ALL=C + + # we explicitly prevent the custom CFLAGS for stability reasons + if use static; then + local target=alles + else + local target=all + fi + + emake CC="$(tc-getCC) ${LDFLAGS}" ${target} +} + +src_install() { + emake DESTDIR="${ED}" install + + if use !minimal; then + into / + dosbin "${WORKDIR}"/dolilo/dolilo + + into /usr + dosbin keytab-lilo.pl + + insinto /etc + newins "${FILESDIR}"/lilo.conf lilo.conf.example + + newconfd "${WORKDIR}"/dolilo/dolilo.conf.d dolilo.example + + dodoc CHANGELOG* readme/README.* readme/INCOMPAT README + docinto samples ; dodoc sample/* + fi + + # This we don't use + rm -r "${ED}/etc/initramfs" || die + # This should be in /usr/lib and it should have the .install suffix + dodir /usr/lib/kernel + for dir in postinst.d postrm.d; do + mv "${ED}/etc/kernel/${dir}" "${ED}/usr/lib/kernel/${dir}" || die + mv "${ED}/usr/lib/kernel/${dir}/zz-runlilo" "${ED}/usr/lib/kernel/${dir}/90-runlilo.install" || die + done + # Insert wrapper for systemd's kernel-install + exeinto /usr/lib/kernel/install.d + newexe - 90-runlilo.install <<-EOF + #!/bin/sh + if [ "\${1}" = "add" ]; then + exec "\$(dirname \${0})/../postinst.d/90-runlilo.install" + elif [ "\${1}" = "remove" ]; then + exec "\$(dirname \${0})/../postrm.d/90-runlilo.install" + fi + EOF +} + +# Check whether LILO is installed +# This function is from /usr/sbin/mkboot from debianutils, with copyright: +# +# Debian GNU/Linux +# Copyright 1996-1997 Guy Maor <maor@debian.org> +# +# Modified for Gentoo for use with the lilo ebuild by: +# Martin Schlemmer <azarah@gentoo.org> (16 Mar 2003) +# +lilocheck() { + local bootpart= + local rootpart="$(mount | grep -v "tmpfs" | grep -v "rootfs" | grep "on / " | cut -f1 -d " ")" + + echo + ebegin "Checking whether LILO can be safely updated" + + if [ "$(whoami)" != "root" ]; then + eend 1 + eerror "Only root can check for LILO" + return 1 + fi + + if [ -z "${rootpart}" ]; then + eend 1 + eerror "Could not determine root partition" + return 1 + fi + + if [ ! -f /etc/lilo.conf -o ! -x /sbin/lilo ]; then + eend 1 + eerror "No LILO configuration in place" + return 1 + fi + + bootpart="$(sed -n "s:^boot[ ]*=[ ]*\(.*\)[ ]*:\1:p" /etc/lilo.conf)" + + if [ -z "${bootpart}" ]; then + # lilo defaults to current root when 'boot=' is not present + bootpart="${rootpart}" + fi + + if ! dd if=${bootpart} ibs=16 count=1 2>&- | grep -q 'LILO'; then + eend 1 + eerror "No LILO signature on ${bootpart}" + ewarn "Check your /etc/lilo.conf, or run /sbin/lilo by hand." + return 1 + fi + + if grep -q "^[[:space:]]*password[[:space:]]*=[[:space:]]*\"\"" /etc/lilo.conf; then + eend 1 + eerror "Interactive password entry configured" + ewarn "Run /sbin/lilo -p by hand." + return 1 + fi + + einfo "LILO on ${bootpart} is safe to update" + eend 0 + return 0 +} + +pkg_postinst() { + if [ ! -e "${ROOT}/boot/boot.b" -a ! -L "${ROOT}/boot/boot.b" ]; then + [ -f "${ROOT}/boot/boot-menu.b" ] && \ + ln -snf boot-menu.b "${ROOT}/boot/boot.b" + fi + + if [[ -z "${ROOT}" ]] && use !minimal; then + if lilocheck; then + einfo "Running DOLILO to complete the install" + # do not redirect to /dev/null because it may display some input + # prompt + /sbin/dolilo + if [ "$?" -ne 0 ]; then + eerror "You must manually configure and run LILO" + fi + fi + echo + fi + if use !minimal; then + echo + einfo "Issue 'dolilo' instead of 'lilo' to have a friendly wrapper that" + einfo "handles mounting and unmounting /boot for you. It can do more, " + einfo "edit /etc/conf.d/dolilo to harness its full potential." + echo + fi + + optfeature "automatically updating lilo's configuration on each kernel installation" \ + sys-kernel/installkernel +} diff --git a/sys-boot/lilo/lilo-24.2-r3.ebuild b/sys-boot/lilo/lilo-24.2-r3.ebuild new file mode 100644 index 000000000000..9cd6e4e53c99 --- /dev/null +++ b/sys-boot/lilo/lilo-24.2-r3.ebuild @@ -0,0 +1,123 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit optfeature toolchain-funcs + +DOLILO_V="0.6" + +DESCRIPTION="LInux LOader, the original Linux bootloader" +HOMEPAGE="https://www.joonet.de/lilo/" + +DOLILO_TAR="dolilo-${DOLILO_V}.tar.bz2" +SRC_URI=" + https://www.joonet.de/lilo/ftp/sources/${P}.tar.gz + mirror://gentoo/${DOLILO_TAR} +" + +LICENSE="BSD GPL-2" +SLOT="0" +KEYWORDS="-* amd64 x86" + +IUSE="device-mapper keytab pxeserial static" + +DEPEND="sys-devel/bin86" +RDEPEND=" + device-mapper? ( sys-fs/lvm2 ) + keytab? ( dev-lang/perl ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-24.2-Makefile-tweaks.patch + "${FILESDIR}"/${PN}-24.2-add-nvme-support.patch + "${FILESDIR}"/${PN}-24.x-fix-gcc-10.patch + "${FILESDIR}"/${PN}-24.x-check-for-__GLIBC__.patch + "${FILESDIR}"/${PN}-24.2-fix-gcc-15.patch + "${FILESDIR}"/${PN}-24.2-musl.patch + "${FILESDIR}"/${PN}-24.2-remove-gcc-ver-check.patch +) + +# Bootloaders should not be using arbitrary CFLAGS without good reason. A bootloader +# is typically only executed once to boot the system, and it should work the first time. +QA_FLAGS_IGNORED="sbin/lilo" + +src_prepare() { + default + + # this patch is needed when booting PXE and the device you're using + # emulates vga console via serial console. + # IE.. B.B.o.o.o.o.t.t.i.i.n.n.g.g....l.l.i.i.n.n.u.u.x.x and stair stepping. + use pxeserial && eapply "${FILESDIR}/${PN}-24.1-novga.patch" +} + +src_configure() { + if ! use device-mapper; then + sed -i make.vars -e 's|-DDEVMAPPER||g' || die + fi +} + +src_compile() { + # lilo needs this. bug #140209 + export LC_ALL=C + + local target=$(usex static alles all) + + # we explicitly prevent the custom CFLAGS for stability reasons + emake CC="$(tc-getCC) ${LDFLAGS}" ${target} +} + +src_install() { + emake DESTDIR="${ED}" install + + into / + dosbin "${WORKDIR}"/dolilo/dolilo + + if use keytab; then + into /usr + dosbin keytab-lilo.pl + fi + + insinto /etc + newins "${FILESDIR}"/lilo.conf lilo.conf.example + + newconfd "${WORKDIR}"/dolilo/dolilo.conf.d dolilo.example + + dodoc CHANGELOG* readme/README.* readme/INCOMPAT README + docinto samples ; dodoc sample/* + + # This we don't use + rm -r "${ED}/etc/initramfs" || die + # This should be in /usr/lib and it should have the .install suffix + dodir /usr/lib/kernel + for dir in postinst.d postrm.d; do + mv "${ED}/etc/kernel/${dir}" "${ED}/usr/lib/kernel/${dir}" || die + mv "${ED}/usr/lib/kernel/${dir}/zz-runlilo" "${ED}/usr/lib/kernel/${dir}/90-runlilo.install" || die + done + # Insert wrapper for systemd's kernel-install + exeinto /usr/lib/kernel/install.d + newexe - 90-runlilo.install <<-EOF + #!/bin/sh + if [ "\${1}" = "add" ]; then + exec "\$(dirname \${0})/../postinst.d/90-runlilo.install" + elif [ "\${1}" = "remove" ]; then + exec "\$(dirname \${0})/../postrm.d/90-runlilo.install" + fi + EOF +} + +pkg_postinst() { + if [[ ! -e "${ROOT}/boot/boot.b" && ! -L "${ROOT}/boot/boot.b" ]]; then + [[ -f "${ROOT}/boot/boot-menu.b" ]] && \ + ln -snf boot-menu.b "${ROOT}/boot/boot.b" + fi + + einfo + einfo "Issue 'dolilo' instead of 'lilo' to have a friendly wrapper that" + einfo "handles mounting and unmounting /boot for you. It can do more, " + einfo "edit /etc/conf.d/dolilo to harness its full potential." + einfo + + optfeature "automatically updating lilo's configuration on each kernel installation" \ + sys-kernel/installkernel +} diff --git a/sys-boot/lilo/metadata.xml b/sys-boot/lilo/metadata.xml new file mode 100644 index 000000000000..164cc0bce00d --- /dev/null +++ b/sys-boot/lilo/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>hlein@korelogic.com</email> + <name>Hank Leininger</name> + </maintainer> + <maintainer type="project" proxied="proxy"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <use> + <flag name="device-mapper">Enable support for device-mapper from <pkg>sys-fs/lvm2</pkg></flag> + <flag name="keytab">Install keytab, keyboard remapping helper script</flag> + <flag name="minimal">Do not install optional bits (dolilo helper, docs, etc.)</flag> + <flag name="pxeserial">Avoid character echo on PXE serial console</flag> + </use> +</pkgmetadata> diff --git a/sys-boot/limine/Manifest b/sys-boot/limine/Manifest new file mode 100644 index 000000000000..f84cbef77a5d --- /dev/null +++ b/sys-boot/limine/Manifest @@ -0,0 +1,2 @@ +DIST limine-11.4.1.tar.gz 620367 BLAKE2B 09b13f981a764a2516980e838e5a8a730259d65840ec17f523eda4ad33fb582108ba657828fb3ecf8c71fd78a186b5eee6a57c979d561f69fc9e0c346e8af329 SHA512 8e2e5fdeddc118d4dca45e791ecd0004d20f959efa3c4f55d9dfde332be54c956d8fab30a7c4c89d25ec9858a9806fef85895b25a80ac4e9fca944317ece5971 +DIST limine-12.2.0.tar.gz 664059 BLAKE2B 21554df36014f2f0485cc12e922f79753819424e68f83cfd539ab991c289dbb14b791c839b407b8f4ebba42881e5a9ff2724b0337cd641cd03daf1df1a4b1ada SHA512 38ee8b45a69cf991bd19a15166d700fd3a6b2dc3f8bd4d988d4d36ff7bdcb83e6d11e2563344c89688037c012fbe9b207cea8203fd1635db91f05b62a1e03b5a diff --git a/sys-boot/limine/limine-11.4.1.ebuild b/sys-boot/limine/limine-11.4.1.ebuild new file mode 100644 index 000000000000..2f26db9b3cc3 --- /dev/null +++ b/sys-boot/limine/limine-11.4.1.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {19..21} ) +inherit llvm-r2 + +DESCRIPTION="Limine is a modern, advanced, and portable BIOS/UEFI multiprotocol bootloader" +HOMEPAGE="https://limine-bootloader.org/" +SRC_URI="https://github.com/Limine-Bootloader/Limine/releases/download/v${PV}/${P}.tar.gz" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="+bios +bios-pxe +bios-cd +uefi-cd +uefi-ia32 +uefi-x86-64 +uefi-aarch64 +uefi-riscv64 +uefi-loongarch64" + +MY_LLVM_TARGETS="AArch64 ARM X86 RISCV LoongArch" +MY_LLVM_FLAGS="llvm_targets_${MY_LLVM_TARGETS// /(-),llvm_targets_}(-)" + +BDEPEND=" + app-alternatives/gzip + dev-lang/nasm + sys-apps/findutils + $(llvm_gen_dep " + llvm-core/llvm:\${LLVM_SLOT}[${MY_LLVM_FLAGS}] + llvm-core/clang:\${LLVM_SLOT}[${MY_LLVM_FLAGS}] + llvm-core/lld:\${LLVM_SLOT} + ") + uefi-cd? ( sys-fs/mtools ) +" + +src_configure() { + local myconf=( + "$(use_enable bios)" + "$(use_enable bios-cd)" + "$(use_enable bios-pxe)" + + "$(use_enable uefi-ia32)" + "$(use_enable uefi-x86-64)" + "$(use_enable uefi-aarch64)" + "$(use_enable uefi-riscv64)" + "$(use_enable uefi-loongarch64)" + "$(use_enable uefi-cd)" + ) + + econf "${myconf[@]}" +} diff --git a/sys-boot/limine/limine-12.2.0.ebuild b/sys-boot/limine/limine-12.2.0.ebuild new file mode 100644 index 000000000000..b767462cd805 --- /dev/null +++ b/sys-boot/limine/limine-12.2.0.ebuild @@ -0,0 +1,56 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {19..21} ) +inherit llvm-r2 + +DESCRIPTION="Limine is a modern, advanced, and portable BIOS/UEFI multiprotocol bootloader" +HOMEPAGE="https://limine-bootloader.org/" +SRC_URI="https://github.com/Limine-Bootloader/Limine/releases/download/v${PV}/${P}.tar.gz" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="+bios +bios-pxe +bios-cd +uefi-cd +uefi-ia32 +uefi-x86-64 +uefi-aarch64 +uefi-riscv64 +uefi-loongarch64" + +MY_LLVM_TARGETS="AArch64 ARM X86 RISCV LoongArch" +MY_LLVM_FLAGS="llvm_targets_${MY_LLVM_TARGETS// /(-),llvm_targets_}(-)" + +BDEPEND=" + app-alternatives/gzip + dev-lang/nasm + sys-apps/findutils + $(llvm_gen_dep " + llvm-core/llvm:\${LLVM_SLOT}[${MY_LLVM_FLAGS}] + llvm-core/clang:\${LLVM_SLOT}[${MY_LLVM_FLAGS}] + llvm-core/lld:\${LLVM_SLOT} + ") + uefi-cd? ( sys-fs/mtools ) +" + +src_configure() { + local myconf=( + "$(use_enable bios)" + "$(use_enable bios-cd)" + "$(use_enable bios-pxe)" + + "$(use_enable uefi-ia32)" + "$(use_enable uefi-x86-64)" + "$(use_enable uefi-aarch64)" + "$(use_enable uefi-riscv64)" + "$(use_enable uefi-loongarch64)" + "$(use_enable uefi-cd)" + ) + + econf "${myconf[@]}" +} + +pkg_postinst() { + ewarn "Limine 12.0.0 and later forces hash verification for systems with Secure Boot" + ewarn "enabled if the config hash has been enrolled into the EFI binary with" + ewarn "'limine enroll-config'." + ewarn "If you're using Secure Boot, and are enrolling the config file hash, make sure" + ewarn "the config contains correct hashes for all files referenced within it." +} diff --git a/sys-boot/limine/metadata.xml b/sys-boot/limine/metadata.xml new file mode 100644 index 000000000000..7be3cbe8da3b --- /dev/null +++ b/sys-boot/limine/metadata.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>kacper.slominski72@gmail.com</email> + <name>Kacper Słomiński</name> + </maintainer> + <maintainer type="person" proxied="proxy"> + <email>sam@gentoo.org</email> + <name>Sam James</name> + </maintainer> + <upstream> + <remote-id type="github">limine-bootloader/limine</remote-id> + <bugs-to>https://github.com/Limine-Bootloader/Limine/issues</bugs-to> + <changelog>https://github.com/Limine-Bootloader/Limine/blob/trunk/ChangeLog</changelog> + </upstream> + <use> + <flag name="uefi-ia32"> + Enable IA32 (32-bit x86) UEFI support. + </flag> + <flag name="uefi-x86-64"> + Enable x86-64 UEFI support. + </flag> + <flag name="uefi-aarch64"> + Enable AArch64 UEFI support. + </flag> + <flag name="uefi-riscv64"> + Enable 64-bit RISC-V UEFI support. + </flag> + <flag name="uefi-loongarch64"> + Enable 64-bit LoongArch UEFI support. + </flag> + <flag name="uefi-cd"> + Enable building limine-uefi-cd.bin using <pkg>sys-fs/mtools</pkg>. + </flag> + + <flag name="bios"> + Enable legacy x86 BIOS/MBR boot support. + </flag> + <flag name="bios-pxe"> + Enables legacy x86 BIOS PXE boot support. + </flag> + <flag name="bios-cd"> + Enables legacy x86 BIOS boot support for CDs. + </flag> + </use> +</pkgmetadata> diff --git a/sys-boot/makebootfat/Manifest b/sys-boot/makebootfat/Manifest new file mode 100644 index 000000000000..5da07ab2d5ee --- /dev/null +++ b/sys-boot/makebootfat/Manifest @@ -0,0 +1 @@ +DIST makebootfat-1.4.tar.gz 146722 BLAKE2B 00ad12565951691df2e7af90ae1777c6c6e2253efc61350046cc3ece3342054267f8bdf7ec2303ee203f7af757e7bbda7843104480fb4529eeed2a33456b7f22 SHA512 638356c951670187960d0050d963116391d4b494bc9b082b3d4673188450e47f22fda5733aa09b15cfbb1640807676f5f8743dd094b9931f150b445eb8d335dd diff --git a/sys-boot/makebootfat/makebootfat-1.4.ebuild b/sys-boot/makebootfat/makebootfat-1.4.ebuild new file mode 100644 index 000000000000..f4c60fb48e9d --- /dev/null +++ b/sys-boot/makebootfat/makebootfat-1.4.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="Command line utility able to create bootable USB disks" +HOMEPAGE="http://advancemame.sourceforge.net/boot-readme.html" +SRC_URI="https://downloads.sourceforge.net/advancemame/${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND="sys-boot/syslinux" +DEPEND="${RDEPEND}" + +src_install() { + default + + insinto /usr/share/makebootfat + doins mbrfat.bin + + dodoc doc/*.txt + docinto html + dodoc doc/*.html +} diff --git a/sys-boot/makebootfat/metadata.xml b/sys-boot/makebootfat/metadata.xml new file mode 100644 index 000000000000..02a27fc3d27b --- /dev/null +++ b/sys-boot/makebootfat/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <remote-id type="sourceforge">advancemame</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/mbr/Manifest b/sys-boot/mbr/Manifest new file mode 100644 index 000000000000..384778a68e9e --- /dev/null +++ b/sys-boot/mbr/Manifest @@ -0,0 +1 @@ +DIST mbr-1.1.11.tar.gz 132060 BLAKE2B 1e7d8267bf4bc4b09a69a61ecf20c82533b4ed879bdaf94c65e361d2e48d7399e41a7c25da757a0f287e33fbb051b6a3bfa038b64f287ddab52b1f1f2529dad0 SHA512 27637b7c37be22ec7947b73684156a38c76dd1d37fad12133dd614ac4b98b578b30a758e6179a7cd62f6044dde2dce19a1e28234aa4bd0d848ef97b44d6cd8f9 diff --git a/sys-boot/mbr/mbr-1.1.11-r2.ebuild b/sys-boot/mbr/mbr-1.1.11-r2.ebuild new file mode 100644 index 000000000000..a0227af7a785 --- /dev/null +++ b/sys-boot/mbr/mbr-1.1.11-r2.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="A replacement master boot record for IBM-PC compatible computers" +HOMEPAGE="https://www.chiark.greenend.org.uk/~neilt/mbr/" +SRC_URI="https://www.chiark.greenend.org.uk/~neilt/mbr/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* amd64 x86" +IUSE="test" +RESTRICT="!test? ( test )" + +DEPEND="sys-devel/bin86" +BDEPEND="test? ( dev-vcs/rcs )" + +src_prepare() { + # do not treat warnings as errors + sed -i -e "s: -Werror::" {,harness/}Makefile.{in,am} || die + default +} + +src_install() { + dosbin install-mbr + doman install-mbr.8 + dodoc AUTHORS ChangeLog install-mbr.8 NEWS README TODO +} + +pkg_postinst() { + elog "To install the MBR, run /sbin/install-mbr" +} diff --git a/sys-boot/mbr/metadata.xml b/sys-boot/mbr/metadata.xml new file mode 100644 index 000000000000..85e4ed814fa2 --- /dev/null +++ b/sys-boot/mbr/metadata.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<!-- maintainer-needed --> +</pkgmetadata> diff --git a/sys-boot/metadata.xml b/sys-boot/metadata.xml new file mode 100644 index 000000000000..82a5044f1bcf --- /dev/null +++ b/sys-boot/metadata.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE catmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<catmetadata> + <longdescription lang="en"> + The sys-boot category contains bootloaders and related tools. + </longdescription> + <longdescription lang="es"> + La categoría sys-boot contiene algunos cargadores de arranque y + herramientas relacionadas. + </longdescription> + <longdescription lang="ja"> + sys-bootカテゴリにはブートとブート関連ツールが含まれます。 + </longdescription> + <longdescription lang="de"> + Die Kategorie sys-boot enthält Bootloader sowie damit in + Zusammenhang stehende Programme. + </longdescription> + <longdescription lang="nl"> + De sys-boot categorie bevat bootloaders en bijbehorende gereedschappen. + </longdescription> + <longdescription lang="vi"> + Nhóm sys-boot chứa các bootloader và công cụ liên quan. + </longdescription> + <longdescription lang="it"> + La categoria sys-boot contiene bootloaders e strumenti correlati al boot del sistema. + </longdescription> + <longdescription lang="pt"> + A categoria sys-boot contém gerenciadores de inicialização e + ferramentas relacionadas. + </longdescription> + <longdescription lang="pl"> + Kategoria sys-boot zawiera programy ładujące (bootloadery) i związane z + nimi pakiety. + </longdescription> +</catmetadata> diff --git a/sys-boot/milo/Manifest b/sys-boot/milo/Manifest new file mode 100644 index 000000000000..dd08781bb887 --- /dev/null +++ b/sys-boot/milo/Manifest @@ -0,0 +1,6 @@ +DIST MILO-HOWTO 52455 BLAKE2B f476cb2a9b362c520dc4c00b493c05a650208d8ea004427ed710bd59919b4773b45f02b8a62ffdb0e7ac11ac51c521bb27d4d7ee0046bc29a46dca9d558d257e SHA512 81e0fdc12a1e56af14af4a4167ccc9d6ffefa265fad3328c27b7640b51b07012870c0e57497d83084d1ff9c3681ceb617a4ff25f87e12d109c34df062a0c1432 +DIST ldmilo-patched-20010430 18944 BLAKE2B 563ccc51e1f227232af60ba9bc76f6717b6a77814c1452d0209e439c3a07dfd53a850a8ba07983bb6a2493cde4204366f47b790a53c8063db0063effb739a8c6 SHA512 c02ba8805b0d28516534d679fef7073e6c2adea30d41a8bf9e40c48c57a889e5122f475970c6afe9ddd894970dfc2504ea89c276d920a1fbd88c3abc3eaa1e01 +DIST linload.exe 7168 BLAKE2B 393696c987b771a75c5c0a04a6f82999189ecb60067464e8073bf392670162ebcea9b40ed5a08fca6e46b307a4ac50be10312fa4e6da525b60fa1f393c23d996 SHA512 604b1937d751b18a9204681a248ce9557912c10b2e2c68e5f9ce33030d5b0d8721f1afafaf22d6326bc4514a09a72696c4917d893a9e64ac44b61e563caac96c +DIST linux-2.2.20-reiserfs-3.5.35.diff.bz2 154943 BLAKE2B 6226321438bed88bc31fb151a28157dda811a2c7ce6c543564f2ef183489b20f2b7f6df903f63aadaa8196ba10bd54df4c7069e448bb456474bccf64770a666e SHA512 b63d03d605d65cb7a15020ad38b80d77b810963edbdc0b5ccaf1706347de5026e390d8c2a5315f1d2734b793903c1a407b4db4129d11b7d5ff2ad9dc8f2137aa +DIST linux-2.2.25.tar.bz2 15791211 BLAKE2B 5b4b416c41b2277c4e509e7c0003d1ba0bd26e1bbb03a30bdb9d44f9211f6edb593bbca158379ea565e2f35d01e128590971ea85220baec06c23ae15e3942f1b SHA512 63e83f4f184cdd09f39c24e2023fce3562ea550db7182ae94e36ce30c6b2415bac970306cd60c1d1a89a1a3b54ad957094629557a5782f181939efb219ad41bb +DIST milo-2.2-18.tar.bz2 1074725 BLAKE2B 7e7cac8ec2ee8246f21f5ea0f1d497dd6234ed67dad0a340e0183abec2f7a4f694b48eb87ba65ef97e967918c55c9fbfdd56e502f21fc47f8d053d0353758f1c SHA512 1ccc86c83d520d07040ba44d14e7e9353cf364bf5b83ba4df14b0560769643ce07f89feeab468144fe17b7bf482beb7480f5dad1a0e9b574e6e6150bb72aae93 diff --git a/sys-boot/milo/files/README-gentoo b/sys-boot/milo/files/README-gentoo new file mode 100644 index 000000000000..5ad8c753ba09 --- /dev/null +++ b/sys-boot/milo/files/README-gentoo @@ -0,0 +1,98 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# +############################################## +# Gentoo Linux MILO images. +#################################################### +# +# What is MILO? +# +### + +MILO is an AlphaLinux bootloader, which is usually used to load the Linux +Operating System on Alpha machines that dont have SRM. + +There are two families of firmware on Alpha, ARC and SRM. ARC was developed +for use with Windows NT, and cannot support Linux. Some Alpha's were +distributed with only ARC firmware, for use specifically with Windows NT, +these machines would not be able to run any OS except for Windows NT without +MILO. + +If you do have SRM, or the option of using SRM, you should be using the aboot +bootloader, unless you really know what you are doing. + +NOTE: if you have srm, but would like to dual boot with Windows NT, or use ARC + firmware, you might find MILO more useful than aboot. There are other + reasons also, booting a kernel from a reiserfs partition, for example. + +NOTE: The Gentoo MILO images are slightly different to the standard + MILO images, they have been patched to compile with gcc3 and + work with the latest linux-2.2 kernel and drivers. You can + also optimise your MILO image, to maximise the performance of the + MILO pager! woooo! + +FIXME: will there be a boot speed improvement from optimising MILO? +FIXME: what about performance of the call_pal routines (or at least the + overhead of calling them, as they are hand coded asm), will + that improve system performance? + +##################################################### +# +# How do i use these images to boot? +# +#### + +NOTE: Read the MILO-HOWTO in this directory now! + There is an explanation and description of all the ways you can + start MILO, including SRM, Floppy, Flash and Debug Monitor. + +In this directory you will find the MILO images, you can use these to +make MILO boot floppies, or install them to a FAT partition. + +There are instructions below for making a MILO boot floppy. + + +1. insert the disk you would like to make a MILO floppy. + +2. fdformat /dev/fd0 + + Obviously, if the disk is already formatted you can skip + this step. + +3. mformat a: + + this will create a MSDOS file system (FAT) on the floppy. + +4. mcopy milo-2.4.18-gentoo-<your alpha> a:\milo + + install the milo image for your machine onto the new floppy. + +5. mcopy linload.exe a:\linload.exe + _OR_ if you have a Ruffian machine: + mcopy ldmilo.exe a:\ldmilo.exe + + install the milo loader, note that ruffians dont use ldlinux.exe + by default, if your system expects ldlinux.exe, just copy that file + instead. the ldmilo included in this ebuild contains the fixes by Jay + Eastabrook, sometimes called "Jay's Hacked Version". + +6. echo -ne '\125\252' | dd of=/dev/fd0 bs=1 seek=510 count=2 conv=notrunc + + this might not be nescessary on all machines, but some ARCs expect the + floppy to be marked bootable, this fakes the magic. + +7. reboot, and set ARCs to boot your shiny new MILO floppy! + +##################################################### +# +# BUGS +# +#### + +These MILO images are not extensively tested, if you use one +PLEASE, PLEASE, PLEASE tell me! i need to know which systems +it works on and which ones it doesnt. + +if you dont want to enter a bug in http://bugs.gentoo.org/ + +you can just email me a quick note to taviso@gentoo.org diff --git a/sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff b/sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff new file mode 100644 index 000000000000..d99769f91c9f --- /dev/null +++ b/sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff @@ -0,0 +1,123 @@ +diff -ru --minimal linux/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c +--- linux/arch/alpha/kernel/process.c 2001-03-25 17:37:29.000000000 +0100 ++++ linux/arch/alpha/kernel/process.c 2003-06-02 20:20:19.000000000 +0100 +@@ -57,7 +57,7 @@ + static struct fs_struct init_fs = INIT_FS; + static struct files_struct init_files = INIT_FILES; + static struct signal_struct init_signals = INIT_SIGNALS; +-struct mm_struct init_mm = INIT_MM; ++struct mm_struct init_mm; + + union task_union init_task_union __attribute__((section("init_task"))) + = { task: INIT_TASK }; +diff -ru --minimal linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c +--- linux/drivers/char/tty_io.c 2002-05-21 00:32:34.000000000 +0100 ++++ linux/drivers/char/tty_io.c 2003-06-02 20:05:08.000000000 +0100 +@@ -756,15 +756,17 @@ + } + + /* Semaphore to protect creating and releasing a tty */ +-static struct semaphore tty_sem = MUTEX; ++static struct semaphore tty_sem; + + static void down_tty_sem(int index) + { ++ tty_sem = MUTEX; + down(&tty_sem); + } + + static void up_tty_sem(int index) + { ++ tty_sem = MUTEX; + up(&tty_sem); + } + +@@ -785,6 +787,7 @@ + int retval=0; + int idx; + ++ tty_sem = MUTEX; + driver = get_tty_driver(device); + if (!driver) + return -ENODEV; +diff -ru --minimal linux/fs/super.c linux/fs/super.c +--- linux/fs/super.c 2001-11-02 16:39:08.000000000 +0000 ++++ linux/fs/super.c 2003-06-02 20:13:53.000000000 +0100 +@@ -42,7 +42,7 @@ + * unmounting a filesystem and re-mounting it (or something + * else). + */ +-static struct semaphore mount_sem = MUTEX; ++static struct semaphore mount_sem; + + extern void wait_for_keypress(void); + extern struct file_operations * get_blkfops(unsigned int major); +@@ -730,6 +730,7 @@ + int retval; + struct inode * inode = get_empty_inode(); + ++ mount_sem = MUTEX; + retval = -ENOMEM; + if (!inode) + goto out; +@@ -859,6 +860,7 @@ + struct vfsmount *vfsmnt; + int error; + ++ mount_sem = MUTEX; + error = -EACCES; + if (!(flags & MS_RDONLY) && dev && is_read_only(dev)) + goto out; +diff -ru --minimal linux/kernel/sys.c linux/kernel/sys.c +--- linux/kernel/sys.c 2002-09-16 17:26:33.000000000 +0100 ++++ linux/kernel/sys.c 2003-06-02 20:00:20.000000000 +0100 +@@ -866,12 +866,13 @@ + * rather than a semaphore. Anybody want to implement + * one? + */ +-struct semaphore uts_sem = MUTEX; ++struct semaphore uts_sem; + + asmlinkage int sys_newuname(struct new_utsname * name) + { + int errno = 0; + ++ uts_sem = MUTEX; + down(&uts_sem); + if (copy_to_user(name,&system_utsname,sizeof *name)) + errno = -EFAULT; +@@ -883,6 +884,7 @@ + { + int errno; + ++ uts_sem = MUTEX; + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + if (len < 0 || len > __NEW_UTS_LEN) +@@ -901,6 +903,7 @@ + { + int i, errno; + ++ uts_sem = MUTEX; + if (len < 0) + return -EINVAL; + down(&uts_sem); +@@ -922,6 +925,7 @@ + { + int errno; + ++ uts_sem = MUTEX; + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + if (len < 0 || len > __NEW_UTS_LEN) +diff -ru --minimal linux/include/asm-alpha/errno.h linux/include/asm-alpha/errno.h +--- linux/include/asm-alpha/errno.h 2001-03-25 17:31:06.000000000 +0100 ++++ linux/include/asm-alpha/errno.h 2003-06-02 23:48:45.000000000 +0100 +@@ -134,6 +134,7 @@ + #define ELIBMAX 125 /* Attempting to link in too many shared libraries */ + #define ELIBEXEC 126 /* Cannot exec a shared library directly */ + #define ERESTART 127 /* Interrupted system call should be restarted */ ++#define EHASHCOLLISION 127 /* reiserfs hash collision */ + #define ESTRPIPE 128 /* Streams pipe error */ + + #define ENOMEDIUM 129 /* No medium found */ diff --git a/sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff b/sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff new file mode 100644 index 000000000000..2fa897df6e90 --- /dev/null +++ b/sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff @@ -0,0 +1,174 @@ +diff -u -r --minimal milo-2.2-18.orig/config.in milo-2.2-18/config.in +--- milo-2.2-18.orig/config.in 2001-07-18 15:58:30.000000000 +0100 ++++ milo-2.2-18/config.in 2003-06-05 18:52:06.000000000 +0100 +@@ -5,7 +5,7 @@ + + comment 'Alpha Linux Miniloader setup' + # +-string 'Path to kernel sources' KSRC /usr/src/linux ++string 'Path to kernel sources' KSRC ${WORKDIR}/linux + choice 'Alpha system type' \ + "Alpha-XLT MINI_ALPHA_XLT \ + Alpha-XL MINI_ALPHA_XL \ +diff -u -r --minimal milo-2.2-18.orig/devices.c milo-2.2-18/devices.c +--- milo-2.2-18.orig/devices.c 2001-07-18 16:59:38.000000000 +0100 ++++ milo-2.2-18/devices.c 2003-06-05 18:52:06.000000000 +0100 +@@ -98,7 +98,7 @@ + struct fs_struct init_fs = INIT_FS; + struct files_struct init_files = INIT_FILES; + struct signal_struct init_signals = INIT_SIGNALS; +-struct mm_struct init_mm = INIT_MM; ++struct mm_struct init_mm; + + unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */ + +@@ -1213,7 +1213,7 @@ + } + + +-void __wake_up(struct wait_queue **p, unsigned int mode, unsigned int wq_mode) ++void __wake_up(struct wait_queue **p, unsigned int mode) + { + wake_up(p); + } +diff -u -r --minimal milo-2.2-18.orig/Documentation/defconfig.milo milo-2.2-18/Documentation/defconfig.milo +--- milo-2.2-18.orig/Documentation/defconfig.milo 2001-07-19 10:59:45.000000000 +0100 ++++ milo-2.2-18/Documentation/defconfig.milo 2003-06-05 18:52:06.000000000 +0100 +@@ -5,7 +5,7 @@ + # + # Alpha Linux Miniloader setup + # +-KSRC=/usr/src/linux ++KSRC=${WORKDIR}/linux + # MINI_ALPHA_XLT is not set + # MINI_ALPHA_XL is not set + # MINI_ALPHA_BOOK1 is not set +@@ -36,7 +36,7 @@ + # MINI_VGA_RAW2 is not set + MINI_TGA_CONSOLE=y + MINI_EXTERNAL_FONT=y +-MINI_FONT_FILE=/usr/lib/kbd/consolefonts/default8x16.gz ++MINI_FONT_FILE=/usr/share/consolefonts/default8x16.psfu.gz + MILO_CONFIG_EXT2FS=y + MILO_CONFIG_MSDOSFS=y + MILO_CONFIG_REISERFS=y +diff -u -r --minimal milo-2.2-18.orig/hwrpb.c milo-2.2-18/hwrpb.c +--- milo-2.2-18.orig/hwrpb.c 2001-07-18 14:38:38.000000000 +0100 ++++ milo-2.2-18/hwrpb.c 2003-06-05 18:52:06.000000000 +0100 +@@ -368,9 +368,17 @@ + percpu = + (struct percpu_struct *) (((char *) hwrpb) + + hwrpb->processor_offset); +- percpu->serial_no[0] = 0x73695f78756e694c; ++#ifndef MILO_SERIAL_NUMBER0 ++#define MILO_SERIAL_NUMBER0 0x73695f78756e694c ++#endif /* MILO_SERIAL_NUMBER0 */ ++ ++#ifndef MILO_SERIAL_NUMBER1 ++#define MILO_SERIAL_NUMBER1 0x002174616572475f; ++#endif /* MILO_SERIAL_NUMBER1 */ ++ ++ percpu->serial_no[0] = MILO_SERIAL_NUMBER0; + /* :-) */ +- percpu->serial_no[1] = 0x002174616572475f; ++ percpu->serial_no[1] = MILO_SERIAL_NUMBER1; + percpu->type = cpuid(); + + /* +diff -u -r --minimal milo-2.2-18.orig/Makefile milo-2.2-18/Makefile +--- milo-2.2-18.orig/Makefile 2001-07-18 17:15:31.000000000 +0100 ++++ milo-2.2-18/Makefile 2003-06-05 18:52:06.000000000 +0100 +@@ -54,8 +54,8 @@ + # + + LINKFLAGS = -non_shared -N -T milo.lds +-CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ +- -fno-strict-aliasing -mcpu=ev5 -pipe -mno-fp-regs \ ++CFLAGS += -Wall -Wstrict-prototypes -fomit-frame-pointer \ ++ -fno-strict-aliasing -pipe -mno-fp-regs \ + -ffixed-8 -Wa,-mev6 -D__KERNEL__ -D__linux__ \ + -I$(KSRC)/include + +diff -u -r --minimal milo-2.2-18.orig/milo.c milo-2.2-18/milo.c +--- milo-2.2-18.orig/milo.c 2001-07-18 14:38:38.000000000 +0100 ++++ milo-2.2-18/milo.c 2003-06-05 19:16:16.000000000 +0100 +@@ -1436,9 +1436,10 @@ + { + extern U64 milo_memory_size; + +- printk("MILO (%s):\n", alpha_mv.vector_name); +- printk(" Built against Linux " UTS_RELEASE "\n"); ++ printk("Gentoo MILO (%s):\n", alpha_mv.vector_name); ++ printk(" Built against Gentoo Linux Kernel " UTS_RELEASE "\n"); + printk(" Using compiler " LINUX_COMPILER "\n"); ++ printk("\nWelcome to the Gentoo Linux MIniLOader\n"); + + #if 0 + /* what sort of video do we have? */ +@@ -1792,7 +1793,7 @@ + /* parse commands forever */ + while (1) { + +- printk("MILO> "); ++ printk("MILO > "); + + kbd_gets(command_string, 256); + printk_rows = 0; +diff -u -r --minimal milo-2.2-18.orig/tools/scripts/allfiles milo-2.2-18/tools/scripts/allfiles +--- milo-2.2-18.orig/tools/scripts/allfiles 2001-07-11 18:27:02.000000000 +0100 ++++ milo-2.2-18/tools/scripts/allfiles 2003-06-05 18:52:06.000000000 +0100 +@@ -1,7 +1,7 @@ + #!/bin/bash + + LOC=kernel/objs +-KSRC=/usr/src/linux/ ++KSRC=${WORKDIR}/linux + + rm -rf $LOC + +diff -u -r --minimal milo-2.2-18.orig/tools/scripts/build milo-2.2-18/tools/scripts/build +--- milo-2.2-18.orig/tools/scripts/build 2001-07-18 16:58:29.000000000 +0100 ++++ milo-2.2-18/tools/scripts/build 2003-06-05 19:14:25.000000000 +0100 +@@ -1,29 +1,9 @@ + #!/bin/bash + set -e + +-RELEASE=2.2-17 ++RELEASE=2.2-18-Gentoo + +-for i in \ +- "Alpha-XLT XLT" \ +- "Alpha-XL XL" \ +- "AlphaBook1 BOOK1" \ +- "Avanti AVANTI" \ +- "Cabriolet CABRIOLET" \ +- "EB66 EB66" \ +- "EB66+ EB66P" \ +- "EB64+ EB64P" \ +- "EB164 EB164" \ +- "PC164 PC164" \ +- "LX164 LX164" \ +- "SX164 SX164" \ +- "Noname NONAME" \ +- "Takara TAKARA" \ +- "Mikasa MIKASA" \ +- "Alcor ALCOR" \ +- "Miata MIATA" \ +- "Ruffian RUFFIAN" \ +- "Platform2000 P2K" \ +- "UDB UDB" ++for i in __MILO_ARCHES__ + do + short=`echo $i | awk '{print $1}'` + long=`echo $i | awk '{print $2}'` +diff -u -r --minimal milo-2.2-18.orig/tools/scripts/buildkernels milo-2.2-18/tools/scripts/buildkernels +--- milo-2.2-18.orig/tools/scripts/buildkernels 1999-08-19 14:08:55.000000000 +0100 ++++ milo-2.2-18/tools/scripts/buildkernels 2003-06-05 18:52:06.000000000 +0100 +@@ -1,6 +1,6 @@ + #!/bin/bash + +-LINUX=/usr/src/linux ++LINUX=${WORKDIR}/linux + KOUT=$(dirname `pwd`)/linux + + set -e diff --git a/sys-boot/milo/files/mkserial_no.c b/sys-boot/milo/files/mkserial_no.c new file mode 100644 index 000000000000..b4650447584f --- /dev/null +++ b/sys-boot/milo/files/mkserial_no.c @@ -0,0 +1,45 @@ +#include <stdio.h> + +/* some example serial numbers for the MILO bootloader */ +/* gcc -o mkserial_no mkserial_no.c */ +/* taviso@gentoo.org 2003 */ + +/* NOTE: remember you need a 0x00 (NULL terminator) at the end */ + +int main() +{ + long long serial_no[2]; + + /* 1) Linux_is_Great! */ + /* s i _ x u n i L */ + serial_no[0] = 0x73695f78756e694c; + /* ! t a e r G _ */ + serial_no[1] = 0x002174616572475f; + + /* 2) Gentoo Linux. */ + /* L o o t n e G */ + serial_no[0] = 0x4c206f6f746e6547; + /* . x u n i */ + serial_no[1] = 0x0000002e78756e69; + + /* 3) Gentoo/Alpha. */ + /* A / o o t n e G */ + serial_no[0] = 0x412f6f6f746e6547; + /* .a h p l */ + serial_no[1] = 0x0000002e6168706c; + + /* 4) Gentoo MILO. */ + /* M o o t n e G */ + serial_no[0] = 0x4d206f6f746e6547; + /* . O L I */ + serial_no[1] = 0x000000002e4f4c49; + + /* 5) |d|i|g|i|t|a|l| */ + /* i | g | i | d | */ + serial_no[0] = 0x697c677c697c647c; + /* | l | a | t | */ + serial_no[1] = 0x007c6c7c617c747c; + + printf ("serial number:\t%s\n", (char*) serial_no); + return (0); +} diff --git a/sys-boot/milo/files/objstrip.c b/sys-boot/milo/files/objstrip.c new file mode 100644 index 000000000000..bbda40330708 --- /dev/null +++ b/sys-boot/milo/files/objstrip.c @@ -0,0 +1,282 @@ +/* + * arch/alpha/boot/tools/objstrip.c + * + * Strip the object file headers/trailers from an executable (ELF or ECOFF). + * + * Copyright (C) 1996 David Mosberger-Tang. + */ +/* + * Converts an ECOFF or ELF object file into a bootable file. The + * object file must be a OMAGIC file (i.e., data and bss follow immediatly + * behind the text). See DEC "Assembly Language Programmer's Guide" + * documentation for details. The SRM boot process is documented in + * the Alpha AXP Architecture Reference Manual, Second Edition by + * Richard L. Sites and Richard T. Witek. + */ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> + +#include <sys/fcntl.h> +#include <sys/stat.h> +#include <sys/types.h> + +#include <linux/a.out.h> +#include <linux/coff.h> +#include <linux/param.h> +#include <linux/string.h> +#ifdef __ELF__ +# include <asm/elf.h> +# include <linux/elf.h> +#endif + +/* bootfile size must be multiple of BLOCK_SIZE: */ +#define BLOCK_SIZE 512 + +const char * prog_name; + + +void +usage (void) +{ + fprintf(stderr, + "usage: %s [-v] -p file primary\n" + " %s [-vb] file [secondary]\n", prog_name, prog_name); + exit(1); +} + + +int +main (int argc, char *argv[]) +{ + size_t nwritten, tocopy, n, mem_size, fil_size, pad = 0; + int fd, ofd, i, j, verbose = 0, primary = 0; + char buf[8192], *inname; + struct exec * aout; /* includes file & aout header */ + long offset; +#ifdef __ELF__ + struct elfhdr *elf; + struct elf_phdr *elf_phdr; /* program header */ + unsigned long long e_entry; +#endif + + prog_name = argv[0]; + + for (i = 1; i < argc && argv[i][0] == '-'; ++i) { + for (j = 1; argv[i][j]; ++j) { + switch (argv[i][j]) { + case 'v': + verbose = ~verbose; + break; + + case 'b': + pad = BLOCK_SIZE; + break; + + case 'p': + primary = 1; /* make primary bootblock */ + break; + } + } + } + + if (i >= argc) { + usage(); + } + inname = argv[i++]; + + fd = open(inname, O_RDONLY); + if (fd == -1) { + perror("open"); + exit(1); + } + + ofd = 1; + if (i < argc) { + ofd = open(argv[i++], O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd == -1) { + perror("open"); + exit(1); + } + } + + if (primary) { + /* generate bootblock for primary loader */ + + unsigned long bb[64], sum = 0; + struct stat st; + off_t size; + int i; + + if (ofd == 1) { + usage(); + } + + if (fstat(fd, &st) == -1) { + perror("fstat"); + exit(1); + } + + size = (st.st_size + BLOCK_SIZE - 1) & ~(BLOCK_SIZE - 1); + memset(bb, 0, sizeof(bb)); + strcpy((char *) bb, "Linux SRM bootblock"); + bb[60] = size / BLOCK_SIZE; /* count */ + bb[61] = 1; /* starting sector # */ + bb[62] = 0; /* flags---must be 0 */ + for (i = 0; i < 63; ++i) { + sum += bb[i]; + } + bb[63] = sum; + if (write(ofd, bb, sizeof(bb)) != sizeof(bb)) { + perror("boot-block write"); + exit(1); + } + printf("%lu\n", size); + return 0; + } + + /* read and inspect exec header: */ + + if (read(fd, buf, sizeof(buf)) < 0) { + perror("read"); + exit(1); + } + +#ifdef __ELF__ + elf = (struct elfhdr *) buf; + + if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) { + if (elf->e_type != ET_EXEC) { + fprintf(stderr, "%s: %s is not an ELF executable\n", + prog_name, inname); + exit(1); + } + if (!elf_check_arch(elf)) { + fprintf(stderr, "%s: is not for this processor (e_machine=%d)\n", + prog_name, elf->e_machine); + exit(1); + } + if (elf->e_phnum != 1) { + fprintf(stderr, + "%s: %d program headers (forgot to link with -N?)\n", + prog_name, elf->e_phnum); + } + + e_entry = elf->e_entry; + + lseek(fd, elf->e_phoff, SEEK_SET); + if (read(fd, buf, sizeof(*elf_phdr)) != sizeof(*elf_phdr)) { + perror("read"); + exit(1); + } + + elf_phdr = (struct elf_phdr *) buf; + offset = elf_phdr->p_offset; + mem_size = elf_phdr->p_memsz; + fil_size = elf_phdr->p_filesz; + + /* work around ELF bug: */ + if (elf_phdr->p_vaddr < e_entry) { + unsigned long delta = e_entry - elf_phdr->p_vaddr; + offset += delta; + mem_size -= delta; + fil_size -= delta; + elf_phdr->p_vaddr += delta; + } + + if (verbose) { + fprintf(stderr, "%s: extracting %#016lx-%#016lx (at %lx)\n", + prog_name, (long) elf_phdr->p_vaddr, + elf_phdr->p_vaddr + fil_size, offset); + } + } else +#endif + { + aout = (struct exec *) buf; + + if (!(aout->fh.f_flags & COFF_F_EXEC)) { + fprintf(stderr, "%s: %s is not in executable format\n", + prog_name, inname); + exit(1); + } + + if (aout->fh.f_opthdr != sizeof(aout->ah)) { + fprintf(stderr, "%s: %s has unexpected optional header size\n", + prog_name, inname); + exit(1); + } + + if (N_MAGIC(*aout) != OMAGIC) { + fprintf(stderr, "%s: %s is not an OMAGIC file\n", + prog_name, inname); + exit(1); + } + offset = N_TXTOFF(*aout); + fil_size = aout->ah.tsize + aout->ah.dsize; + mem_size = fil_size + aout->ah.bsize; + + if (verbose) { + fprintf(stderr, "%s: extracting %#016lx-%#016lx (at %lx)\n", + prog_name, aout->ah.text_start, + aout->ah.text_start + fil_size, offset); + } + } + + if (lseek(fd, offset, SEEK_SET) != offset) { + perror("lseek"); + exit(1); + } + + if (verbose) { + fprintf(stderr, "%s: copying %lu byte from %s\n", + prog_name, (unsigned long) fil_size, inname); + } + + tocopy = fil_size; + while (tocopy > 0) { + n = tocopy; + if (n > sizeof(buf)) { + n = sizeof(buf); + } + tocopy -= n; + if ((size_t) read(fd, buf, n) != n) { + perror("read"); + exit(1); + } + do { + nwritten = write(ofd, buf, n); + if ((ssize_t) nwritten == -1) { + perror("write"); + exit(1); + } + n -= nwritten; + } while (n > 0); + } + + if (pad) { + mem_size = ((mem_size + pad - 1) / pad) * pad; + } + + tocopy = mem_size - fil_size; + if (tocopy > 0) { + fprintf(stderr, + "%s: zero-filling bss and aligning to %lu with %lu bytes\n", + prog_name, pad, (unsigned long) tocopy); + + memset(buf, 0x00, sizeof(buf)); + do { + n = tocopy; + if (n > sizeof(buf)) { + n = sizeof(buf); + } + nwritten = write(ofd, buf, n); + if ((ssize_t) nwritten == -1) { + perror("write"); + exit(1); + } + tocopy -= nwritten; + } while (tocopy > 0); + } + return 0; +} diff --git a/sys-boot/milo/metadata.xml b/sys-boot/milo/metadata.xml new file mode 100644 index 000000000000..1d059ea1880b --- /dev/null +++ b/sys-boot/milo/metadata.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>alpha@gentoo.org</email> + <name>Alpha architecture team</name> + </maintainer> + <longdescription lang="en"> + On Intel based PC systems, the BIOS firmware sets up the system and + then loads the image to be run from the boot block of a DOS file + system. This is more or less what MILO does on an Alpha based system, + however there are several interesting differences between BIOS firmware + and MILO, not least of which is that MILO includes and uses standard + Linux device drivers unmodified. MILO is firmware, unlike LILO, which + relies on the BIOS firmware to get itself loaded. + </longdescription> +</pkgmetadata> diff --git a/sys-boot/milo/milo-2.4.18.ebuild b/sys-boot/milo/milo-2.4.18.ebuild new file mode 100644 index 000000000000..289decdcd74f --- /dev/null +++ b/sys-boot/milo/milo-2.4.18.ebuild @@ -0,0 +1,229 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic + +# Currently tested Systems: +# +# Ruffian: UX164, BX164 +# + +DESCRIPTION="The Alpha MIniLOader, for Alpha Machines without SRM" +HOMEPAGE="http://milo.core-systems.de/" + +# ive tested this, and it seems to make little difference +# which kernel version you use, so it makes sense to use the +# latest available 2.2 kernel with the latest bugfixes/drivers/etc. + +kernel_version="2.2.25" +milo_version="2.2-18" +ldmilo_patch="20010430" + +# milo-2.2-18.tar.bz2 :- latest milo sources +# linux-2.2.25.tar.bz2 :- latest linux 2.2 kernel sources +# ldmilo-patched-20010430 :- Ruffian ldmilo utility, with bugfixes by Jay Eastabrook +# linload.exe :- linload utility (ldmilo equivalent for non-ruffians). + +SRC_URI="http://www.suse.de/~stepan/source/milo-${milo_version}.tar.bz2 + https://www.kernel.org/pub/linux/kernel/v2.2/linux-${kernel_version}.tar.bz2 + https://dev.gentoo.org/~taviso/milo/ldmilo-patched-${ldmilo_patch} + http://ftp.namesys.com/pub/reiserfs-for-2.2/linux-2.2.20-reiserfs-3.5.35.diff.bz2 + https://dev.gentoo.org/~taviso/milo/linload.exe + https://www.ibiblio.org/pub/Linux/docs/HOWTO/MILO-HOWTO" +S="${WORKDIR}/milo-${milo_version}" + +# +# milo license is dec palcode license, dec bios emulation license, and gpl-2 rolled +# into one big ugly package. +# +# the dec licenses say you can basically do anything you like, including modify +# and redistribute for profit or non-profit, as long as its for use with Alpha +# architecture. +# + +LICENSE="MILO" +SLOT="0" +KEYWORDS="-* ~alpha" + +DEPEND="sys-apps/kbd" +RDEPEND="sys-fs/mtools" + +# You can change the default MILO serial +# number here, the MILO default is "Linux_is_Great!". +# There are some below that i have made you can +# use if you want, just uncomment the one you like. +# +# if you want to see how this works, to make your own +# look at mkserial_no.c in the filesdir. +# +##### Linux_is_Great! ################### +#milo_serial_number0=0x73695f78756e694c +#milo_serial_number1=0x002174616572475f +# +##### Gentoo Linux. ##################### +milo_serial_number0=0x4c206f6f746e6547 +milo_serial_number1=0x0000002e78756e69 +# +##### Gentoo/Alpha. ##################### +#milo_serial_number0=0x412f6f6f746e6547 +#milo_serial_number1=0x0000002e6168706c +# +##### Gentoo MILO. ###################### +#milo_serial_number0=0x4d206f6f746e6547 +#milo_serial_number1=0x000000002e4f4c49 +# +##### |d|i|g|i|t|a|l| ################### +#milo_serial_number0=0x697c677c697c647c +#milo_serial_number1=0x007c6c7c617c747c; +# + +src_unpack() { + # unpack everything the kernel and milo sources + unpack linux-${kernel_version}.tar.bz2 + unpack milo-${milo_version}.tar.bz2 + unpack linux-2.2.20-reiserfs-3.5.35.diff.bz2 +} + +src_prepare() { + # gcc3 fixes, and some tweaks to get a build, also + # reiserfs support for the kernel (and milo). + cd "${WORKDIR}"/linux; eapply "${FILESDIR}"/linux-${kernel_version}-gcc3-milo.diff || die + cd "${WORKDIR}"/linux; eapply "${WORKDIR}"/linux-2.2.20-reiserfs-3.5.35.diff || die + cd "${S}"; eapply "${FILESDIR}"/milo-${milo_version}-gcc3-gentoo.diff || die + eapply_user +} + +src_compile() { + unset MILO_ARCH + for arches in "Alpha-XLT XLT" \ + "Alpha-XL XL" \ + "AlphaBook1 BOOK1" \ + "Avanti AVANTI" \ + "Cabriolet CABRIOLET" \ + "EB66 EB66" \ + "EB66+ EB66P" \ + "EB64+ EB64P" \ + "EB164 EB164" \ + "PC164 PC164" \ + "LX164 LX164" \ + "SX164 SX164" \ + "Noname NONAME" \ + "Takara TAKARA" \ + "Mikasa MIKASA" \ + "Alcor ALCOR" \ + "Miata MIATA" \ + "Ruffian RUFFIAN" \ + "Platform2000 P2K" \ + "UDB UDB" + do + if [ -z "${MILO_IMAGE}" ]; then + MILO_ARCH="${MILO_ARCH} \"${arches}\"" + else + if echo ${arches} | grep -i ${MILO_IMAGE}; then + MILO_ARCH="\"${arches}\"" + fi + fi + done + + if [ -z "${MILO_ARCH}" ]; then + eerror "Sorry, but ${MILO_IMAGE} doesnt look valid to me" + eerror "Consult the Alpha installation guide, or the ebuild" + eerror "for a list of available Alphas." + die "${MILO_IMAGE} not supported, or not recognised." + fi + + sed -i "s!__MILO_ARCHES__!${MILO_ARCH}!g" "${S}"/tools/scripts/build + + ewarn + ewarn "seriously, this is going to take a while, go get some coffee..." + ewarn + einfo "this ebuild will build the standard MILO images, similar to those" + einfo "distributed with some distributions, and the images provided with" + einfo "the official MILO sources." + einfo + einfo "of course, the beauty of MILO is it can support any device supported" + einfo "by the linux kernel, so if you need support for non-standard hardware" + einfo "set the path to the .config you want in \$custom_milo_kernel_config and" + einfo "i will use it instead of the default." + ewarn + + # get kernel configured + cp ${custom_milo_kernel_config:-"${S}"/Documentation/config/linux-2.2.19-SuSE.config} \ + "${WORKDIR}"/linux/.config + cd "${WORKDIR}"/linux; yes n | make oldconfig || die "unable to configure kernel." + + # we're building a generic kernel that defaults to ev5, but theres no + # reason why we cant tweak the instruction set. + # im not sure if you can actually pull a system performance gain/faster + # boot from optimising milo, but at least you'll get a faster milo pager ;) + mcpu_flag="`get-flag mcpu`" + if [ ! -z "${mcpu_flag}" ]; then + sed -i "s/\(CFLAGS := \$(CFLAGS) \)-mcpu=ev5$/\1-mcpu=${mcpu_flag:-ev5}/g" \ + "${WORKDIR}"/linux/arch/alpha/Makefile + fi + + # build the generic linux kernel, of course if you have + # hardware not supported by this generic kernel, you are free + # to hack it (or the .config used here). + einfo "building a generic kernel for use with milo..." + unset CC DISTCC_HOSTS; make dep vmlinux || die "unable to build generic kernel for milo." + cat "${FILESDIR}"/objstrip.c > "${WORKDIR}"/linux/arch/alpha/boot/tools/objstrip.c + + # make the objstrip utility. + gcc "${WORKDIR}"/linux/arch/alpha/boot/tools/objstrip.c -o \ + "${WORKDIR}"/linux/arch/alpha/boot/tools/objstrip || die "couldnt build objstrip." + einfo "kernel build complete." + einfo "building milo images..." + + # we have a choice here, milo can set the serial number to just about + # anything we like, the milo author has chosen "Linux_is_Great!", which + # is a bit cheesy, but we will leave it as default if user hasnt chosen + # something else. + # see above for options. + + append-flags -DMILO_SERIAL_NUMBER0="${milo_serial_number0:-0x73695f78756e694c}" + append-flags -DMILO_SERIAL_NUMBER1="${milo_serial_number1:-0x002174616572475f}" + + # the Makefile missed this :-/ + cd "${S}"/tools/common; make || die "couldnt make commonlib." + + # build all the milo images. + cd "${S}"; tools/scripts/build || die "failed to build milo images." + + # put the ldmilo utility there. + cp "${DISTDIR}"/ldmilo-patched-${ldmilo_patch} "${S}"/binaries/ldmilo.exe + cp "${DISTDIR}"/linload.exe "${S}"/binaries/linload.exe + +} + +src_install() { + cd "${S}"; dodir /opt/milo + insinto /opt/milo + + einfo "Installing MILO images..." + for i in binaries/* + do + einfo " ${i}" + doins ${i} + done + + cd "${S}"/Documentation + + dodoc ChangeLog filesystem Nikita.Todo README.milo Todo README.BSD Stuff WhatIsMilo \ + "${FILESDIR}"/README-gentoo "${FILESDIR}"/mkserial_no.c "${DISTDIR}"/MILO-HOWTO + +} + +pkg_postinst() { + einfo "The MILO images have been installed into /opt/milo." + einfo "There are instructions in /usr/share/doc/${P} for making MILO boot floppies." + einfo "Alternative methods, (flash, srm, debug monitor, etc) are described in the MILO-HOWTO." + einfo + einfo "The important docs to read are the README-gentoo and the MILO-HOWTO." + einfo + ewarn "PLEASE, PLEASE, PLEASE, let me know if this works or not, i need to know which systems" + ewarn "need tweaking, and which ones are good to go. You can email me at taviso@gentoo.org" + einfo +} diff --git a/sys-boot/mkusb/Manifest b/sys-boot/mkusb/Manifest new file mode 100644 index 000000000000..f6c1b6529747 --- /dev/null +++ b/sys-boot/mkusb/Manifest @@ -0,0 +1,7 @@ +DIST mkusb-23.2.0-all.deb 57056 BLAKE2B 898c40c5eccc7c2d8f13d778cb5990504d48ba2a54b069147c721bd6ab3348395beb2be1f40a629e551dc5b18b627535f6f629b11cfcc7401dd7e0036e2b53d8 SHA512 e2a6333778f555be81e7de5ff260bc234a4f7384e2f1f8ead5c8c03746063a709b23964a60c65aa473a8e61159649558a7104d589386c2775dea473c62fada9f +DIST mkusb-23.2.0-common.deb 13520112 BLAKE2B 73acc8b7901225e630720efdcd29df30a6524c6c5b8e7e871be7dce14b96f0238c00ed58243dcf54c6e428c0c33fa56022779e8f0c551931fc811aabe225ad0d SHA512 55ee9894ad7fc75087230dfb7fec69c4d9734433bc1097ac58f52f03f4f780c71c4a6e9dc4045d1cb2da232d6532134ed1f33c2350014ed8f8d0a08d99397f00 +DIST mkusb-23.2.0-efi.deb 11566428 BLAKE2B 89d62818e3075020c5d4f806249c95e99d9643b4016d1b19af1ed6b3d2209bac1e322ba386cfb4f37eb9ab2fe9779bfdb901897e1c4159d1efdfb5efe49000f2 SHA512 7620378981ea7d008aa476840a325eca2bfbce0a362a82151a29619e2c151080e0f727106892986da04f21fca16ba0e0bfbb94d8be1d0ee69cd93bf170f3e93e +DIST mkusb-23.2.0-gui.deb 18164 BLAKE2B bc0ac05cc203a9abc8053f49a5d2283624cd9b03bd0dafda22b194cf6cd454e05eb7355abec954f01b463f885e64d2891834510cea2aac47507c5cbb4c8424ae SHA512 8f003506150685fecfd5e75fbc65df2dcde591cd22cdae102d10407c982f6b013955dbefd1ff7f7d66f7d6848ef6949f28ad69f7ae90b7cb9cc53d00c94b3c72 +DIST mkusb-23.2.0-nox.deb 30656 BLAKE2B c376bf6c2ad88e62ed49e6f89599fcd878453a91113f5ddd530623fb994319b01c5df00597d33be56757cd0c04ee6ae649553f58c7a6795705a022194c618d70 SHA512 6c132cfcd6835fc17ae34f00c02d6cb6e9ae1ce18a64a13696436c185e0835c3b1773bbb8b0dd5b0d5c66c04dafdf5ae3d9eafa233ec282fd73b2558706ac538 +DIST mkusb-23.2.0-plug.deb 35360 BLAKE2B 1b7f12aeb6b17ff0fdebc450c5d11bc7aea86c4bcdb753206505a750653018e451dac44da8a413cea6d57e7b3d57d961652aca58c590797a33da4ba2198d3e5c SHA512 61a36f5098c19218b15c14c1c3a8bd2c8f026a63227841701422984354b899d5e6735fa0d486e93339ac016743cb47a40beae6f0130af6b0016c00ac202b8c01 +DIST mkusb-23.2.0.deb 65376 BLAKE2B aa8028e0d330b63a83b9101caf8ae1adf0f12508351f9b97db436658d9ea8b93adf937e83300af320fb3c17a472b740509ee268868423c766fcad4d75756de83 SHA512 092809659654392af055414f8ccdcc4dbe2284c0d2e043df66988c89fefc13fa0aa0e0c7b258600d95e1496fba5686f246cadc1ac90154ce24362b33c5c6eccd diff --git a/sys-boot/mkusb/metadata.xml b/sys-boot/mkusb/metadata.xml new file mode 100644 index 000000000000..a68d5bc13f10 --- /dev/null +++ b/sys-boot/mkusb/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <bugs-to>https://bugs.launchpad.net/mkusb</bugs-to> + <doc>https://help.ubuntu.com/community/mkusb</doc> + <remote-id type="launchpad">mkusb</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/mkusb/mkusb-23.2.0.ebuild b/sys-boot/mkusb/mkusb-23.2.0.ebuild new file mode 100644 index 000000000000..aa7fbf59984b --- /dev/null +++ b/sys-boot/mkusb/mkusb-23.2.0.ebuild @@ -0,0 +1,73 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit unpacker xdg-utils + +DESCRIPTION="CLI and GUI for creating bootable live USB, with optional persistent storage" +HOMEPAGE="https://help.ubuntu.com/community/mkusb" +SRC_URI=" + https://launchpad.net/~$PN/+archive/ubuntu/ppa/+files/$PN-common_$PV-1ubuntu1_all.deb -> $P-common.deb + https://launchpad.net/~$PN/+archive/ubuntu/unstable/+files/dus_$PV-1ubuntu1_all.deb -> $P.deb + https://launchpad.net/~$PN/+archive/ubuntu/ppa/+files/guidus_$PV-1ubuntu1_all.deb -> $P-gui.deb + https://launchpad.net/~$PN/+archive/ubuntu/ppa/+files/${PN}_$PV-1ubuntu1_all.deb -> $P-all.deb + https://launchpad.net/~$PN/+archive/ubuntu/ppa/+files/$PN-plug_$PV-1ubuntu1_all.deb -> $P-plug.deb + https://launchpad.net/~$PN/+archive/ubuntu/ppa/+files/$PN-nox_$PV-1ubuntu1_all.deb -> $P-nox.deb + https://launchpad.net/~$PN/+archive/ubuntu/ppa/+files/usb-pack-efi_$PV-1ubuntu1_all.deb -> $P-efi.deb +" + +S="${WORKDIR}" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64" + +RESTRICT="strip" +# REQUIRES_EXCLUDE="libcef.so" # Already inside + +RDEPEND=" + app-admin/sudo + gnome-extra/zenity + sys-apps/gptfdisk + sys-apps/pv + sys-fs/ntfs3g +" +# About sys-fs/ntfs3g see my issue to make this dep optionsl https://bugs.launchpad.net/mkusb/+bug/2058962 + +QA_PREBUILT="*" + +src_unpack() { + unpack_deb "$DISTDIR/$P-common.deb" + unpack_deb "$DISTDIR/$P.deb" + unpack_deb "$DISTDIR/$P-gui.deb" + unpack_deb "$DISTDIR/$P-all.deb" + unpack_deb "$DISTDIR/$P-plug.deb" +} + +src_install() { + cp -R "${S}"/* "${D}" || die "Installing binary files failed" + + # Extract documentation files + # To solve + # "Please fix the ebuild not to install compressed files (manpages, documentation) when automatic compression is used + cd "$ED" + find usr/share/ -name *.gz -exec gzip -d {} \; + + # Against + # "QA Notice: The ebuild is installing to one or more unexpected paths:" + from="usr/share/doc" + to="usr/share/doc/$PF/" + mkdir -p $to + mv "$from/dus/" $to || die + mv "$from/guidus/" $to || die + mv "$from/mkusb/" $to || die + mv "$from/mkusb-common/" $to || die + mv "$from/mkusb-plug/" $to || die +} + +pkg_postinst() { + xdg_icon_cache_update +} + +# QA Notice about non-escaped $ - I created issue https://bugs.launchpad.net/mkusb/+bug/2059036 diff --git a/sys-boot/mokutil/Manifest b/sys-boot/mokutil/Manifest new file mode 100644 index 000000000000..c9a91d4ada31 --- /dev/null +++ b/sys-boot/mokutil/Manifest @@ -0,0 +1 @@ +DIST mokutil-0.7.2.tar.gz 39226 BLAKE2B e3b639070e03a41c9bbf45fd7c95656b1e149a1bf43fdc15396853303cf776b9b8279c48049ff5ec1c4397cb15c58d69c618b884864a7941ad747567963cd491 SHA512 cdab37f86191c009b8264f065c3ca8ca051d8c1366191dca4c142d4146a0f7b7614cb17e53b6a8ca6fde0462bc113d4a1a751673b755eea0b3ed6e90da507f5a diff --git a/sys-boot/mokutil/metadata.xml b/sys-boot/mokutil/metadata.xml new file mode 100644 index 000000000000..cc8c212f86d7 --- /dev/null +++ b/sys-boot/mokutil/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>zerochaos@gentoo.org</email> + <name>Rick Farina</name> + </maintainer> + <upstream> + <remote-id type="github">lcp/mokutil</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/mokutil/mokutil-0.7.2.ebuild b/sys-boot/mokutil/mokutil-0.7.2.ebuild new file mode 100644 index 000000000000..f45b54255553 --- /dev/null +++ b/sys-boot/mokutil/mokutil-0.7.2.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools + +DESCRIPTION="The utility to manipulate machines owner keys which managed in shim" +HOMEPAGE="https://github.com/lcp/mokutil" +SRC_URI="https://github.com/lcp/mokutil/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="amd64 x86" + +DEPEND="dev-libs/openssl:= + sys-apps/keyutils:= + sys-libs/efivar:= + virtual/libcrypt:=" +RDEPEND="${DEPEND}" +BDEPEND="virtual/pkgconfig" + +src_prepare() { + default + eautoreconf +} diff --git a/sys-boot/nettrom/Manifest b/sys-boot/nettrom/Manifest new file mode 100644 index 000000000000..7b18284583d7 --- /dev/null +++ b/sys-boot/nettrom/Manifest @@ -0,0 +1 @@ +DIST nettrom-2.3.3.tar.gz 801683 BLAKE2B 86c28e901b6cec2a708f4d52f304b4996e3f98d9faeef511f65965e3881a08f56dc7c39a6bb8056e09c08e377f8d318949fa8324b1ea75a464eb71f4ef4169c9 SHA512 7b8b85d7a0cda8c5860663e19ce75223d667eeb1997b28eaa2ce67d3c14e609cf98706d54f86b0e91e3dac0570d0ffee7f1737f21bac774a1150e58d783bc925 diff --git a/sys-boot/nettrom/metadata.xml b/sys-boot/nettrom/metadata.xml new file mode 100644 index 000000000000..98ae10b3c34a --- /dev/null +++ b/sys-boot/nettrom/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>embedded@gentoo.org</email> + <name>Embedded Gentoo</name> +</maintainer> +</pkgmetadata> diff --git a/sys-boot/nettrom/nettrom-2.3.3-r2.ebuild b/sys-boot/nettrom/nettrom-2.3.3-r2.ebuild new file mode 100644 index 000000000000..271a85172080 --- /dev/null +++ b/sys-boot/nettrom/nettrom-2.3.3-r2.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="NetWinder ARM bootloader and utilities" +HOMEPAGE="http://www.netwinder.org/" +SRC_URI="http://wh0rd.org/gentoo/${P}.tar.gz" +S=${WORKDIR} + +LICENSE="all-rights-reserved" +SLOT="0" +KEYWORDS="-* arm" +RESTRICT="mirror bindist" + +QA_PREBUILT=" + /sbin/flashwrite + /usr/sbin/logowrite + /usr/sbin/logoread" +QA_PRESTRIPPED="${QA_PREBUILT}" + +src_install() { + doman usr/man/man8/flashwrite.8 + rm -r usr/man || die + + insinto / + doins -r boot + + exeinto /sbin + doexe sbin/flashwrite + + exeinto /usr/sbin + doexe usr/sbin/logo{read,write} +} diff --git a/sys-boot/os-prober/Manifest b/sys-boot/os-prober/Manifest new file mode 100644 index 000000000000..cba10225f1fb --- /dev/null +++ b/sys-boot/os-prober/Manifest @@ -0,0 +1,2 @@ +DIST os-prober_1.81.tar.xz 27448 BLAKE2B 0159870612d265c5e610e093a8839129aa9dc111a6f3abee65a6044b4c997ba65a69f70deca246bde53c1cf5314812312178e82c0893093d9f23ced3b0176f9d SHA512 ffb0e618f9e58a7a8e4a265d253bad4e168c220697216684acb38dbfa20680e552eb7c5f3d2186cd750c61a8929bf152527aa85c39318ed8b025a4ffffadde50 +DIST os-prober_1.82.tar.xz 27596 BLAKE2B 2d703cf91931fbdc89f1d2ca6b2ef87368a11fb685821f4864f826b143a92c22d5544d99f0843900012f7d9ae230d9eb858de3ee99f6df5ed488c5fd604b51df SHA512 7ab1825e3d771a9fba8cff3a72dd54371e0e467090ba9780e0074a54a3a8451da5f771d7a8c9b51a5bbb03ad315d1887764335d7aaae77c2a6c4de426c667990 diff --git a/sys-boot/os-prober/files/os-prober-1.79-btrfs-subvolume-detection.patch b/sys-boot/os-prober/files/os-prober-1.79-btrfs-subvolume-detection.patch new file mode 100644 index 000000000000..61337661401f --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-1.79-btrfs-subvolume-detection.patch @@ -0,0 +1,511 @@ +Fixes detection of multiple linux installations on different subvolumes of the +same partition. This patch is a combination of https://src.fedoraproject.org/rpms/os-prober/blob/a27e5121193e2222ada672db3521a7d9de70991b/f/os-prober-btrfsfix.patch and https://build.opensuse.org/package/view_file/openSUSE:Factory/os-prober/Improve-btrfs-handling-on-os-probing-for-grub2.patch?rev=56 . + +Bug: https://bugs.gentoo.org/790434 + https://bugs.gentoo.org/817905 + https://bugs.debian.org/688336 + https://bugzilla.redhat.com/888341 + +--- a/common.sh ++++ b/common.sh +@@ -155,6 +155,7 @@ parse_proc_mounts () { + done + } + ++# add forth parameter to pickup btrfs subvol info + parsefstab () { + while read -r line; do + case "$line" in +@@ -165,12 +166,22 @@ parsefstab () { + set -f + set -- $line + set +f +- printf '%s %s %s\n' "$1" "$2" "$3" ++ printf '%s %s %s %s\n' "$1" "$2" "$3" "$4" + ;; + esac + done + } + ++#check_btrfs_mounted $bootsv $bootuuid) ++check_btrfs_mounted () { ++ bootsv="$1" ++ bootuuid="$2" ++ bootdev=$(blkid | grep "$bootuuid" | cut -d ':' -f 1) ++ bindfrom=$(grep " btrfs " /proc/self/mountinfo | ++ grep " $bootdev " | grep " /$bootsv " | cut -d ' ' -f 5) ++ printf "%s" "$bindfrom" ++} ++ + unescape_mount () { + printf %s "$1" | \ + sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g' +--- a/linux-boot-prober ++++ b/linux-boot-prober +@@ -5,16 +5,143 @@ set -e + + newns "$@" + require_tmpdir ++ERR="n" ++ ++tmpmnt=/var/lib/os-prober/mount ++if [ ! -d "$tmpmnt" ]; then ++ mkdir "$tmpmnt" ++fi ++ ++mounted= ++bootmnt= ++bootsv= ++bootuuid= + + grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true + +-partition="$1" ++if [ -z "$1" ]; then ++ ERR=y ++elif [ "$1" = btrfs -a -z "$2" ]; then ++ ERR=y ++elif [ "$1" = btrfs -a -z "$3" ]; then ++ ERR=y ++elif [ "$1" = btrfs ]; then ++ type=btrfs ++ echo "$2" | grep -q "^UUID=" || ERR=y ++ echo "$3" | grep -q "^subvol=" || ERR=y ++ export "$2" ++ export "$3" ++ partition=$(blkid | grep "$UUID" | cut -d ':' -f 1 | tr '\n' ' ' | cut -d ' ' -f 1) ++ debug "btrfs: partition=$partition, UUID=$UUID, subvol=$subvol" ++else ++ partition="$1" ++ type=other ++fi + +-if [ -z "$partition" ]; then ++if [ "x$ERR" != xn ]; then + echo "usage: linux-boot-prober partition" >&2 ++ echo " linux-boot-prober btrfs UUID=<> subvol=<>" >&2 + exit 1 + fi + ++if [ "$type" = btrfs ]; then ++ # handle all of the btrfs stuff here ++ if [ ! -e "/proc/self/mountinfo" ]; then ++ warn "/proc/self/mountinfo does not exist, exiting" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ mpoint=$(grep "btrfs" /proc/self/mountinfo | grep " /$subvol " | grep " $partition " | cut -d ' ' -f 5) ++ if [ "$mpoint" = "/" ]; then ++ warn "specifying active root not valid, exiting" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ if [ "$mpoint" = "$tmpmnt" ]; then ++ warn "btrfs subvol=$subvool, UUID=$UUID, already mounted on $tmpmnt **ERROR**" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ if [ -z "$mpoint" ]; then ++ # mount the btrfs root ++ if ! mount -o subvol=$subvol -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then ++ warn "error mounting btrfs subvol=$subvol UUID=$UUID" ++ umount "$tmpmnt/boot" 2>/dev/null ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ else ++ # bind-mount ++ if ! mount -o bind "$mpoint" "$tmpmnt" 2>/dev/null; then ++ warn "error mounting btrfs bindfrom=$mpoint subvol=$subvol UUID=$UUID" ++ umount "$tmpmnt/boot" 2>/dev/null ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ fi ++ debug "mounted btrfs $partition, subvol=$subvol on $tmpmnt" ++ if [ ! -e "$tmpmnt/etc/fstab" ]; then ++ warn "btrfs subvol=$subvol not root" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true ++ if [ -z "$bootmnt" ]; then ++ # /boot is part of the root ++ bootpart="$partition" ++ bootsv="$subvol" ++ elif echo "$bootmnt" | cut -d ' ' -f 3 | grep -q "btrfs"; then ++ # separate btrfs /boot subvolume ++ bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | grep "^subvol=" | sed "s/subvol=//" ) ++ bootuuid=$(echo "$bootmnt" | cut -d ' ' -f 1 | grep "^UUID=" | sed "s/UUID=//" ) ++ debug "mounting btrfs $tmpmnt/boot UUID=$bootuuid subvol=$bootsv" ++ bindfrom=$(check_btrfs_mounted $bootsv $bootuuid) ++ if [ -n "$bindfrom" ]; then ++ # already mounted some place ++ if ! mount -o bind $bindfrom "$tmpmnt/boot" 2>/dev/null; then ++ warn "error bind mounting btrfs boot subvol=$bootsv, from=$bindfrom" ++ umount "$tmpmnt/boot" 2>/dev/null ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ elif ! mount -o subvol=$bootsv -t btrfs -U $bootuuid "$tmpmnt/boot" 2>/dev/null; then ++ warn "error mounting btrfs boot partition subvol=$bootsv, UUID=$bootuuid" ++ umount "$tmpmnt/boot" 2>/dev/null ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " /$bootsv " | cut -d ' ' -f 10) ++ else ++ # non-btrfs partition or logical volume ++ linux_mount_boot $partition $tmpmnt ++ bootpart="${mountboot%% *}" ++ bootsv= ++ fi ++ ++ test="/usr/lib/linux-boot-probes/mounted/40grub2" ++ if [ -f $test ] && [ -x $test ]; then ++ debug "running $test $partition $bootpart $tmpmnt $type $subvol $bootsv" ++ if $test "$partition" "$bootpart" "$tmpmnt" "$type" "$subvol" "$bootsv"; then ++ debug "$test succeeded" ++ fi ++ fi ++ umount "$tmpmnt/boot" 2>/dev/null || true ++ if ! umount "$tmpmnt" 2>/dev/null; then ++ warn "problem umount $tmpmnt" ++ fi ++ rmdir "$tmpmnt" 2>/dev/null || true ++ ++ exit 0 ++fi ++ + if ! mapped="$(mapdevfs "$partition")"; then + log "Device '$partition' does not exist; skipping" + continue +@@ -22,8 +149,8 @@ fi + + if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then + for test in /usr/lib/linux-boot-probes/*; do +- debug "running $test" + if [ -x $test ] && [ -f $test ]; then ++ debug "running $test" + if $test "$partition"; then + debug "linux detected by $test" + break +--- a/linux-boot-probes/mounted/common/40grub2 ++++ b/linux-boot-probes/mounted/common/40grub2 +@@ -2,17 +2,42 @@ + . /usr/share/os-prober/common.sh + set -e + ++# add support for btrfs with no separate /boot ++# that is, rootsv = bootsv + partition="$1" + bootpart="$2" + mpoint="$3" + type="$4" ++rootsv="$5" ++bootsv="$6" + + found_item=0 + + entry_result () { ++ if [ "x$type" = "xbtrfs" ]; then ++ bsv=${bootsv:+/}${bootsv} ++ # if path is not relative to subvolume make it relative ++ kernel=${kernel#${bsv}} ++ kernelfile=$kernel ++ initrd=${initrd#${bsv}} ++ if [ "x$GRUB_FS" != "xbtrfs" ]; then ++ # absolute path needed: prepend subvolume if $kernel isn't empty ++ kernel=${kernel:+${bsv}}${kernel} ++ # handle multiple initrd paths ++ local initrd_path= ++ for path in ${initrd}; do ++ initrd_path+="${bsv}${path} " ++ done ++ initrd="${initrd_path% }" ++ fi ++ # assumed: rootsv != bootsv if rootsv isn't ancestor of bootsv ++ [ "$partition" != "$bootpart" -o "$rootsv" != "$bootsv" ] && kernelfile="/boot${kernelfile}" ++ else ++ kernelfile=$kernel ++ fi + if [ "$ignore_item" = 0 ] && \ + [ -n "$kernel" ] && \ +- [ -e "$mpoint/$kernel" ]; then ++ [ -e "$mpoint/$kernelfile" ]; then + result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" + found_item=1 + fi +@@ -64,7 +88,7 @@ parse_grub_menu () { + ignore_item=1 + fi + ;; +- linux) ++ linux|linuxefi|linux16) + # Hack alert: sed off any (hdn,n) but + # assume the kernel is on the same + # partition. +@@ -73,18 +98,18 @@ parse_grub_menu () { + parameters="$@" + # Systems with a separate /boot will not have + # the path to the kernel in grub.cfg. +- if [ "$partition" != "$bootpart" ]; then ++ if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then + kernel="/boot$kernel" + fi + ;; +- initrd) ++ initrd|initrdefi|initrd16) + shift + initrd="" + for initrd_path in "$@"; do + # sed hack, as above + initrd_path="$(echo "$initrd_path" | sed 's/(.*)//')" + # Initrd same. +- if [ "$partition" != "$bootpart" ]; then ++ if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then + initrd_path="/boot$initrd_path" + fi + if [ -z "$initrd" ]; then +--- a/os-prober ++++ b/os-prober +@@ -76,9 +76,12 @@ partitions () { + + # Also detect OSes on LVM volumes (assumes LVM is active) + if type lvs >/dev/null 2>&1; then +- echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name | ++ echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name 2>/dev/null | + sed "s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")" + fi ++ ++ # now lets make sure we got all of the btrfs partitions and disks ++ blkid | grep 'TYPE="btrfs"' | cut -d ':' -f 1 + } + + parse_proc_swaps () { +@@ -136,6 +139,8 @@ if [ -f /proc/mdstat ] ; then + grep "^md" /proc/mdstat | cut -d: -f2- | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true + fi + ++: >"$OS_PROBER_TMP/btrfs-vols" ++ + for partition in $(partitions); do + if ! mapped="$(mapdevfs "$partition")"; then + log "Device '$partition' does not exist; skipping" +@@ -154,7 +159,26 @@ for partition in $(partitions); do + continue + fi + +- if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then ++ # do btrfs processing here; both mounted and unmounted will ++ # be handled by 50mounted-tests so we can do a subvol only once. ++ type=$(blkid -o value -s TYPE $mapped || true) ++ if [ "$type" = btrfs ]; then ++ uuid=$(blkid -o value -s UUID $mapped) ++ if grep -q "^$uuid" "$OS_PROBER_TMP/btrfs-vols" ; then ++ continue ++ fi ++ debug "btrfs volume uuid=$uuid partition=$partition" ++ echo "$uuid" >>"$OS_PROBER_TMP/btrfs-vols" ++ test="/usr/lib/os-probes/50mounted-tests" ++ if [ -f "$test" ] && [ -x "$test" ]; then ++ debug "running $test on btrfs $partition" ++ if "$test" btrfs "$uuid" "$partition"; then ++ debug "os detected by $test" ++ continue ++ fi ++ fi ++ ++ elif ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then + for test in /usr/lib/os-probes/*; do + if [ -f "$test" ] && [ -x "$test" ]; then + debug "running $test on $partition" +--- a/os-probes/common/50mounted-tests ++++ b/os-probes/common/50mounted-tests +@@ -14,19 +14,31 @@ do_unmount() { + rmdir "$tmpmnt" || true + } + +-types="$(fs_type "$partition")" ++if [ "x$1" = xbtrfs ]; then ++ types=btrfs ++ if [ -z "$2" -o -z "$3" ]; then ++ debug "missing btrfs parameters, exiting" ++ exit 1 ++ fi ++ UUID="$2" ++ BTRFSDEV="$3" ++else ++ partition="$1" ++ types="$(fs_type "$partition")" || types=NOT-DETECTED ++fi ++ + if [ "$types" = NOT-DETECTED ]; then + debug "$1 type not recognised; skipping" +- exit 0 ++ exit 1 + elif [ "$types" = swap ]; then + debug "$1 is a swap partition; skipping" +- exit 0 ++ exit 1 + elif [ "$types" = crypto_LUKS ]; then + debug "$1 is a LUKS partition; skipping" +- exit 0 ++ exit 1 + elif [ "$types" = LVM2_member ]; then + debug "$1 is an LVM member; skipping" +- exit 0 ++ exit 1 + elif [ "$types" = ntfs ]; then + if type ntfs-3g >/dev/null 2>&1; then + types='ntfs-3g ntfs' +@@ -35,7 +47,7 @@ elif [ -z "$types" ]; then + if type cryptsetup >/dev/null 2>&1 && \ + cryptsetup luksDump "$partition" >/dev/null 2>&1; then + debug "$1 is a LUKS partition; skipping" +- exit 0 ++ exit 1 + fi + for type in $(grep -v nodev /proc/filesystems); do + # hfsplus filesystems are mountable as hfs. Try hfs last so +@@ -58,6 +70,108 @@ if [ ! -d "$tmpmnt" ]; then + fi + + mounted= ++ ++# all btrfs processing here. Handle both unmounted and ++# mounted subvolumes. ++if [ "$types" = btrfs ]; then ++ partition="$BTRFSDEV" ++ debug "begin btrfs processing for $UUID" ++ # note that the btrfs volume must not be mounted ro ++ if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then ++ debug "btrfs volume $UUID mounted" ++ else ++ warn "cannot mount btrfs volume $UUID, exiting" ++ rmdir "$tmpmnt" || true ++ exit 1 ++ fi ++ # besides regular subvols, get ro and snapshot so thet can be excluded ++ subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9) ++ rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9) ++ sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 14) ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount btrfs volume on $tmpmnt" ++ rmdir "$tmpmnt" || true ++ exit 1 ++ fi ++ ++ found= ++ mounted= ++ ++ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | cut -d ' ' -f 5)" ++ if [ -n "$mpoint" -a "x$mpoint" = "x/" ]; then ++ debug "This is the root for the running system" #running system must be done elsewhere ++ else ++ #partition was not root of running system, so lets look for bootable subvols ++ if [ -n "$mpoint" ] ; then ++ mounted=1 #partition was already mounted,so lets not unmount it when done ++ else ++ # again, do not mount btrfs ro ++ mount -t btrfs -U "$UUID" "$tmpmnt" ++ mpoint="$tmpmnt" ++ fi ++ ++ test="/usr/lib/os-probes/mounted/90linux-distro" ++ if [ -f "$test" ] && [ -x "$test" ]; then ++ debug "running subtest $test" ++ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID"; then ++ debug "os found by subtest $test on $partition" ++ found=1 ++ fi ++ fi ++ if [ -z "$mounted" ]; then ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount $tmpmnt" ++ fi ++ fi ++ fi ++ ++ if [ -z "$subvols" ]; then ++ debug "no subvols found on btrfs volume $UUID" ++ else ++ found= ++ for subvol in $subvols; do ++ debug "begin btrfs processing for $UUID subvol=$subvol" ++ if echo "$rosubvols" | grep -q -x "$subvol"; then ++ continue ++ fi ++ if echo "$sssubvols" | grep -q -x "$subvol"; then ++ continue ++ fi ++ mounted= ++ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)" ++ if [ -n "$mpoint" ]; then ++ if [ "x$mpoint" = "x/" ]; then ++ continue # this is the root for the running system ++ fi ++ mounted=1 ++ else ++ # again, do not mount btrfs ro ++ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt" ++ mpoint="$tmpmnt" ++ fi ++ test="/usr/lib/os-probes/mounted/90linux-distro" ++ if [ -f "$test" ] && [ -x "$test" ]; then ++ debug "running subtest $test" ++ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then ++ debug "os found by subtest $test on subvol $subvol" ++ found=1 ++ fi ++ fi ++ if [ -z "$mounted" ]; then ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount $tmpmnt" ++ fi ++ fi ++ done ++ fi ++ rmdir "$tmpmnt" || true ++ if [ "$found" ]; then ++ exit 0 ++ else ++ exit 1 ++ fi ++fi ++ + if type grub-mount >/dev/null 2>&1 && \ + type grub-probe >/dev/null 2>&1 && \ + grub-mount "$partition" "$tmpmnt" 2>/dev/null; then +--- a/os-probes/mounted/common/90linux-distro ++++ b/os-probes/mounted/common/90linux-distro +@@ -7,6 +7,8 @@ set -e + partition="$1" + dir="$2" + type="$3" ++uuid="$4" ++subvol="$5" + + # This test is inaccurate, but given separate / and /boot partitions and the + # fact that only some architectures have ld-linux.so, I can't see anything +@@ -143,7 +145,11 @@ if (ls "$dir"/lib*/ld*.so* && [ -d "$dir/boot" ] || ls "$dir"/usr/lib*/ld*.so*) + fi + + label="$(count_next_label "$short")" +- result "$partition:$long:$label:linux" ++ if [ "x$type" = "xbtrfs" -a "x$uuid" != "x" -a "x$subvol" != "x" ]; then ++ result "$partition:$long:$label:linux:$type:$uuid:$subvol" ++ else ++ result "$partition:$long:$label:linux" ++ fi + exit 0 + else + exit 1 diff --git a/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch b/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch new file mode 100644 index 000000000000..b5b90b2214da --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch @@ -0,0 +1,24 @@ +Fixes missing entries when os-prober is run in a chroot environment by falling back +to blkid if udev isn't available or if /run/udev isn't bind mounted. Modified from +https://build.opensuse.org/package/view_file/Base:System/os-prober/os-prober-05efi-blkid.patch?rev=103 + +Bug: https://bugs.gentoo.org/761475 + https://bugzilla.opensuse.org/1076779 + +--- a/os-probes/mounted/x86/05efi ++++ b/os-probes/mounted/x86/05efi +@@ -46,6 +46,14 @@ if type udevinfo > /dev/null 2>&1; then + fi + + eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')" ++ ++ # udev may not work in chroot as its db may not be there, bailout that by blkid (bsc#1076779) ++ if [ -z "$ID_PART_ENTRY_TYPE" -a -z "$ID_PART_ENTRY_SCHEME" ] && ++ type blkid > /dev/null 2>&1; then ++ debug "fallback to blkid" ++ eval "$(blkid -p -o udev "$partition" | grep -E '^(ID_PART_ENTRY_(TYPE|SCHEME))=')" ++ fi ++ + debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME" + debug "$partition partition type is $ID_PART_ENTRY_TYPE" + diff --git a/sys-boot/os-prober/files/os-prober-1.79-fix-busy-umount-message.patch b/sys-boot/os-prober/files/os-prober-1.79-fix-busy-umount-message.patch new file mode 100644 index 000000000000..a9859f5005ab --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-1.79-fix-busy-umount-message.patch @@ -0,0 +1,21 @@ +Fixes errors like "umount: /var/lib/os-prober/mount: target is busy." +which can appear in some corner-cases. + +Bug: https://bugzilla.redhat.com/903906 + +--- a/common.sh ++++ b/common.sh +@@ -336,3 +336,13 @@ linux_mount_boot () { + + mountboot="$bootpart $mounted" + } ++ ++umount_exec=$(which umount) ++umount() { ++ if ! $umount_exec $@ 2> /dev/null; then ++ error "umount error, retrying after 1 sec" ++ sleep 1 ++ $umount_exec $@ ++ fi ++} ++ diff --git a/sys-boot/os-prober/files/os-prober-1.79-mdraid-detection.patch b/sys-boot/os-prober/files/os-prober-1.79-mdraid-detection.patch new file mode 100644 index 000000000000..15b9de5117a9 --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-1.79-mdraid-detection.patch @@ -0,0 +1,28 @@ +Fixes OS detection on mdraid devices + +Bug: https://bugs.debian.org/648251 + https://bugzilla.redhat.com/752402 + +--- a/os-prober ++++ b/os-prober +@@ -64,6 +64,11 @@ partitions () { + exit 0 + fi + ++ # Add MD RAID devices ++ if [ -f /proc/mdstat ] ; then ++ awk '/^md/ {printf "/dev/"$1"\n"}' /proc/mdstat ++ fi ++ + # Also detect OSes on LVM volumes (assumes LVM is active) + if type lvs >/dev/null 2>&1; then + echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name | +@@ -123,7 +128,7 @@ if [ -f /proc/swaps ]; then + fi + : >"$OS_PROBER_TMP/raided-map" + if [ -f /proc/mdstat ] ; then +- grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true ++ grep "^md" /proc/mdstat | cut -d: -f2- | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true + fi + + for partition in $(partitions); do diff --git a/sys-boot/os-prober/files/os-prober-1.79-mounted-boot-partition-fix.patch b/sys-boot/os-prober/files/os-prober-1.79-mounted-boot-partition-fix.patch new file mode 100644 index 000000000000..1be8c810ddf5 --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-1.79-mounted-boot-partition-fix.patch @@ -0,0 +1,17 @@ +Fixes the problem of the root partition being returned instead of the boot +partition when both are already mounted somewhere. + +Bug: https://bugs.debian.org/699840 + https://bugzilla.redhat.com/906886 + +--- a/linux-boot-prober ++++ b/linux-boot-prober +@@ -167,7 +167,7 @@ else + bootpart="${mountboot%% *}" + bootmounted="${mountboot#* }" + else +- bootpart="$partition" ++ bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)" + bootmounted=0 + fi + for test in /usr/lib/linux-boot-probes/mounted/*; do diff --git a/sys-boot/os-prober/files/os-prober-1.79-use-fstab-name.patch b/sys-boot/os-prober/files/os-prober-1.79-use-fstab-name.patch new file mode 100644 index 000000000000..e38d85a77feb --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-1.79-use-fstab-name.patch @@ -0,0 +1,34 @@ +For symlinks to partions in fstab, returns the partition name from fstab instead +of the name of its resolved destination, eg., for /dev/mapper/mylvmvol in fstab, +linked to /dev/dm-2, return "mylvmvol" instead of "dm-2". + +Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699839 + https://bugzilla.redhat.com/show_bug.cgi?id=893472 + +--- a/common.sh ++++ b/common.sh +@@ -269,7 +269,7 @@ linux_mount_boot () { + if [ "$bindfrom" != "$tmpmnt/boot" ]; then + if mount --bind "$bindfrom" "$tmpmnt/boot"; then + mounted=1 +- bootpart="$1" ++ bootpart="$tmppart" + else + debug "failed to bind-mount $bindfrom onto $tmpmnt/boot" + fi +@@ -277,6 +277,15 @@ linux_mount_boot () { + fi + if [ "$mounted" ]; then + : ++ elif [ -e "$tmppart" ]; then ++ bootpart="$tmppart" ++ boottomnt="$tmppart" ++ elif [ -e "$tmpmnt/$tmppart" ]; then ++ bootpart="$tmppart" ++ boottomnt="$tmpmnt/$tmppart" ++ elif [ -e "/target/$tmppart" ]; then ++ bootpart="$tmppart" ++ boottomnt="/target/$tmppart" + elif [ -e "$1" ]; then + bootpart="$1" + boottomnt="$1" diff --git a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v3.patch b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v3.patch new file mode 100644 index 000000000000..58e592ae7e8e --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v3.patch @@ -0,0 +1,57 @@ +diff --git a/common.sh b/common.sh +index cc7a335..820caea 100644 +--- a/common.sh ++++ b/common.sh +@@ -326,3 +326,26 @@ umount() { + fi + } + ++list_mounts() { ++ if [ -f /proc/self/mountinfo ]; then ++ local x dev mount devs found mountinfo_placeholders ++ found=: ++ ++ # mountinfo may have 10 or 11 fields depending on mount namespaces ++ if [ $(head -n1 /proc/self/mountinfo | wc -w) -eq 10 ]; then ++ mountinfo_placeholders="x x" ++ else ++ mountinfo_placeholders="x x x" ++ fi ++ ++ while read -r x x dev x mount ${mountinfo_placeholders} fs x; do ++ if [ -L "/sys/dev/block/$dev" ]; then ++ devs="/dev/`readlink \"/sys/dev/block/$dev\" | rev | cut -d/ -f1 | rev`" ++ printf '%s %s %s\n' "$(mapdevfs "$devs")" "$mount" "$fs" ++ found="return 0" ++ fi ++ done < /proc/self/mountinfo ++ $found ++ fi ++ grep "^/dev/" /proc/mounts | parse_proc_mounts ++} +diff --git a/linux-boot-prober b/linux-boot-prober +index bacf219..804d9fe 100755 +--- a/linux-boot-prober ++++ b/linux-boot-prober +@@ -17,7 +17,7 @@ bootmnt= + bootsv= + bootuuid= + +-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true ++list_mounts >"$OS_PROBER_TMP/mounted-map" || true + + if [ -z "$1" ]; then + ERR=y +diff --git a/os-prober b/os-prober +index b76d85b..8b0c89b 100755 +--- a/os-prober ++++ b/os-prober +@@ -128,7 +128,7 @@ done + + # We need to properly canonicalize partitions with mount points and partitions + # used in RAID +-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true ++list_mounts >"$OS_PROBER_TMP/mounted-map" || true + : >"$OS_PROBER_TMP/swaps-map" + if [ -f /proc/swaps ]; then + grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true diff --git a/sys-boot/os-prober/metadata.xml b/sys-boot/os-prober/metadata.xml new file mode 100644 index 000000000000..ce1ef329068b --- /dev/null +++ b/sys-boot/os-prober/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>plevine457@gmail.com</email> + <name>Peter Levine</name> + </maintainer> + <maintainer type="person" proxied="proxy"> + <email>bkohler@gentoo.org</email> + <name>Ben Kohler</name> + </maintainer> +</pkgmetadata> diff --git a/sys-boot/os-prober/os-prober-1.81-r3.ebuild b/sys-boot/os-prober/os-prober-1.81-r3.ebuild new file mode 100644 index 000000000000..6763223a4061 --- /dev/null +++ b/sys-boot/os-prober/os-prober-1.81-r3.ebuild @@ -0,0 +1,103 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +inherit readme.gentoo-r1 toolchain-funcs + +DESCRIPTION="Utility to detect other OSs on a set of drives" +HOMEPAGE="https://salsa.debian.org/installer-team/os-prober" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git" +else + SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz" + KEYWORDS="amd64 x86" +fi + +LICENSE="GPL-3" +SLOT="0" + +# grub-mount needed per bug #607518 +RDEPEND="sys-boot/grub:2[mount]" + +# bug 594250 +QA_MULTILIB_PATHS="usr/lib/os-prober/.*" + +PATCHES=( + "${FILESDIR}"/${PN}-1.79-mdraid-detection.patch + "${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch + "${FILESDIR}"/${PN}-1.79-use-fstab-name.patch + "${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch + "${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch + "${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch + "${FILESDIR}"/${PN}-1.81-boot-detected-twice-v3.patch +) + +DOC_CONTENTS=" + If you intend for os-prober to detect versions of Windows installed on + NTFS-formatted partitions, your system must be capable of reading the + NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g. + + NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default. + To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub. +" + +src_prepare() { + default + # use default GNU rules + rm Makefile || die 'rm Makefile failed' +} + +src_compile() { + tc-export CC + emake newns +} + +src_install() { + dobin os-prober linux-boot-prober + + # Note: as no shared libraries are installed, /usr/lib is correct + exeinto /usr/lib/os-prober + doexe newns + + insinto /usr/share/os-prober + doins common.sh + + keepdir /var/lib/os-prober + + local debarch=${ARCH%-*} dir + + case ${debarch} in + amd64) debarch=x86 ;; + ppc|ppc64) debarch=powerpc ;; + esac + + for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do + exeinto /usr/lib/${dir} + doexe ${dir}/common/* + if [[ -d ${dir}/${debarch} ]]; then + for exe in ${dir}/${debarch}/*; do + [[ ! -d "${exe}" ]] && doexe "${exe}" + done + fi + if [[ -d ${dir}/${debarch}/efi ]]; then + exeinto /usr/lib/${dir}/efi + doexe ${dir}/${debarch}/efi/* + fi + done + + if use amd64 || use x86; then + exeinto /usr/lib/os-probes/mounted + doexe os-probes/mounted/powerpc/20macosx + fi + + einstalldocs + dodoc debian/changelog + + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/os-prober/os-prober-1.82.ebuild b/sys-boot/os-prober/os-prober-1.82.ebuild new file mode 100644 index 000000000000..6763223a4061 --- /dev/null +++ b/sys-boot/os-prober/os-prober-1.82.ebuild @@ -0,0 +1,103 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +inherit readme.gentoo-r1 toolchain-funcs + +DESCRIPTION="Utility to detect other OSs on a set of drives" +HOMEPAGE="https://salsa.debian.org/installer-team/os-prober" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git" +else + SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz" + KEYWORDS="amd64 x86" +fi + +LICENSE="GPL-3" +SLOT="0" + +# grub-mount needed per bug #607518 +RDEPEND="sys-boot/grub:2[mount]" + +# bug 594250 +QA_MULTILIB_PATHS="usr/lib/os-prober/.*" + +PATCHES=( + "${FILESDIR}"/${PN}-1.79-mdraid-detection.patch + "${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch + "${FILESDIR}"/${PN}-1.79-use-fstab-name.patch + "${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch + "${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch + "${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch + "${FILESDIR}"/${PN}-1.81-boot-detected-twice-v3.patch +) + +DOC_CONTENTS=" + If you intend for os-prober to detect versions of Windows installed on + NTFS-formatted partitions, your system must be capable of reading the + NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g. + + NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default. + To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub. +" + +src_prepare() { + default + # use default GNU rules + rm Makefile || die 'rm Makefile failed' +} + +src_compile() { + tc-export CC + emake newns +} + +src_install() { + dobin os-prober linux-boot-prober + + # Note: as no shared libraries are installed, /usr/lib is correct + exeinto /usr/lib/os-prober + doexe newns + + insinto /usr/share/os-prober + doins common.sh + + keepdir /var/lib/os-prober + + local debarch=${ARCH%-*} dir + + case ${debarch} in + amd64) debarch=x86 ;; + ppc|ppc64) debarch=powerpc ;; + esac + + for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do + exeinto /usr/lib/${dir} + doexe ${dir}/common/* + if [[ -d ${dir}/${debarch} ]]; then + for exe in ${dir}/${debarch}/*; do + [[ ! -d "${exe}" ]] && doexe "${exe}" + done + fi + if [[ -d ${dir}/${debarch}/efi ]]; then + exeinto /usr/lib/${dir}/efi + doexe ${dir}/${debarch}/efi/* + fi + done + + if use amd64 || use x86; then + exeinto /usr/lib/os-probes/mounted + doexe os-probes/mounted/powerpc/20macosx + fi + + einstalldocs + dodoc debian/changelog + + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild new file mode 100644 index 000000000000..7803b480fb27 --- /dev/null +++ b/sys-boot/os-prober/os-prober-9999.ebuild @@ -0,0 +1,103 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +inherit readme.gentoo-r1 toolchain-funcs + +DESCRIPTION="Utility to detect other OSs on a set of drives" +HOMEPAGE="https://salsa.debian.org/installer-team/os-prober" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git" +else + SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz" + KEYWORDS="~amd64 ~x86" +fi + +LICENSE="GPL-3" +SLOT="0" + +# grub-mount needed per bug #607518 +RDEPEND="sys-boot/grub:2[mount]" + +# bug 594250 +QA_MULTILIB_PATHS="usr/lib/os-prober/.*" + +PATCHES=( + "${FILESDIR}"/${PN}-1.79-mdraid-detection.patch + "${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch + "${FILESDIR}"/${PN}-1.79-use-fstab-name.patch + "${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch + "${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch + "${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch + "${FILESDIR}"/${PN}-1.81-boot-detected-twice-v3.patch +) + +DOC_CONTENTS=" + If you intend for os-prober to detect versions of Windows installed on + NTFS-formatted partitions, your system must be capable of reading the + NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g. + + NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default. + To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub. +" + +src_prepare() { + default + # use default GNU rules + rm Makefile || die 'rm Makefile failed' +} + +src_compile() { + tc-export CC + emake newns +} + +src_install() { + dobin os-prober linux-boot-prober + + # Note: as no shared libraries are installed, /usr/lib is correct + exeinto /usr/lib/os-prober + doexe newns + + insinto /usr/share/os-prober + doins common.sh + + keepdir /var/lib/os-prober + + local debarch=${ARCH%-*} dir + + case ${debarch} in + amd64) debarch=x86 ;; + ppc|ppc64) debarch=powerpc ;; + esac + + for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do + exeinto /usr/lib/${dir} + doexe ${dir}/common/* + if [[ -d ${dir}/${debarch} ]]; then + for exe in ${dir}/${debarch}/*; do + [[ ! -d "${exe}" ]] && doexe "${exe}" + done + fi + if [[ -d ${dir}/${debarch}/efi ]]; then + exeinto /usr/lib/${dir}/efi + doexe ${dir}/${debarch}/efi/* + fi + done + + if use amd64 || use x86; then + exeinto /usr/lib/os-probes/mounted + doexe os-probes/mounted/powerpc/20macosx + fi + + einstalldocs + dodoc debian/changelog + + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/palo/Manifest b/sys-boot/palo/Manifest new file mode 100644 index 000000000000..269dddbd22c4 --- /dev/null +++ b/sys-boot/palo/Manifest @@ -0,0 +1,2 @@ +DIST palo-2.28.tar.gz 133331 BLAKE2B 4e67528156813191cc334bc9e461f9741eee93ce2a9cf0edc1271c26f8515b7a1d3657478e6476d2d910f2e8a0e042583159e01c106b3eb034d944677f2296d5 SHA512 27188bbe654fa8c2f5ed30b9927db7957dfae450f1df5dcc7ff306520c4092c225c233cefeac5d9813663490a3ae703907ad92d3f12d87f853587ef7bbba5f50 +DIST palo-2.29.tar.gz 134680 BLAKE2B 9f6c88e052466bf4e155bf7531b9f25a2018e795af68c348e7f334b787aa1c4e4d9338bde0580d5e5378d5c72405fdef0527d884c6d39720cc3b2473a7b3c4e3 SHA512 d45b095a1168933febb704df208e9b2e8a16de093bd726a1f867dbf3a39c7bde302fb1263082a1f78c1cf9275a0792afd49e91a0c6519f3c9fc597e22604404f diff --git a/sys-boot/palo/files/99palo b/sys-boot/palo/files/99palo new file mode 100644 index 000000000000..8caea49f51ad --- /dev/null +++ b/sys-boot/palo/files/99palo @@ -0,0 +1,3 @@ +#!/bin/sh + +palo -v diff --git a/sys-boot/palo/files/palo-2.28-toolchain.patch b/sys-boot/palo/files/palo-2.28-toolchain.patch new file mode 100644 index 000000000000..6fbb9e4e3d78 --- /dev/null +++ b/sys-boot/palo/files/palo-2.28-toolchain.patch @@ -0,0 +1,22 @@ +--- a/palo/Makefile ++++ b/palo/Makefile +@@ -10,9 +10,9 @@ INCLUDES=common.h load.h palo.h + OS := $(shell uname -s) + CC?=cc + ifeq ($(strip ${OS}),HP-UX) +-CFLAGS=-g -O -I../include -I../lib -I$(PA)/include ++CFLAGS=-O -I../include -I../lib -I$(PA)/include + else +-CFLAGS=-g -O -I../include -I../lib -D_FILE_OFFSET_BITS=64 ++CFLAGS=-O -I../include -I../lib -D_FILE_OFFSET_BITS=64 + CFLAGS+=-Wno-old-style-definition + endif + +@@ -23,7 +23,6 @@ BLDINFO := $(shell echo https://parisc.docs.kernel.org - `LC_TIME=C date`) + endif + + # LDFLAGS=-Wl,-Bstatic +-LDFLAGS= + + OFILES2=mkbootable.o elf64.o load.o paloio.o elf32.o error.o gzip.o + diff --git a/sys-boot/palo/files/palo.conf b/sys-boot/palo/files/palo.conf new file mode 100644 index 000000000000..8880b50b5f1f --- /dev/null +++ b/sys-boot/palo/files/palo.conf @@ -0,0 +1,8 @@ +# Please read the palo --help output for more info +# Non-commented lines are treated as command line arguments + +--commandline=2/vmlinux root=/dev/sda4 +--init-partitioned=/dev/sda + +#Uncomment this if you want a rescue kernel +#--recoverykernel=/boot/vmlinux.old diff --git a/sys-boot/palo/metadata.xml b/sys-boot/palo/metadata.xml new file mode 100644 index 000000000000..26861344b531 --- /dev/null +++ b/sys-boot/palo/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> +<email>hppa@gentoo.org</email> +<name>HPPA architecture team</name> +</maintainer> +</pkgmetadata> diff --git a/sys-boot/palo/palo-2.28.ebuild b/sys-boot/palo/palo-2.28.ebuild new file mode 100644 index 000000000000..ea53a5f9f8a1 --- /dev/null +++ b/sys-boot/palo/palo-2.28.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="PALO: PArisc Linux Loader" +HOMEPAGE="https://parisc.wiki.kernel.org/ https://git.kernel.org/pub/scm/linux/kernel/git/deller/palo.git/" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/deller/palo.git" + inherit git-r3 +else + SRC_URI="https://git.kernel.org/pub/scm/linux/kernel/git/deller/${PN}.git/snapshot/${P}.tar.gz" + KEYWORDS="-* ~hppa" +fi + +LICENSE="GPL-2" +SLOT="0" + +PATCHES=( + "${FILESDIR}"/${PN}-2.28-toolchain.patch +) + +src_compile() { + local target + for target in '-C palo' '-C ipl' 'iplboot'; do + emake AR="$(tc-getAR)" CC="$(tc-getCC)" LD="$(tc-getLD)" ${target} + done +} + +src_install() { + into / + dosbin palo/palo + + insinto /usr/share/palo + doins iplboot + + insinto /etc + doins "${FILESDIR}"/palo.conf + + insinto /etc/kernel/postinst.d + insopts -m 0744 + doins "${FILESDIR}"/99palo + + doman palo.8 + + dodoc TODO debian/changelog README.html +} diff --git a/sys-boot/palo/palo-2.29.ebuild b/sys-boot/palo/palo-2.29.ebuild new file mode 100644 index 000000000000..99d80c6b4975 --- /dev/null +++ b/sys-boot/palo/palo-2.29.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="PALO: PArisc Linux Loader" +HOMEPAGE="https://parisc.wiki.kernel.org/ https://git.kernel.org/pub/scm/linux/kernel/git/deller/palo.git/" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/deller/palo.git" + inherit git-r3 +else + SRC_URI="https://git.kernel.org/pub/scm/linux/kernel/git/deller/${PN}.git/snapshot/${P}.tar.gz" + KEYWORDS="-* ~hppa" +fi + +LICENSE="GPL-2" +SLOT="0" + +PATCHES=( + "${FILESDIR}"/${PN}-2.28-toolchain.patch +) + +src_compile() { + local target + for target in '-C palo' '-C ipl' 'iplboot'; do + emake AR="$(tc-getAR)" CC="$(tc-getCC)" LD="$(tc-getLD)" ${target} + done +} + +src_install() { + into / + dosbin palo/palo + + insinto /usr/share/palo + doins iplboot + + insinto /etc + doins "${FILESDIR}"/palo.conf + + insinto /etc/kernel/postinst.d + insopts -m 0744 + doins "${FILESDIR}"/99palo + + doman palo.8 + + dodoc TODO debian/changelog README.html +} diff --git a/sys-boot/palo/palo-9999.ebuild b/sys-boot/palo/palo-9999.ebuild new file mode 100644 index 000000000000..ea53a5f9f8a1 --- /dev/null +++ b/sys-boot/palo/palo-9999.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="PALO: PArisc Linux Loader" +HOMEPAGE="https://parisc.wiki.kernel.org/ https://git.kernel.org/pub/scm/linux/kernel/git/deller/palo.git/" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/deller/palo.git" + inherit git-r3 +else + SRC_URI="https://git.kernel.org/pub/scm/linux/kernel/git/deller/${PN}.git/snapshot/${P}.tar.gz" + KEYWORDS="-* ~hppa" +fi + +LICENSE="GPL-2" +SLOT="0" + +PATCHES=( + "${FILESDIR}"/${PN}-2.28-toolchain.patch +) + +src_compile() { + local target + for target in '-C palo' '-C ipl' 'iplboot'; do + emake AR="$(tc-getAR)" CC="$(tc-getCC)" LD="$(tc-getLD)" ${target} + done +} + +src_install() { + into / + dosbin palo/palo + + insinto /usr/share/palo + doins iplboot + + insinto /etc + doins "${FILESDIR}"/palo.conf + + insinto /etc/kernel/postinst.d + insopts -m 0744 + doins "${FILESDIR}"/99palo + + doman palo.8 + + dodoc TODO debian/changelog README.html +} diff --git a/sys-boot/plymouth-openrc-plugin/Manifest b/sys-boot/plymouth-openrc-plugin/Manifest new file mode 100644 index 000000000000..954fdbd22921 --- /dev/null +++ b/sys-boot/plymouth-openrc-plugin/Manifest @@ -0,0 +1,2 @@ +DIST plymouth-openrc-plugin-0.1.3.tar.gz 9404 BLAKE2B 809cfab881ef47565badfc330b77ae07a8bbbddf822cbdb50f2d1d2a0c95f915ac5024e02400ab2ea9d8f98dc466a8a3cbad92805587f77a00e58c9f9d78d388 SHA512 b07a4d9d56c8f49d5b0a91799fe0100eac705cd2a266674539948fdc661876474a93d8ed5f329f097a1fc5dc571f3b3c00322191fb77d2a7e32b1ff192ca0a6b +DIST plymouth-openrc-plugin-0.4.0.tar.gz 10381 BLAKE2B b09557bdb5f8b7d9d26dc0b1a135b6069c4d429598a028986d3f8d795cd12a41a6042bc9fecc5b3eae53b24c57a92cd2ad2cf69f9405a8e83b8cb64bafefbfba SHA512 fd6bd55c156e12be4eeb20fa502d10e61963df0b3bb254056704bb2a878edf5dc9e80f02e691b431a1d4471faa6d4c97d4ab7def9ddba560494ca32225752d0b diff --git a/sys-boot/plymouth-openrc-plugin/metadata.xml b/sys-boot/plymouth-openrc-plugin/metadata.xml new file mode 100644 index 000000000000..5f0cea7780d7 --- /dev/null +++ b/sys-boot/plymouth-openrc-plugin/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>kangie@gentoo.org</email> + <name>Matt Jolly</name> + </maintainer> + <upstream> + <maintainer status="active"> + <email>kangie@gentoo.org</email> + <name>Matt Jolly</name> + </maintainer> + <remote-id type="github">Kangie/plymouth-openrc-plugin</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/plymouth-openrc-plugin/plymouth-openrc-plugin-0.1.3.ebuild b/sys-boot/plymouth-openrc-plugin/plymouth-openrc-plugin-0.1.3.ebuild new file mode 100644 index 000000000000..e4ce62e6dfbb --- /dev/null +++ b/sys-boot/plymouth-openrc-plugin/plymouth-openrc-plugin-0.1.3.ebuild @@ -0,0 +1,30 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DESCRIPTION="Plymouth plugin for OpenRC" +HOMEPAGE="https://github.com/Kangie/plymouth-openrc-plugin" +SRC_URI="https://github.com/Kangie/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86" +IUSE="" + +DEPEND="sys-apps/openrc" +RDEPEND="${DEPEND} + sys-boot/plymouth + !sys-apps/systemd" + +src_install() { + insinto /$(get_libdir)/rc/plugins + doins plymouth.so +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]]; then + ewarn "You need to disable 'rc_interactive' feature in /etc/rc.conf to make" + ewarn "Plymouth work properly with OpenRC init system." + fi +} diff --git a/sys-boot/plymouth-openrc-plugin/plymouth-openrc-plugin-0.4.0.ebuild b/sys-boot/plymouth-openrc-plugin/plymouth-openrc-plugin-0.4.0.ebuild new file mode 100644 index 000000000000..583a854bab67 --- /dev/null +++ b/sys-boot/plymouth-openrc-plugin/plymouth-openrc-plugin-0.4.0.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit meson + +DESCRIPTION="Plymouth plugin for OpenRC" +HOMEPAGE="https://github.com/Kangie/plymouth-openrc-plugin" +SRC_URI="https://github.com/Kangie/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86" +IUSE="debug" + +DEPEND=">=sys-apps/openrc-0.56" +RDEPEND="${DEPEND} + sys-boot/plymouth + !sys-apps/systemd" + +src_configure() { + local emesonargs=( + -Ddebug=$(usex debug true false) + ) + meson_src_configure +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]]; then + ewarn "The 'rc_interactive' feature in /etc/rc.conf must be disabled" + ewarn "for Plymouth work properly with OpenRC init system." + fi +} diff --git a/sys-boot/plymouth/Manifest b/sys-boot/plymouth/Manifest new file mode 100644 index 000000000000..fe4704d58a05 --- /dev/null +++ b/sys-boot/plymouth/Manifest @@ -0,0 +1,3 @@ +DIST gentoo-logo.png 14501 BLAKE2B e7236c16b96a2d35a6f062b89bc0a6c6fc696a803b7da734ff9ae255fcd65e549d9bc3d510c283e235a770f42edcbdffc1d5cc4c2fcdec9cc931eb0acf504859 SHA512 059a555931b6d2a910bcd887f5ea0cc17c6edf2d2d45c03a1fec1bdda0138ba6bca6bdf90a65c6520a3f8f1b51ecf6f7956098f45ed6c1276f29c835e729163c +DIST plymouth-22.02.122.tar.xz 1183608 BLAKE2B 8bb1362fcaa7d4c0fb1b69729a8a681d992a5d2abc07644d3be5cc0b19df2cac83df031165a65fa06f95042f619b9f4b7a7e1f3816528f6623473a2b1303e1be SHA512 9f2f5a7121b431f16561d6b5f31177ff06cf1e6bdffaa68c1fe08aa3c765a96dee745824aae8eaac9a0b4a08f0a17a9ae79a82bd0826fcc3fe14d8553635f817 +DIST plymouth-24.004.60.tar.xz 1059904 BLAKE2B 092abeafb7a31d33be8c73160e87a681bcc8bdf72e79c07cca4152fc1a262dc857af5e8f31f32c850332ff6804fa5a87e05fd35b6490fa26153451f38d994434 SHA512 6c66ae81498afea75a9cc1c19ec82b26210a3bd463f14b8ea7c1cd1e327069ef32f752f4ee5236070825ee42599cf05f14271000523bdbae656a200d2e60d341 diff --git a/sys-boot/plymouth/files/0.9.3-glibc-sysmacros.patch b/sys-boot/plymouth/files/0.9.3-glibc-sysmacros.patch new file mode 100644 index 000000000000..8969161bb195 --- /dev/null +++ b/sys-boot/plymouth/files/0.9.3-glibc-sysmacros.patch @@ -0,0 +1,45 @@ +From f8d7813b32dfe129d1e5718719ee3eff131f4fac Mon Sep 17 00:00:00 2001 +From: Kjell Claesson <kjell.claesson@epost.tidanet.se> +Date: Fri, 18 Aug 2017 00:25:56 +0200 +Subject: [PATCH] Fix build with newer glibc + +Signed-off-by: Gilles Dartiguelongue <eva@gentoo.org> +--- + configure.ac | 1 + + src/libply-splash-core/ply-terminal.c | 8 ++++++++ + 2 files changed, 9 insertions(+) + +diff --git a/configure.ac b/configure.ac +index c32697f..8376789 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -5,6 +5,7 @@ AC_CONFIG_AUX_DIR(build-tools) + + AC_USE_SYSTEM_EXTENSIONS + AC_SYS_LARGEFILE ++AC_HEADER_MAJOR + AC_PROG_AWK + AC_PROG_CC_STDC + AM_PROG_CC_C_O +diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c +index a0954f2..ef62bf8 100644 +--- a/src/libply-splash-core/ply-terminal.c ++++ b/src/libply-splash-core/ply-terminal.c +@@ -36,6 +36,14 @@ + #include <unistd.h> + #include <wchar.h> + ++/* major()/minor() */ ++#ifdef MAJOR_IN_MKDEV ++# include <sys/mkdev.h> ++#endif ++#ifdef MAJOR_IN_SYSMACROS ++# include <sys/sysmacros.h> ++#endif ++ + #include <linux/kd.h> + #include <linux/major.h> + #include <linux/vt.h> +-- +2.14.1 + diff --git a/sys-boot/plymouth/files/plymouth-22.02.122-glibc-2.36.patch b/sys-boot/plymouth/files/plymouth-22.02.122-glibc-2.36.patch new file mode 100644 index 000000000000..b1da112732e3 --- /dev/null +++ b/sys-boot/plymouth/files/plymouth-22.02.122-glibc-2.36.patch @@ -0,0 +1,25 @@ +https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/5f1e43c00039a7fe1fff768b91a05a695fb4a53d +https://bugs.gentoo.org/863839 + +From 5f1e43c00039a7fe1fff768b91a05a695fb4a53d Mon Sep 17 00:00:00 2001 +From: Ray Strode <rstrode@redhat.com> +Date: Wed, 3 Aug 2022 15:23:33 -0400 +Subject: [PATCH] ply-utils: Drop linux/fs.h include + +It was needed long ago for a function we no longer even have. + +Now it's causing compile errors on Fedora 37 because it's conflicting +with sys/mount.h. + +This commit drops it. +--- a/src/libply/ply-utils.c ++++ b/src/libply/ply-utils.c +@@ -46,7 +46,6 @@ + #include <sys/user.h> + #include <sys/wait.h> + #include <time.h> +-#include <linux/fs.h> + #include <linux/vt.h> + + #include <dlfcn.h> +GitLab diff --git a/sys-boot/plymouth/files/plymouth-22.02.122-has_rpmatch.patch b/sys-boot/plymouth/files/plymouth-22.02.122-has_rpmatch.patch new file mode 100644 index 000000000000..2c3d62ca48c1 --- /dev/null +++ b/sys-boot/plymouth/files/plymouth-22.02.122-has_rpmatch.patch @@ -0,0 +1,16 @@ +Use C23 __has_include to add correct include on musl. Was compiler extension +before C23, works on clang/gcc versions we care about. +https://bugs.gentoo.org/898564 +--- a/src/libply/ply-command-parser.c 2025-02-26 14:05:33.417781845 +0000 ++++ b/src/libply/ply-command-parser.c 2025-02-26 14:09:10.068476721 +0000 +@@ -29,6 +29,10 @@ + #include <stdlib.h> + #include <string.h> + ++#if __has_include(<rpmatch.h>) ++#include <rpmatch.h> ++#endif ++ + #include "ply-buffer.h" + #include "ply-list.h" + #include "ply-utils.h" diff --git a/sys-boot/plymouth/metadata.xml b/sys-boot/plymouth/metadata.xml new file mode 100644 index 000000000000..c35f788c4d8b --- /dev/null +++ b/sys-boot/plymouth/metadata.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>prometheanfire@gentoo.org</email> + <name>Matthew Thode</name> + </maintainer> + <use> + <flag name="drm">Provides abstraction to the DRM drivers (intel, + nouveau and vmwgfx at this moment)</flag> + <flag name="pango">Adds support for printing text on splash screen and + text prompts, e.g. for password</flag> + <flag name="split-usr">Enable this if /bin and /usr/bin are separate + directories</flag> + <flag name="freetype">Build with freetype support (if enabled, used for + encryption prompts)</flag> + </use> + <upstream> + <remote-id type="freedesktop-gitlab">plymouth/plymouth</remote-id> + </upstream> + <longdescription lang="en"> + Plymouth is an application that runs very early in the boot process + (even before the root filesystem is mounted!) that provides a graphical + boot animation while the boot process happens in the background. + + It is designed to work on systems with DRM modesetting drivers. Ideally, + the goal is to get rid of all flicker during startup. For systems that + don't have DRM mode settings drivers, plymouth falls back to text mode. + </longdescription> +</pkgmetadata> diff --git a/sys-boot/plymouth/plymouth-22.02.122-r4.ebuild b/sys-boot/plymouth/plymouth-22.02.122-r4.ebuild new file mode 100644 index 000000000000..1b6bbe00ae9a --- /dev/null +++ b/sys-boot/plymouth/plymouth-22.02.122-r4.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic readme.gentoo-r1 systemd + +DESCRIPTION="Graphical boot animation (splash) and logger" +HOMEPAGE="https://gitlab.freedesktop.org/plymouth/plymouth" +SRC_URI="https://dev.gentoo.org/~aidecoe/distfiles/${CATEGORY}/${PN}/gentoo-logo.png" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.freedesktop.org/plymouth/plymouth" +else + SRC_URI+=" https://www.freedesktop.org/software/plymouth/releases/${P}.tar.xz" + KEYWORDS="~alpha amd64 arm arm64 ~loong ppc ppc64 ~riscv ~sparc x86" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="debug +drm +gtk +pango selinux +split-usr static-libs +udev" + +CDEPEND=" + >=media-libs/libpng-1.2.16:= + drm? ( x11-libs/libdrm ) + gtk? ( + dev-libs/glib:2 + x11-libs/cairo + >=x11-libs/gtk+-3.14:3[X] + ) + pango? ( + x11-libs/cairo + >=x11-libs/pango-1.21[X] + ) +" +DEPEND="${CDEPEND} + elibc_musl? ( sys-libs/rpmatch-standalone ) + pango? ( x11-base/xorg-proto ) + app-text/docbook-xsl-stylesheets + dev-libs/libxslt + virtual/pkgconfig +" +# Block due bug #383067 +RDEPEND="${CDEPEND} + selinux? ( sec-policy/selinux-plymouthd ) + udev? ( virtual/udev ) +" + +DOC_CONTENTS=" + Follow the following instructions to set up Plymouth:\n + https://wiki.gentoo.org/wiki/Plymouth#Configuration +" + +PATCHES=( + "${FILESDIR}"/0.9.3-glibc-sysmacros.patch + "${FILESDIR}"/${P}-glibc-2.36.patch + "${FILESDIR}"/${P}-has_rpmatch.patch +) + +src_prepare() { + use elibc_musl && append-ldflags -lrpmatch + default + eautoreconf +} + +src_configure() { + local myconf=( + --with-system-root-install=no + --localstatedir=/var + --without-rhgb-compat-link + --enable-documentation + --enable-systemd-integration + --with-systemdunitdir="$(systemd_get_systemunitdir)" + $(use_enable !static-libs shared) + $(use_enable static-libs static) + $(use_enable debug tracing) + $(use_enable drm) + $(use_enable gtk) + $(use_enable pango) + $(use_with udev) + ) + econf "${myconf[@]}" +} + +src_install() { + default + + insinto /usr/share/plymouth + newins "${DISTDIR}"/gentoo-logo.png bizcom.png + + if use split-usr ; then + # Install compatibility symlinks as some rdeps hardcode the paths + dosym ../usr/bin/plymouth /bin/plymouth + dosym ../usr/sbin/plymouth-set-default-theme /sbin/plymouth-set-default-theme + dosym ../usr/sbin/plymouthd /sbin/plymouthd + fi + + readme.gentoo_create_doc + + # directories needed to keep runtime state + # https://bugs.gentoo.org/925430 + keepdir /var/spool/plymouth /var/lib/plymouth + # looks like make install create /var/run/plymouth + # this is not needed for systemd, same should hold for openrc + # so remove + rm -rf "${D}"/var/run + # https://bugs.gentoo.org/839081 + find "${D}" -name '*.la' -delete || die + + # fix broken symlink + dosym ../../bizcom.png /usr/share/plymouth/themes/spinfinity/header-image.png +} + +pkg_postinst() { + readme.gentoo_print_elog + if ! has_version "sys-kernel/dracut"; then + ewarn "If you want initramfs builder with plymouth support, please emerge" + ewarn "sys-kernel/dracut." + fi +} diff --git a/sys-boot/plymouth/plymouth-24.004.60-r1.ebuild b/sys-boot/plymouth/plymouth-24.004.60-r1.ebuild new file mode 100644 index 000000000000..150a488e7499 --- /dev/null +++ b/sys-boot/plymouth/plymouth-24.004.60-r1.ebuild @@ -0,0 +1,124 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit meson readme.gentoo-r1 flag-o-matic + +DESCRIPTION="Graphical boot animation (splash) and logger" +HOMEPAGE="https://gitlab.freedesktop.org/plymouth/plymouth" +SRC_URI="https://dev.gentoo.org/~aidecoe/distfiles/${CATEGORY}/${PN}/gentoo-logo.png" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.freedesktop.org/plymouth/plymouth" +else + SRC_URI+=" https://www.freedesktop.org/software/plymouth/releases/${P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +LICENSE="GPL-2+" +SLOT="0" +IUSE="debug +drm +gtk +pango selinux freetype +split-usr +udev doc systemd" + +BDEPEND=" + virtual/pkgconfig + doc? ( + app-text/docbook-xsl-stylesheets + dev-libs/libxslt + ) +" + +COMMON_DEPEND=" + dev-libs/libevdev + >=media-libs/libpng-1.2.16:= + x11-libs/libxkbcommon + x11-misc/xkeyboard-config + drm? ( x11-libs/libdrm ) + freetype? ( media-libs/freetype:2 ) + gtk? ( + dev-libs/glib:2 + x11-libs/cairo + >=x11-libs/gtk+-3.14:3[X] + ) + pango? ( + x11-libs/cairo + >=x11-libs/pango-1.21[X] + ) + systemd? ( sys-apps/systemd ) + udev? ( virtual/libudev ) +" + +DEPEND="${COMMON_DEPEND} + elibc_musl? ( sys-libs/rpmatch-standalone ) + pango? ( x11-base/xorg-proto ) +" + +RDEPEND="${COMMON_DEPEND} + selinux? ( sec-policy/selinux-plymouthd ) + udev? ( virtual/udev ) +" + +DOC_CONTENTS=" + Follow the following instructions to set up Plymouth:\n + https://wiki.gentoo.org/wiki/Plymouth#Configuration +" + +src_prepare() { + use elibc_musl && append-ldflags -lrpmatch + default +} + +src_configure() { + local emesonargs=( + --localstatedir "${EPREFIX}"/var + $(meson_feature gtk) + $(meson_feature freetype) + $(meson_feature pango) + $(meson_feature udev) + $(meson_use drm) + $(meson_use systemd systemd-integration) + $(meson_use doc docs) + $(meson_use debug tracing) + ) + meson_src_configure +} + +src_install() { + meson_src_install + insinto /usr/share/plymouth + + newins "${DISTDIR}"/gentoo-logo.png bizcom.png + # fix broken symlink + dosym ../../bizcom.png /usr/share/plymouth/themes/spinfinity/header-image.png + + if use split-usr; then + # Install compatibility symlinks as some rdeps hardcode the paths + dosym ../usr/bin/plymouth /bin/plymouth + dosym ../usr/sbin/plymouth-set-default-theme /sbin/plymouth-set-default-theme + dosym ../usr/sbin/plymouthd /sbin/plymouthd + fi + + # the file /var/spool/plymouth/boot.log is linked to the boot log after + # booting when there are errors, there is no runtime check to create this + # directory (the file is directly linked using unistd `link`) meaning there + # may be missing logs or unexpected behaviour if it is not kept. + keepdir /var/spool/plymouth + # /var/lib/plymouth is created at runtime, and is used to store boot/shutdown + # durations, it doesn't need to be created at build. + rm -r "${ED}"/var/lib || die + # /run/plymouth is also created at runtime + rm -r "${ED}"/run || die + + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog + if ! has_version "sys-kernel/dracut"; then + ewarn "dracut is not installed, if you wish to have an initramfs with" + ewarn "plymouth support, you can emerge 'sys-kernel/dracut' otherwise" + ewarn "you can look at the plymouth wiki for other methods:" + ewarn "https://wiki.gentoo.org/wiki/Plymouth#Building_Initramfs" + fi +} diff --git a/sys-boot/plymouth/plymouth-9999.ebuild b/sys-boot/plymouth/plymouth-9999.ebuild new file mode 100644 index 000000000000..c7b0a4754e53 --- /dev/null +++ b/sys-boot/plymouth/plymouth-9999.ebuild @@ -0,0 +1,124 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit meson readme.gentoo-r1 flag-o-matic + +DESCRIPTION="Graphical boot animation (splash) and logger" +HOMEPAGE="https://gitlab.freedesktop.org/plymouth/plymouth" +SRC_URI="https://dev.gentoo.org/~aidecoe/distfiles/${CATEGORY}/${PN}/gentoo-logo.png" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.freedesktop.org/plymouth/plymouth" +else + SRC_URI+=" https://www.freedesktop.org/software/plymouth/releases/${P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +LICENSE="GPL-2+" +SLOT="0" +IUSE="debug +drm +gtk +pango selinux freetype +split-usr +udev doc systemd" + +BDEPEND=" + virtual/pkgconfig + doc? ( + app-text/docbook-xsl-stylesheets + dev-libs/libxslt + ) +" + +COMMON_DEPEND=" + dev-libs/libevdev + >=media-libs/libpng-1.2.16:= + x11-libs/libxkbcommon + x11-misc/xkeyboard-config + drm? ( x11-libs/libdrm ) + freetype? ( media-libs/freetype:2 ) + gtk? ( + dev-libs/glib:2 + x11-libs/cairo + >=x11-libs/gtk+-3.14:3[X] + ) + pango? ( + x11-libs/cairo + >=x11-libs/pango-1.21[X] + ) + systemd? ( sys-apps/systemd ) + udev? ( virtual/libudev ) +" + +DEPEND="${COMMON_DEPEND} + elibc_musl? ( sys-libs/rpmatch-standalone ) + pango? ( x11-base/xorg-proto ) +" + +RDEPEND="${COMMON_DEPEND} + selinux? ( sec-policy/selinux-plymouthd ) + udev? ( virtual/udev ) +" + +DOC_CONTENTS=" + Follow the following instructions to set up Plymouth:\n + https://wiki.gentoo.org/wiki/Plymouth#Configuration +" + +src_prepare() { + use elibc_musl && append-ldflags -lrpmatch + default +} + +src_configure() { + local emesonargs=( + --localstatedir "${EPREFIX}"/var + $(meson_feature gtk) + $(meson_feature freetype) + $(meson_feature pango) + $(meson_feature udev) + $(meson_use drm) + $(meson_use systemd systemd-integration) + $(meson_use doc docs) + $(meson_use debug tracing) + ) + meson_src_configure +} + +src_install() { + meson_src_install + insinto /usr/share/plymouth + + newins "${DISTDIR}"/gentoo-logo.png bizcom.png + # fix broken symlink + dosym ../../bizcom.png /usr/share/plymouth/themes/spinfinity/header-image.png + + if use split-usr; then + # Install compatibility symlinks as some rdeps hardcode the paths + dosym ../usr/bin/plymouth /bin/plymouth + dosym ../usr/sbin/plymouth-set-default-theme /sbin/plymouth-set-default-theme + dosym ../usr/sbin/plymouthd /sbin/plymouthd + fi + + # the file /var/spool/plymouth/boot.log is linked to the boot log after + # booting when there are errors, there is no runtime check to create this + # directory (the file is directly linked using unistd `link`) meaning there + # may be missing logs or unexpected behaviour if it is not kept. + keepdir /var/spool/plymouth + # /var/lib/plymouth is created at runtime, and is used to store boot/shutdown + # durations, it doesn't need to be created at build. + rm -r "${ED}"/var/lib || die + # /run/plymouth is also created at runtime + rm -r "${ED}"/run || die + + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog + if ! has_version "sys-kernel/dracut"; then + ewarn "dracut is not installed, if you wish to have an initramfs with" + ewarn "plymouth support, you can emerge 'sys-kernel/dracut' otherwise" + ewarn "you can look at the plymouth wiki for other methods:" + ewarn "https://wiki.gentoo.org/wiki/Plymouth#Building_Initramfs" + fi +} diff --git a/sys-boot/raspberrypi-firmware/Manifest b/sys-boot/raspberrypi-firmware/Manifest new file mode 100644 index 000000000000..d704ca830e48 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/Manifest @@ -0,0 +1,6 @@ +DIST raspberrypi-firmware-1.20230106.tar.gz 185087907 BLAKE2B 656cc8325aa96d11f44419e871141beba95172b5c0c96e4b0a4cccca51127040328dc9f6c70cbba0248f8404ce0cf390e4bf937db7e0506c286db5adc4e56eef SHA512 41492a90da91d29e1025deeaad452c6b485f5412ff375b2fc144c2630afcdfef99ecbf701ca5e1afc5bb41bd6f2413b239257f1734dfe17084210e96b28eda7a +DIST raspberrypi-firmware-1.20240902.tar.gz 154483648 BLAKE2B e3d9fabb23246d90948004dde37f2125779a86aa62737b51b03cacea13d1ca715724587b0da106efba19c80a1bafcf1537101ce13ba4374602ca9e4957c81f87 SHA512 b5b1a74e1e9f9760fd19f98a35505b2e127e212c17afbdf08e1b92198f32de73655fb24c16d662318ccf50621ae5e1a6ed5aa877d2d1cc654d26b8ff168c1e82 +DIST raspberrypi-firmware-1.20250915.tar.gz 163876502 BLAKE2B 2d994334f358043a9a7cd1a92f6a411bd8671043956ab6df5d200387522d7e8ddedf5b3ffaf25b2a482a6e7675029a6ccb40a64c43e3c65a8ef2770b465ebc03 SHA512 33120c901c59fbcd267427dce5fd8f174d32476bfae76744697f6729151d66054c6f0bd54f29c3b715c1492a52724fe2973a6adbf31cfb79f1c82dd94983cf77 +DIST raspberrypi-firmware-1.20260408.tar.gz 199845922 BLAKE2B 2d75fafd594157248e1f5f3e58e7647ca950870df63c0a37be06c5190e67c71378176f70d51df796c2b3c8502c24e57649f792c4c416a9f2c42833fd004f3c96 SHA512 e353f9fe0d23874d5e7d72fca041358a9c9046e9fd071be604c0a840dbc95711ba7b7af39e78159e2e821d2af088ef28a22cb9ccaae70e0d2bd82b7ba2730402 +DIST raspberrypi-firmware-1.20260513.tar.gz 179722290 BLAKE2B e8389e546e167ea723a79eb2cf1a2290a2d9f3e58358337d16190f05f308a597dcd3fff6fa80d976f0971c0a1863e6b672dae373dc996bc052af47eb84a8030b SHA512 7c5418bb89398357731ecea31864b9e721e036b4dff1b8e8ffea4663d477f00e034bd566596fd0edbfa50cc6416fee71dd7eb1fcbdeffe12e272fe1475749984 +DIST raspberrypi-firmware-1.20260521.tar.gz 179761067 BLAKE2B d64b2a252def19d8d4d47a51e532cbec6c1a3544a9ce07e91963111ad71823ccf4a8a40b18d5556ca34ba616b50a84ea79f8d042518834e4ec73d83916730ab5 SHA512 92e9680a521cfb3b7824ed5a50026414ace49765b568b66cd919eb973a46ecf13743fe2e11145a7d28036591705b36198c3cc2765a132f32caf2fe22206c3818 diff --git a/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-0_p20130711-envd b/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-0_p20130711-envd new file mode 100644 index 000000000000..22ed09320464 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-0_p20130711-envd @@ -0,0 +1,2 @@ +CONFIG_PROTECT="/boot/config.txt /boot/cmdline.txt" + diff --git a/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-1.20201022-cmdline.txt b/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-1.20201022-cmdline.txt new file mode 100644 index 000000000000..b815bd89db1f --- /dev/null +++ b/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-1.20201022-cmdline.txt @@ -0,0 +1 @@ +console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait diff --git a/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-1.20201022-config.txt b/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-1.20201022-config.txt new file mode 100644 index 000000000000..548f4accc250 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/files/raspberrypi-firmware-1.20201022-config.txt @@ -0,0 +1,65 @@ +# For more options and information see +# http://rpf.io/configtxt +# Some settings may impact device functionality. See link above for details + +# uncomment if you get no picture on HDMI for a default "safe" mode +#hdmi_safe=1 + +# uncomment this if your display has a black border of unused pixels visible +# and your display can output without overscan +#disable_overscan=1 + +# uncomment the following to adjust overscan. Use positive numbers if console +# goes off screen, and negative if there is too much border +#overscan_left=16 +#overscan_right=16 +#overscan_top=16 +#overscan_bottom=16 + +# uncomment to force a console size. By default it will be display's size minus +# overscan. +#framebuffer_width=1280 +#framebuffer_height=720 + +# uncomment if hdmi display is not detected and composite is being output +#hdmi_force_hotplug=1 + +# uncomment to force a specific HDMI mode (this will force VGA) +#hdmi_group=1 +#hdmi_mode=1 + +# uncomment to force a HDMI mode rather than DVI. This can make audio work in +# DMT (computer monitor) modes +#hdmi_drive=2 + +# uncomment to increase signal to HDMI, if you have interference, blanking, or +# no display +#config_hdmi_boost=4 + +# uncomment for composite PAL +#sdtv_mode=2 + +#uncomment to overclock the arm. 700 MHz is the default. +#arm_freq=800 + +# Uncomment some or all of these to enable the optional hardware interfaces +#dtparam=i2c_arm=on +#dtparam=i2s=on +#dtparam=spi=on + +# Uncomment this to enable infrared communication. +#dtoverlay=gpio-ir,gpio_pin=17 +#dtoverlay=gpio-ir-tx,gpio_pin=18 + +# Additional overlays and parameters are documented /boot/overlays/README + +# Enable audio (loads snd_bcm2835) +dtparam=audio=on + +[pi4] +# Enable DRM VC4 V3D driver on top of the dispmanx display stack +dtoverlay=vc4-fkms-v3d +max_framebuffers=2 + +[all] +#dtoverlay=vc4-fkms-v3d diff --git a/sys-boot/raspberrypi-firmware/metadata.xml b/sys-boot/raspberrypi-firmware/metadata.xml new file mode 100644 index 000000000000..3f1e75b0c66a --- /dev/null +++ b/sys-boot/raspberrypi-firmware/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>ceamac@gentoo.org</email> + <name>Viorel Munteanu</name> + </maintainer> + <upstream> + <bugs-to>https://github.com/raspberrypi/firmware/issues</bugs-to> + <remote-id type="github">raspberrypi/firmware</remote-id> + <remote-id type="cpe">cpe:/o:raspberrypi:raspberry_pi_4_model_b_firmware</remote-id> + <remote-id type="cpe">cpe:/o:raspberrypi:raspberry_pi_3_model_b%2b_firmware</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20230106.ebuild b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20230106.ebuild new file mode 100644 index 000000000000..971ae8f47790 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20230106.ebuild @@ -0,0 +1,72 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot readme.gentoo-r1 + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/raspberrypi/firmware" + EGIT_CLONE_TYPE="shallow" +else + SRC_URI="https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* arm arm64" + S="${WORKDIR}/firmware-${PV}" +fi + +DESCRIPTION="Raspberry Pi (all versions) bootloader and GPU firmware" +HOMEPAGE="https://github.com/raspberrypi/firmware" + +LICENSE="GPL-2 raspberrypi-videocore-bin" +SLOT="0" +RESTRICT="binchecks strip" + +DOC_CONTENTS="Please configure your ram setup by editing /boot/config.txt" + +src_prepare() { + default + + cp "${FILESDIR}"/${PN}-1.20201022-config.txt "${WORKDIR}" || die + + if use arm64; then + # Force selection of the 64-bit kernel8.img to match our userland + echo "arm_64bit=1" >> "${WORKDIR}"/${PN}-1.20201022-config.txt || die + fi +} + +src_install() { + insinto /boot + cd boot || die + doins bootcode.bin fixup*.dat start*elf + newins "${WORKDIR}"/${PN}-1.20201022-config.txt config.txt + newins "${FILESDIR}"/${PN}-1.20201022-cmdline.txt cmdline.txt + newenvd "${FILESDIR}"/${PN}-0_p20130711-envd 90${PN} + readme.gentoo_create_doc +} + +pkg_preinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + local msg="" + + if [[ -e "${ED}"/boot/cmdline.txt ]] && [[ -e "${ROOT}"/boot/cmdline.txt ]] ; then + msg+="/boot/cmdline.txt " + fi + + if [[ -e "${ED}"/boot/config.txt ]] && [[ -e "${ROOT}"/boot/config.txt ]] ; then + msg+="/boot/config.txt " + fi + + if [[ -n "${msg}" ]] ; then + msg="This package installs following files: ${msg}." + msg="${msg} Please remove (backup) your copies during install" + msg="${msg} and merge settings afterwards." + msg="${msg} Further updates will be CONFIG_PROTECTed." + die "${msg}" + fi + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20240902.ebuild b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20240902.ebuild new file mode 100644 index 000000000000..2f971cf0ce91 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20240902.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot readme.gentoo-r1 + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/raspberrypi/firmware" + EGIT_CLONE_TYPE="shallow" +else + SRC_URI="https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* arm arm64" + S="${WORKDIR}/firmware-${PV}" +fi + +DESCRIPTION="Raspberry Pi (all versions) bootloader and GPU firmware" +HOMEPAGE="https://github.com/raspberrypi/firmware" + +LICENSE="GPL-2 raspberrypi-videocore-bin" +SLOT="0" +RESTRICT="strip" +QA_PREBUILT="*" + +DOC_CONTENTS="Please configure your ram setup by editing /boot/config.txt" + +src_prepare() { + default + + cp "${FILESDIR}"/${PN}-1.20201022-config.txt "${WORKDIR}" || die + + if use arm64; then + # Force selection of the 64-bit kernel8.img to match our userland + echo "arm_64bit=1" >> "${WORKDIR}"/${PN}-1.20201022-config.txt || die + fi +} + +src_install() { + insinto /boot + cd boot || die + doins bootcode.bin fixup*.dat start*elf + newins "${WORKDIR}"/${PN}-1.20201022-config.txt config.txt + newins "${FILESDIR}"/${PN}-1.20201022-cmdline.txt cmdline.txt + newenvd "${FILESDIR}"/${PN}-0_p20130711-envd 90${PN} + readme.gentoo_create_doc +} + +pkg_preinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + local msg="" + + if [[ -e "${ED}"/boot/cmdline.txt ]] && [[ -e "${ROOT}"/boot/cmdline.txt ]] ; then + msg+="/boot/cmdline.txt " + fi + + if [[ -e "${ED}"/boot/config.txt ]] && [[ -e "${ROOT}"/boot/config.txt ]] ; then + msg+="/boot/config.txt " + fi + + if [[ -n "${msg}" ]] ; then + msg="This package installs following files: ${msg}." + msg="${msg} Please remove (backup) your copies during install" + msg="${msg} and merge settings afterwards." + msg="${msg} Further updates will be CONFIG_PROTECTed." + die "${msg}" + fi + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20250915.ebuild b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20250915.ebuild new file mode 100644 index 000000000000..be00b286015f --- /dev/null +++ b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20250915.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot readme.gentoo-r1 + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/raspberrypi/firmware" + EGIT_CLONE_TYPE="shallow" +else + SRC_URI="https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* arm arm64" + S="${WORKDIR}/firmware-${PV}" +fi + +DESCRIPTION="Raspberry Pi (all versions) bootloader and GPU firmware" +HOMEPAGE="https://github.com/raspberrypi/firmware" + +LICENSE="raspberrypi-videocore-bin" +SLOT="0" +RESTRICT="strip" +QA_PREBUILT="*" + +DOC_CONTENTS="Please configure your ram setup by editing /boot/config.txt" + +src_prepare() { + default + + cp "${FILESDIR}"/${PN}-1.20201022-config.txt "${WORKDIR}" || die + + if use arm64; then + # Force selection of the 64-bit kernel8.img to match our userland + echo "arm_64bit=1" >> "${WORKDIR}"/${PN}-1.20201022-config.txt || die + fi +} + +src_install() { + insinto /boot + cd boot || die + doins bootcode.bin fixup*.dat start*elf + newins "${WORKDIR}"/${PN}-1.20201022-config.txt config.txt + newins "${FILESDIR}"/${PN}-1.20201022-cmdline.txt cmdline.txt + newenvd "${FILESDIR}"/${PN}-0_p20130711-envd 90${PN} + readme.gentoo_create_doc +} + +pkg_preinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + local msg="" + + if [[ -e "${ED}"/boot/cmdline.txt ]] && [[ -e "${ROOT}"/boot/cmdline.txt ]] ; then + msg+="/boot/cmdline.txt " + fi + + if [[ -e "${ED}"/boot/config.txt ]] && [[ -e "${ROOT}"/boot/config.txt ]] ; then + msg+="/boot/config.txt " + fi + + if [[ -n "${msg}" ]] ; then + msg="This package installs following files: ${msg}." + msg="${msg} Please remove (backup) your copies during install" + msg="${msg} and merge settings afterwards." + msg="${msg} Further updates will be CONFIG_PROTECTed." + die "${msg}" + fi + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260408.ebuild b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260408.ebuild new file mode 100644 index 000000000000..be00b286015f --- /dev/null +++ b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260408.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot readme.gentoo-r1 + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/raspberrypi/firmware" + EGIT_CLONE_TYPE="shallow" +else + SRC_URI="https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* arm arm64" + S="${WORKDIR}/firmware-${PV}" +fi + +DESCRIPTION="Raspberry Pi (all versions) bootloader and GPU firmware" +HOMEPAGE="https://github.com/raspberrypi/firmware" + +LICENSE="raspberrypi-videocore-bin" +SLOT="0" +RESTRICT="strip" +QA_PREBUILT="*" + +DOC_CONTENTS="Please configure your ram setup by editing /boot/config.txt" + +src_prepare() { + default + + cp "${FILESDIR}"/${PN}-1.20201022-config.txt "${WORKDIR}" || die + + if use arm64; then + # Force selection of the 64-bit kernel8.img to match our userland + echo "arm_64bit=1" >> "${WORKDIR}"/${PN}-1.20201022-config.txt || die + fi +} + +src_install() { + insinto /boot + cd boot || die + doins bootcode.bin fixup*.dat start*elf + newins "${WORKDIR}"/${PN}-1.20201022-config.txt config.txt + newins "${FILESDIR}"/${PN}-1.20201022-cmdline.txt cmdline.txt + newenvd "${FILESDIR}"/${PN}-0_p20130711-envd 90${PN} + readme.gentoo_create_doc +} + +pkg_preinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + local msg="" + + if [[ -e "${ED}"/boot/cmdline.txt ]] && [[ -e "${ROOT}"/boot/cmdline.txt ]] ; then + msg+="/boot/cmdline.txt " + fi + + if [[ -e "${ED}"/boot/config.txt ]] && [[ -e "${ROOT}"/boot/config.txt ]] ; then + msg+="/boot/config.txt " + fi + + if [[ -n "${msg}" ]] ; then + msg="This package installs following files: ${msg}." + msg="${msg} Please remove (backup) your copies during install" + msg="${msg} and merge settings afterwards." + msg="${msg} Further updates will be CONFIG_PROTECTed." + die "${msg}" + fi + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260513.ebuild b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260513.ebuild new file mode 100644 index 000000000000..dc3a4e72b3b9 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260513.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot readme.gentoo-r1 + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/raspberrypi/firmware" + EGIT_CLONE_TYPE="shallow" +else + SRC_URI="https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* ~arm ~arm64" + S="${WORKDIR}/firmware-${PV}" +fi + +DESCRIPTION="Raspberry Pi (all versions) bootloader and GPU firmware" +HOMEPAGE="https://github.com/raspberrypi/firmware" + +LICENSE="raspberrypi-videocore-bin" +SLOT="0" +RESTRICT="strip" +QA_PREBUILT="*" + +DOC_CONTENTS="Please configure your ram setup by editing /boot/config.txt" + +src_prepare() { + default + + cp "${FILESDIR}"/${PN}-1.20201022-config.txt "${WORKDIR}" || die + + if use arm64; then + # Force selection of the 64-bit kernel8.img to match our userland + echo "arm_64bit=1" >> "${WORKDIR}"/${PN}-1.20201022-config.txt || die + fi +} + +src_install() { + insinto /boot + cd boot || die + doins bootcode.bin fixup*.dat start*elf + newins "${WORKDIR}"/${PN}-1.20201022-config.txt config.txt + newins "${FILESDIR}"/${PN}-1.20201022-cmdline.txt cmdline.txt + newenvd "${FILESDIR}"/${PN}-0_p20130711-envd 90${PN} + readme.gentoo_create_doc +} + +pkg_preinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + local msg="" + + if [[ -e "${ED}"/boot/cmdline.txt ]] && [[ -e "${ROOT}"/boot/cmdline.txt ]] ; then + msg+="/boot/cmdline.txt " + fi + + if [[ -e "${ED}"/boot/config.txt ]] && [[ -e "${ROOT}"/boot/config.txt ]] ; then + msg+="/boot/config.txt " + fi + + if [[ -n "${msg}" ]] ; then + msg="This package installs following files: ${msg}." + msg="${msg} Please remove (backup) your copies during install" + msg="${msg} and merge settings afterwards." + msg="${msg} Further updates will be CONFIG_PROTECTed." + die "${msg}" + fi + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260521.ebuild b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260521.ebuild new file mode 100644 index 000000000000..dc3a4e72b3b9 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-1.20260521.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot readme.gentoo-r1 + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/raspberrypi/firmware" + EGIT_CLONE_TYPE="shallow" +else + SRC_URI="https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* ~arm ~arm64" + S="${WORKDIR}/firmware-${PV}" +fi + +DESCRIPTION="Raspberry Pi (all versions) bootloader and GPU firmware" +HOMEPAGE="https://github.com/raspberrypi/firmware" + +LICENSE="raspberrypi-videocore-bin" +SLOT="0" +RESTRICT="strip" +QA_PREBUILT="*" + +DOC_CONTENTS="Please configure your ram setup by editing /boot/config.txt" + +src_prepare() { + default + + cp "${FILESDIR}"/${PN}-1.20201022-config.txt "${WORKDIR}" || die + + if use arm64; then + # Force selection of the 64-bit kernel8.img to match our userland + echo "arm_64bit=1" >> "${WORKDIR}"/${PN}-1.20201022-config.txt || die + fi +} + +src_install() { + insinto /boot + cd boot || die + doins bootcode.bin fixup*.dat start*elf + newins "${WORKDIR}"/${PN}-1.20201022-config.txt config.txt + newins "${FILESDIR}"/${PN}-1.20201022-cmdline.txt cmdline.txt + newenvd "${FILESDIR}"/${PN}-0_p20130711-envd 90${PN} + readme.gentoo_create_doc +} + +pkg_preinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + local msg="" + + if [[ -e "${ED}"/boot/cmdline.txt ]] && [[ -e "${ROOT}"/boot/cmdline.txt ]] ; then + msg+="/boot/cmdline.txt " + fi + + if [[ -e "${ED}"/boot/config.txt ]] && [[ -e "${ROOT}"/boot/config.txt ]] ; then + msg+="/boot/config.txt " + fi + + if [[ -n "${msg}" ]] ; then + msg="This package installs following files: ${msg}." + msg="${msg} Please remove (backup) your copies during install" + msg="${msg} and merge settings afterwards." + msg="${msg} Further updates will be CONFIG_PROTECTed." + die "${msg}" + fi + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/raspberrypi-firmware/raspberrypi-firmware-9999.ebuild b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-9999.ebuild new file mode 100644 index 000000000000..dc3a4e72b3b9 --- /dev/null +++ b/sys-boot/raspberrypi-firmware/raspberrypi-firmware-9999.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot readme.gentoo-r1 + +if [[ "${PV}" == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/raspberrypi/firmware" + EGIT_CLONE_TYPE="shallow" +else + SRC_URI="https://github.com/raspberrypi/firmware/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="-* ~arm ~arm64" + S="${WORKDIR}/firmware-${PV}" +fi + +DESCRIPTION="Raspberry Pi (all versions) bootloader and GPU firmware" +HOMEPAGE="https://github.com/raspberrypi/firmware" + +LICENSE="raspberrypi-videocore-bin" +SLOT="0" +RESTRICT="strip" +QA_PREBUILT="*" + +DOC_CONTENTS="Please configure your ram setup by editing /boot/config.txt" + +src_prepare() { + default + + cp "${FILESDIR}"/${PN}-1.20201022-config.txt "${WORKDIR}" || die + + if use arm64; then + # Force selection of the 64-bit kernel8.img to match our userland + echo "arm_64bit=1" >> "${WORKDIR}"/${PN}-1.20201022-config.txt || die + fi +} + +src_install() { + insinto /boot + cd boot || die + doins bootcode.bin fixup*.dat start*elf + newins "${WORKDIR}"/${PN}-1.20201022-config.txt config.txt + newins "${FILESDIR}"/${PN}-1.20201022-cmdline.txt cmdline.txt + newenvd "${FILESDIR}"/${PN}-0_p20130711-envd 90${PN} + readme.gentoo_create_doc +} + +pkg_preinst() { + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + local msg="" + + if [[ -e "${ED}"/boot/cmdline.txt ]] && [[ -e "${ROOT}"/boot/cmdline.txt ]] ; then + msg+="/boot/cmdline.txt " + fi + + if [[ -e "${ED}"/boot/config.txt ]] && [[ -e "${ROOT}"/boot/config.txt ]] ; then + msg+="/boot/config.txt " + fi + + if [[ -n "${msg}" ]] ; then + msg="This package installs following files: ${msg}." + msg="${msg} Please remove (backup) your copies during install" + msg="${msg} and merge settings afterwards." + msg="${msg} Further updates will be CONFIG_PROTECTed." + die "${msg}" + fi + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} diff --git a/sys-boot/refind/Manifest b/sys-boot/refind/Manifest new file mode 100644 index 000000000000..24de821e79d0 --- /dev/null +++ b/sys-boot/refind/Manifest @@ -0,0 +1 @@ +DIST refind-src-0.14.2.tar.gz 4628173 BLAKE2B 987acb29d4d81c01db245cd8e1c9761072e34cf3dfaa3e4fa77e549ee2c1dc4c3f8cbd9218f42e4eb77478df3453095dba8b36324c289c6a10b81f1ecb202743 SHA512 76a52ed422ab3d431e6530fae4d13a51e8ed100568d4290207aaee87a84700b077bb79c4f4917027f5286de422954e1872fca288252ec756072d6c075b102e1e diff --git a/sys-boot/refind/files/refind-0.14.0.2-clang.patch b/sys-boot/refind/files/refind-0.14.0.2-clang.patch new file mode 100644 index 000000000000..fe2323390355 --- /dev/null +++ b/sys-boot/refind/files/refind-0.14.0.2-clang.patch @@ -0,0 +1,62 @@ +Fix compilation with clang. + +Clang does not support nested functions (a gcc extension), so move it outside. + +Compiling with _FORTIFY_SOURCE and -ffreestanding results in +nanojpeg.c:(.text+0xa28): undefined reference to `__memset_chk' + +See also: https://bugs.gentoo.org/881131 + +--- a/filesystems/crc32c.c ++++ b/filesystems/crc32c.c +@@ -22,25 +22,24 @@ + + static uint32_t crc32c_table [256]; + +-static void +-init_crc32c_table (void) ++uint32_t reflect (uint32_t ref, int len) + { +- auto uint32_t reflect (uint32_t ref, int len); +- uint32_t reflect (uint32_t ref, int len) +- { +- uint32_t result = 0; +- int i; ++ uint32_t result = 0; ++ int i; + +- for (i = 1; i <= len; i++) +- { +- if (ref & 1) +- result |= 1 << (len - i); +- ref >>= 1; +- } +- +- return result; ++ for (i = 1; i <= len; i++) ++ { ++ if (ref & 1) ++ result |= 1 << (len - i); ++ ref >>= 1; + } + ++ return result; ++} ++ ++static void ++init_crc32c_table (void) ++{ + static int crc32c_table_inited; + if(crc32c_table_inited) + return; +--- a/libeg/nanojpeg.c ++++ b/libeg/nanojpeg.c +@@ -112,6 +112,8 @@ + #ifndef _NANOJPEG_H + #define _NANOJPEG_H + ++#undef _FORTIFY_SOURCE ++ + // Modified: Map libc-style free() and malloc() to their EFI equivalents.... + #define free MyFreePool + #define malloc AllocatePool diff --git a/sys-boot/refind/files/refind-0.14.2-fix-binutils-2.46.patch b/sys-boot/refind/files/refind-0.14.2-fix-binutils-2.46.patch new file mode 100644 index 000000000000..78d4b97f3b7f --- /dev/null +++ b/sys-boot/refind/files/refind-0.14.2-fix-binutils-2.46.patch @@ -0,0 +1,17 @@ +https://bugs.gentoo.org/970041 + +In binutils 2.46, objcopy became more strict with what it accepts as target. + +--- a/Make.common ++++ b/Make.common +@@ -121,8 +121,8 @@ + # objcopy flags for GNU-EFI + # + +-FORMAT = --target=efi-app-$(ARCH) +-FORMAT_DRIVER = --target=efi-bsdrv-$(ARCH) ++FORMAT = --output-target=efi-app-$(ARCH) ++FORMAT_DRIVER = --output-target=efi-bsdrv-$(ARCH) + + # + # Modifications on a per-architecture basis.... diff --git a/sys-boot/refind/files/refind-0.14.2-fix-btrfs-on-musl.patch b/sys-boot/refind/files/refind-0.14.2-fix-btrfs-on-musl.patch new file mode 100644 index 000000000000..a1cd0a55ecbb --- /dev/null +++ b/sys-boot/refind/files/refind-0.14.2-fix-btrfs-on-musl.patch @@ -0,0 +1,26 @@ +https://bugs.gentoo.org/828953 + +From 88faaa7d7a9581d670cb581df933442cc75933b3 Mon Sep 17 00:00:00 2001 +From: "David C. Manuelda" <StormByte@gmail.com> +Date: Thu, 14 Nov 2024 17:05:03 +0100 +Subject: [PATCH] Added a missing header to make musl compile + +--- + filesystems/zstd/zstd_internal.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/filesystems/zstd/zstd_internal.h b/filesystems/zstd/zstd_internal.h +index f90ac42..4918300 100644 +--- a/filesystems/zstd/zstd_internal.h ++++ b/filesystems/zstd/zstd_internal.h +@@ -20,6 +20,7 @@ + /*-******************************************************* + * Compiler specifics + *********************************************************/ ++#include <linux/stddef.h> + #define FORCE_INLINE static __always_inline + #define FORCE_NOINLINE static /*noinline*/ + +-- +2.47.0 + diff --git a/sys-boot/refind/files/refind-0.14.2-fix-freestanding-on-musl.patch b/sys-boot/refind/files/refind-0.14.2-fix-freestanding-on-musl.patch new file mode 100644 index 000000000000..42f8d6b13a79 --- /dev/null +++ b/sys-boot/refind/files/refind-0.14.2-fix-freestanding-on-musl.patch @@ -0,0 +1,63 @@ +On amd64, musl typedefs wchar_t to int, conflicting with -fshort-wchar. +Also, /usr/include is searched before the compiler provided include directory. +As a workaround, use -nostdinc and switch them around. + +Add missing `#include <stddef.h>` where wchar_t was defined indirectly by +other standard includefiles. + +We need and extra -D for clang, where wchar_t is defined in +/usr/include/allbits.h and gets included by other headers, conflicting with +wchar_t already defined in stddef.h. + +See also: https://bugs.gentoo.org/938012 + https://bugs.gentoo.org/881131 + https://bugs.gentoo.org/832018 + +--- a/Make.common ++++ b/Make.common +@@ -79,7 +79,7 @@ + # + + # ...for both GNU-EFI and TianoCore.... +-OPTIMFLAGS = -Os -fno-strict-aliasing -fno-tree-loop-distribute-patterns ++OPTIMFLAGS = -Os -fno-strict-aliasing -ffreestanding -nostdinc -isystem $(CPPINCLUDEDIR) -isystem $(EPREFIX)/usr/include $(EXTRACFLAGS) + CFLAGS = $(OPTIMFLAGS) -fno-stack-protector -fshort-wchar -Wall + + # ...for GNU-EFI.... +@@ -168,7 +168,7 @@ + SUBSYSTEM_LDFLAG = -defsym=EFI_SUBSYSTEM=0xa + LDFLAGS += --warn-common --no-undefined --fatal-warnings + +- ARCH_CFLAGS = -fno-merge-constants -ffreestanding -DEFIAARCH64 ++ ARCH_CFLAGS = -fno-merge-constants -ffreestanding -DEFIAARCH64 -nostdinc -isystem $(CPPINCLUDEDIR) -isystem $(EPREFIX)/usr/include $(EXTRACFLAGS) + ifeq ($(MAKEWITH),TIANO) + ARCH_CFLAGS += -mcmodel=large -Wno-address -Wno-missing-braces -Wno-array-bounds -ffunction-sections -fdata-sections + endif +--- a/libeg/lodepng.h ++++ b/libeg/lodepng.h +@@ -32,6 +32,7 @@ + #ifndef LODEPNG_H + #define LODEPNG_H + ++#include <stddef.h> + #include <string.h> /*for size_t*/ + + // Below block of lines required for GNU-EFI and TianoCore (program hangs +--- a/libeg/nanojpeg.c ++++ b/libeg/nanojpeg.c +@@ -211,6 +211,7 @@ + + #ifdef _NJ_EXAMPLE_PROGRAM + ++#include <stddef.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> +@@ -275,6 +276,7 @@ + #endif + + #if NJ_USE_LIBC ++ #include <stddef.h> + #include <stdlib.h> + #include <string.h> + #define njAllocMem malloc diff --git a/sys-boot/refind/files/refind-0.14.2-fix-gnu-efi-3.0.18.patch b/sys-boot/refind/files/refind-0.14.2-fix-gnu-efi-3.0.18.patch new file mode 100644 index 000000000000..b5d9d2692883 --- /dev/null +++ b/sys-boot/refind/files/refind-0.14.2-fix-gnu-efi-3.0.18.patch @@ -0,0 +1,77 @@ +The same commit from gnu-efi that changed CopyMem in a way that broke refind also changed SetMem. +This patch attempts to fix it in the same way upstream fixed CopyMem. + +The commit: https://sourceforge.net/p/gnu-efi/code/ci/deb8a7f267d96299b9aa41300539f617db54c2a9/ +The bug: https://bugs.gentoo.org/934474 + +--- a/gptsync/gptsync.c ++++ b/gptsync/gptsync.c +@@ -164,7 +164,7 @@ static UINTN write_mbr(VOID) + } + if (!have_bootcode) { + // no boot code found in the MBR, add the syslinux MBR code +- SetMem(sector, MBR_BOOTCODE_SIZE, 0); ++ refit_call3_wrapper(gBS->SetMem, sector, MBR_BOOTCODE_SIZE, 0); + refit_call3_wrapper(gBS->CopyMem, sector, syslinux_mbr, SYSLINUX_MBR_SIZE); + } + +--- a/libeg/lodepng_xtra.c ++++ b/libeg/lodepng_xtra.c +@@ -87,7 +87,7 @@ int MyStrlen(const char *InString) { + } // int MyStrlen() + + VOID *MyMemSet(VOID *s, int c, size_t n) { +- SetMem(s, c, n); ++ MySetMem(s, c, n); + return s; + } + +--- a/refind/config.c ++++ b/refind/config.c +@@ -667,7 +667,7 @@ VOID ReadConfig(CHAR16 *FileName) + HandleStrings(TokenList, TokenCount, &(GlobalConfig.DriverDirs)); + + } else if (MyStriCmp(TokenList[0], L"showtools")) { +- SetMem(GlobalConfig.ShowTools, NUM_TOOLS * sizeof(UINTN), 0); ++ MySetMem(GlobalConfig.ShowTools, NUM_TOOLS * sizeof(UINTN), 0); + GlobalConfig.HiddenTags = FALSE; + for (i = 1; (i < TokenCount) && (i < NUM_TOOLS); i++) { + FlagName = TokenList[i]; +--- a/refind/launch_legacy.c ++++ b/refind/launch_legacy.c +@@ -114,7 +114,7 @@ static EFI_STATUS ActivateMbrPartition(IN EFI_BLOCK_IO *BlockIO, IN UINTN Partit + } + if (!HaveBootCode) { + // no boot code found in the MBR, add the syslinux MBR code +- SetMem(SectorBuffer, MBR_BOOTCODE_SIZE, 0); ++ MySetMem(SectorBuffer, MBR_BOOTCODE_SIZE, 0); + MyCopyMem(SectorBuffer, syslinux_mbr, SYSLINUX_MBR_SIZE); + } + +--- a/refind/lib.c ++++ b/refind/lib.c +@@ -651,7 +651,7 @@ static VOID SetFilesystemData(IN UINT8 *Buffer, IN UINTN BufferSize, IN OUT REFI + + LOG(2, LOG_LINE_NORMAL, L"Identifying filesystem types...."); + if ((Buffer != NULL) && (Volume != NULL)) { +- SetMem(&(Volume->VolUuid), sizeof(EFI_GUID), 0); ++ MySetMem(&(Volume->VolUuid), sizeof(EFI_GUID), 0); + Volume->FSType = FS_TYPE_UNKNOWN; + + if (BufferSize >= (1024 + 100)) { +--- a/refind/lib.h ++++ b/refind/lib.h +@@ -133,10 +133,13 @@ VOID MyFreePool(IN OUT VOID *Pointer); + + // When using GNU-EFI, call the EFI's built-in gBS->CopyMem() function, because + // GNU-EFI 3.0.18 changed its CopyMem() definition in a way that broke rEFInd. ++// Same for SetMem + #ifdef __MAKEWITH_GNUEFI + #define MyCopyMem(Dest, Src, len) refit_call3_wrapper(gBS->CopyMem, Dest, Src, len) ++#define MySetMem(Dest, Src, len) refit_call3_wrapper(gBS->SetMem, Dest, Src, len) + #else + #define MyCopyMem(Dest, Src, len) CopyMem(Dest, Src, len) ++#define MySetMem(Dest, Src, len) SetMem(Dest, Src, len) + #endif + + BOOLEAN EjectMedia(VOID); diff --git a/sys-boot/refind/files/refind-0.14.2-fix-shim-name.patch b/sys-boot/refind/files/refind-0.14.2-fix-shim-name.patch new file mode 100644 index 000000000000..54d45e2201d6 --- /dev/null +++ b/sys-boot/refind/files/refind-0.14.2-fix-shim-name.patch @@ -0,0 +1,25 @@ +Shim can have more names, shim 15.8 comes as BOOT*.EFI + +https://bugs.gentoo.org/968277 + +--- a/refind-install ++++ b/refind-install +@@ -385,7 +385,8 @@ + echo "ShimSource is $ShimSource" + if [[ "$ShimSource" != "none" ]] ; then + if [[ -f "$ShimSource" ]] ; then +- if [[ $ShimType == "shimx64.efi" || $ShimType == "shim.efi" || $ShimType == "shimx64.efi.signed" ]] ; then ++ if [[ $ShimType == "shimx64.efi" || $ShimType == "shim.efi" || $ShimType == "shimx64.efi.signed" || ++ $ShimType == "BOOTX64.EFI" || $ShimType == "BOOTIA32.EFI" ]] ; then + TargetX64="grubx64.efi" + TargetAARCH64="grubaa64.efi" + MokManagerSource=$(dirname "$ShimSource")/mm$Platform.efi.signed +@@ -400,7 +401,7 @@ + MokManagerSource=$(dirname "$ShimSource")/HashTool.efi + else + echo "Unknown shim/PreBootloader filename: $ShimType!" +- echo "Known filenames are shimx64.efi, shim.efi, and PreLoader.efi. Aborting!" ++ echo "Known filenames are shimx64.efi, shim.efi, BOOTX64.EFI, BOOTIA32.EFI, and PreLoader.efi. Aborting!" + exit 1 + fi + else diff --git a/sys-boot/refind/files/refind-sbat-gentoo-0.14.2.csv b/sys-boot/refind/files/refind-sbat-gentoo-0.14.2.csv new file mode 100644 index 000000000000..2b1814c82c87 --- /dev/null +++ b/sys-boot/refind/files/refind-sbat-gentoo-0.14.2.csv @@ -0,0 +1,3 @@ +sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md +refind,1,Roderick W. Smith,refind,0.14.2,https://www.rodsbooks.com/refind +refind.gentoo,1,Gentoo Linux,refind,0.14.2,https://packages.gentoo.org/packages/sys-boot/refind diff --git a/sys-boot/refind/metadata.xml b/sys-boot/refind/metadata.xml new file mode 100644 index 000000000000..7d82e5d26db3 --- /dev/null +++ b/sys-boot/refind/metadata.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>ceamac@gentoo.org</email> + <name>Viorel Munteanu</name> + </maintainer> + <maintainer type="person" proxied="yes"> + <email>sveyret@gmail.com</email> + <name>Stéphane Veyret</name> + </maintainer> + <maintainer type="project" proxied="proxy"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <longdescription lang="en"> +A graphical boot manager for EFI- and UEFI-based computers, such as all +Intel-based Macs and recent (most 2011 and later) PCs. rEFInd presents a +boot menu showing all the EFI boot loaders on the EFI-accessible +partitions, and optionally BIOS-bootable partitions on Macs and BIOS boot +entries on UEFI PCs with CSMs. EFI-compatbile OSes, including Linux, +provide boot loaders that rEFInd can detect and launch. rEFInd can launch +Linux EFI boot loaders such as ELILO, GRUB Legacy, GRUB 2, and 3.3.0 and +later kernels with EFI stub support. EFI filesystem drivers for ext2/3/4fs, +ReiserFS, Btrfs, NTFS, HFS+, and ISO-9660 enable rEFInd to read boot +loaders from these filesystems, too. rEFInd's ability to detect boot +loaders at runtime makes it very easy to use, particularly when paired with +Linux kernels that provide EFI stub support. + </longdescription> + <longdescription lang="fr"> +Un gestionnaire d'amorçage pour ordinateur EFI ou UEFI tel que tous les Macs +contenant un processeur Intel et les PC récents (2011 et après). rEFInd affiche +un menu d'amorçage montrant tous les gestionnaires d'amorçage sur les +partitions EFI accessibles et optionnellement les partitions amorçable en BIOS +sur Macs et les entrées BIOS sur les PC UEFI avec CSM. Les systèmes +d'exploitation compatibles EFI, incluant Linux, fournissent des gestionnaires +d'amorçage que rEFInd détecte et démarre. rEFInd peut démarrer les +gestionnaires d'amorçage EFI Linux tel que ELILO, GRUB Legacy, GRUB 2 ainsi que +les noyaux 3.3.0 et suivants avec le support EFI stub. Les pilotes EFI pour les +sytèmes de fichiers ext2/3/4fs, ReiserFS, Btrfs, NTFS, HFS+ et ISO-9660 +permettent à rEFInd de lire les gestionnaires d'amorçage également depuis ces +systèmes de fichiers. La capacité de rEFInd à détecter les gestionnaires +d'amorçage au moment de l'exécution le rend très facile à utiliser, en +particulier associé à des noyau Linux qui fournissent un support EFI stub. + </longdescription> + <use lang="en"> + <flag name="btrfs">Builds the EFI binary btrfs filesystem driver</flag> + <flag name="ext2">Builds the EFI binary ext2 filesystem driver</flag> + <flag name="ext4">Builds the EFI binary ext4 filesystem driver</flag> + <flag name="hfs">Builds the EFI binary hfs filesystem driver</flag> + <flag name="iso9660">Builds the EFI binary iso9660 filesystem driver</flag> + <flag name="ntfs">Builds the EFI binary ntfs filesystem driver</flag> + <flag name="reiserfs">Builds the EFI binary reiserfs filesystem driver</flag> + </use> + <use lang="fr"> + <flag name="btrfs">Construire le gestionnaire EFI pour le système de fichier btrfs</flag> + <flag name="ext2">Construire le gestionnaire EFI pour le système de fichier ext2</flag> + <flag name="ext4">Construire le gestionnaire EFI pour le système de fichier ext4</flag> + <flag name="hfs">Construire le gestionnaire EFI pour le système de fichier hfs</flag> + <flag name="iso9660">Construire le gestionnaire EFI pour le système de fichier iso9660</flag> + <flag name="ntfs">Construire le gestionnaire EFI pour le système de fichier ntfs</flag> + <flag name="reiserfs">Construire le gestionnaire EFI pour le système de fichier reiserfs</flag> + </use> + <upstream> + <remote-id type="sourceforge">refind</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/refind/refind-0.14.2-r4.ebuild b/sys-boot/refind/refind-0.14.2-r4.ebuild new file mode 100644 index 000000000000..987d5575ea29 --- /dev/null +++ b/sys-boot/refind/refind-0.14.2-r4.ebuild @@ -0,0 +1,171 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit eapi9-ver optfeature secureboot toolchain-funcs + +DESCRIPTION="The UEFI Boot Manager by Rod Smith" +HOMEPAGE="https://www.rodsbooks.com/refind/" +SRC_URI="https://downloads.sourceforge.net/project/${PN}/${PV}/${PN}-src-${PV}.tar.gz" + +LICENSE="BSD CC-BY-SA-3.0 CC-BY-SA-4.0 FDL-1.3 GPL-2+ GPL-3+ LGPL-3+" +SLOT="0" +KEYWORDS="amd64 x86" +FS_USE="btrfs +ext2 +ext4 hfs +iso9660 ntfs reiserfs" +IUSE="${FS_USE} doc" + +DEPEND="<sys-boot/gnu-efi-4.0.0" + +# for ld.bfd and objcopy +BDEPEND="sys-devel/binutils" + +DOCS=( README.txt NEWS.txt ) + +PATCHES=( + "${FILESDIR}"/${PN}-0.14.0.2-clang.patch + "${FILESDIR}"/${P}-fix-gnu-efi-3.0.18.patch + "${FILESDIR}"/${P}-fix-freestanding-on-musl.patch + "${FILESDIR}"/${P}-fix-btrfs-on-musl.patch + "${FILESDIR}"/${P}-fix-shim-name.patch + "${FILESDIR}"/${P}-fix-binutils-2.46.patch +) + +checktools() { + if [[ ${MERGE_TYPE} != "binary" ]]; then + # bug #832018 + tc-export LD + tc-ld-force-bfd + # the makefile calls LD directly, so try to fix LD too + LD="${LD/.lld/.bfd}" + tc-ld-is-lld "${LD}" && die "Linking with lld produces broken executables and may lead to unbootable system" + + # bug #732256 + # llvm-objcopy does not support EFI target, try to use binutils objcopy or fail + tc-export OBJCOPY + OBJCOPY="${OBJCOPY/llvm-/}" + LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' || die "${OBJCOPY} (objcopy) does not support EFI target" + + tc-is-gcc || tc-is-clang || die "Unsupported compiler" + fi +} + +pkg_setup() { + if use x86; then + export EFIARCH=ia32 + export BUILDARCH=ia32 + elif use amd64; then + export EFIARCH=x64 + export BUILDARCH=x86_64 + fi + secureboot_pkg_setup + + # this does not only check, but also exports LD and OBJCOPY + checktools +} + +src_prepare() { + default + + # bug #598647 - PIE not supported + sed -e '/^CFLAGS/s/$/ -fno-PIE/' -i Make.common || die + sed -e '1 i\.NOTPARALLEL:' -i filesystems/Makefile || die + + cp "${FILESDIR}"/refind-sbat-gentoo-${PV}.csv refind-sbat-gentoo.csv || die +} + +src_compile() { + # Update fs targets depending on uses + local fs fs_names=() + for fs in ${FS_USE}; do + fs=${fs#+} + if use "${fs}"; then + fs_names+=( ${fs} ) + fi + done + fs_names=( "${fs_names[@]/%/_gnuefi}" ) + + # Prepare flags + local make_flags=( + ARCH="${BUILDARCH}" + CC="$(tc-getCC)" + AS="$(tc-getAS)" + LD="${LD}" + AR="$(tc-getAR)" + RANLIB="$(tc-getRANLIB)" + OBJCOPY="${OBJCOPY}" + GNUEFILIB="${ESYSROOT}/usr/$(get_libdir)" + EFILIB="${ESYSROOT}/usr/$(get_libdir)" + EFICRT0="${ESYSROOT}/usr/$(get_libdir)" + FILESYSTEMS="${fs_names[*]}" + FILESYSTEMS_GNUEFI="${fs_names[*]}" + REFIND_SBAT_CSV=refind-sbat-gentoo.csv + ) + + # see the comments in "${FILESDIR}"/${P}-fix-freestanding-on-musl.patch + tc-export CC + if tc-is-gcc; then + local -x CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-search-dirs 2> /dev/null | grep ^install: | cut -f2 -d' ')/include + elif tc-is-clang; then + local -x CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-resource-dir 2> /dev/null)/include + local -x EXTRACFLAGS=-D__DEFINED_wchar_t + fi + + emake "${make_flags[@]}" all_gnuefi +} + +src_install() { + exeinto "/usr/$(get_libdir)/${PN}" + doexe refind-install + dosym -r "/usr/$(get_libdir)/${PN}/refind-install" "/usr/sbin/refind-install" + + doman "docs/man/"* + use doc && DOCS+=( docs/refind docs/Styles ) + einstalldocs + + insinto "/usr/$(get_libdir)/${PN}/refind" + doins "refind/refind_${EFIARCH}.efi" + doins "refind.conf-sample" + doins -r images icons fonts banners + + if [[ -d "drivers_${EFIARCH}" ]]; then + doins -r "drivers_${EFIARCH}" + fi + + insinto "/usr/$(get_libdir)/${PN}/refind/tools_${EFIARCH}" + doins "gptsync/gptsync_${EFIARCH}.efi" + + insinto "/etc/refind.d" + doins -r "keys" + + dosbin "mkrlconf" + dosbin "mvrefind" + dosbin "refind-mkdefault" + + secureboot_auto_sign --in-place +} + +pkg_postinst() { + elog "rEFInd has been built and installed into ${EROOT}/usr/$(get_libdir)/${PN}" + elog "You will need to use the command 'refind-install' to install" + elog "the binaries into your EFI System Partition" + + optfeature_header "refind-install requires additional packages to be fully functional:" + optfeature "binary signing for use with SecureBoot" app-crypt/sbsigntools + optfeature "writing to NVRAM" sys-boot/efibootmgr + optfeature "ESP management" sys-apps/gptfdisk + elog "" + + if [[ -z "${REPLACING_VERSIONS}" ]]; then + elog "A sample configuration can be found at" + elog "${EROOT}/usr/$(get_libdir)/${PN}/refind/refind.conf-sample" + else + if ver_replacing -lt "0.12.0"; then + ewarn "This new version uses sys-apps/gptfdisk instead of sys-block/parted" + ewarn "to manage ESP" + ewarn "" + fi + ewarn "Note that this installation will not update any EFI binaries" + ewarn "on your EFI System Partition - this needs to be done manually" + fi +} diff --git a/sys-boot/sgibootcd/Manifest b/sys-boot/sgibootcd/Manifest new file mode 100644 index 000000000000..1b7eb70f936c --- /dev/null +++ b/sys-boot/sgibootcd/Manifest @@ -0,0 +1 @@ +DIST sgibootcd-0.13.tar.xz 3736 BLAKE2B 793825c9ad88449b187ceab28d474e5676d45d3ea2c649dbbf669f00cf6dc9d55bc1e9900a4bf321a7dfddd8f5bc65e5e2fbc61fe913e7be43df9064118efcac SHA512 aa7780e360e0b5d4c9c0d6b5894897fa5f6ff13b1a389ba913f27cbdf8173db123e59426391d2a0e154f836277a780dc004617608adb88e7e6f3e8b6348729f9 diff --git a/sys-boot/sgibootcd/metadata.xml b/sys-boot/sgibootcd/metadata.xml new file mode 100644 index 000000000000..619dc7007bd4 --- /dev/null +++ b/sys-boot/sgibootcd/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>mips@gentoo.org</email> + <name>MIPS architecture team</name> + </maintainer> + + <longdescription> + sgibootcd is a small utility used to create the burnable, + non-ISO9660 image format for bootable CDs for SGI systems. + </longdescription> +</pkgmetadata> diff --git a/sys-boot/sgibootcd/sgibootcd-0.13.ebuild b/sys-boot/sgibootcd/sgibootcd-0.13.ebuild new file mode 100644 index 000000000000..2fc4abc1a48a --- /dev/null +++ b/sys-boot/sgibootcd/sgibootcd-0.13.ebuild @@ -0,0 +1,35 @@ +# Copyright 2005-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" +inherit toolchain-funcs + +DESCRIPTION="Creates burnable CD images for SGI LiveCDs" +HOMEPAGE="ftp://ftp.linux-mips.org/pub/linux/mips/people/skylark/" +SRC_URI="https://dev.gentoo.org/~kumba/distfiles/${P}.tar.xz" + +LICENSE="all-rights-reserved" +SLOT="0" +KEYWORDS="-* ~mips" + +# sgibootcd is a small utility used to build the image that is burned to a +# CD and used to boot SGI systems. Its compilation does not involve the +# external linker, 'ld', and thus this makes it difficult to reliably pass +# user LDFLAGS. See Bug #725836. +QA_FLAGS_IGNORED="/usr/bin/sgibootcd" + +src_compile() { + local mycc="$(tc-getCC) ${CFLAGS}" + + # There is no Makefile, so check for an existing binary + # and remove it if necessary + [[ -f "${S}/sgibootcd" ]] && rm -f "${S}"/sgibootcd + + # Compile sgibootcd.c to a standalone executable. + einfo "${mycc} sgibootcd.c -o sgibootcd" + ${mycc} sgibootcd.c -o sgibootcd +} + +src_install() { + dobin "${S}"/sgibootcd +} diff --git a/sys-boot/shim/Manifest b/sys-boot/shim/Manifest new file mode 100644 index 000000000000..9d09a84981c5 --- /dev/null +++ b/sys-boot/shim/Manifest @@ -0,0 +1,6 @@ +DIST shim-aa64-15.8-3.aarch64.rpm 466590 BLAKE2B ebd77148d363020d14b418dbb3107981b213b39914daa80765cc2db16c7b365eaebcbcba19b88459364967f2764f417aeffd34754aa92c2efc7aaa4e9d45b712 SHA512 d9b879706f7f6c7f7bfea92a443191811d39835074b3b6db3979c707b406b00884baff66ac79bf9bd66869240f668c6e6f987f8954a570d648933c85ea0da1c2 +DIST shim-aa64-16.1-8.aarch64.rpm 486574 BLAKE2B d13ddee11e387b2d7960e1ca7d0c2855d687696981e35ab44b67b802e13dd6f207adbfcde3ecf96b9783d5bb670763ecfef68af396fd3d6f4a5c3bc11a28695a SHA512 6909ad0fb154a32cca3ceaf7f5b51e1efb23358c827320d40aff2247a8b906dc5accf8ada5ffb6b8590790ef00f602289b7398dbfcdb5493227cfeb0263545fc +DIST shim-ia32-15.8-3.x86_64.rpm 422489 BLAKE2B 00aa14d10ac0351e39f2b7bb2da6b31e048757ee9413b73f5a1638688e2b242c161b39b5d897c9414e435caab13456763dbe2c6bc46061ab3c29e14ab487e587 SHA512 10ef47014637f9df9f199d90e3869e96341723c23628cfd22465638028cc38b006a003c41ea7fd7f1885e4cb573a2f23034a237ea03ba231f8f0d37573bb2e23 +DIST shim-ia32-16.1-8.x86_64.rpm 436712 BLAKE2B 430c9e3e43eb8bcc3465b391c07a125426638cc6c1fdd11b707ef4d5de6a47711216511cad6d118657523ea8b77cbfe21e9dc9648296bef4e6555b2e7c1800b7 SHA512 5025a82a7f97c47337990bc2a270942b472bf4cee17a1f1268f6849a1ce64b0d7c90d859716b38cf87aa129e1fd24c16b68d9f08f0ba89d1b857da854ce7140e +DIST shim-x64-15.8-3.x86_64.rpm 478432 BLAKE2B cf1a032af75fc17e09444aae488c2921a8f0868d91ceb427835cd0378f6c7369e223b7fc08f0a596774b374e3f800b9ec941792e522d8c5281a395cf800c642a SHA512 4c3635d82980ccb604b568f072f30ac0c0055c6ed2985dade6a28c9070852a240bb33f15f9ef42c83fa46d212c18ae6f17abca9f3adda0a332b908ceda537e87 +DIST shim-x64-16.1-8.x86_64.rpm 497824 BLAKE2B d4dd3186b894d56e8da956f6fb9a57e48501c9c5961884db69ccf83c8db0d13dbd3437d8704ca9d10dee2ff4540b77681a217fe81ca7e464174b723167990c7a SHA512 26215953f7b01da06d0452b4287277ad5fc295a1aa4b79c1ff9d9a454fb029ae2a2090a64609d8ea42613bd5ae3e02ccebd1bea6e6912bbd5e0cd6de320723f2 diff --git a/sys-boot/shim/metadata.xml b/sys-boot/shim/metadata.xml new file mode 100644 index 000000000000..63677be502e6 --- /dev/null +++ b/sys-boot/shim/metadata.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>nowa@gentoo.org</email> + <name>Nowa Ammerlaan</name> + </maintainer> + <maintainer type="project"> + <email>base-system@gentoo.org</email> + <name>Gentoo Base System</name> + </maintainer> + <upstream> + <remote-id type="cpe">cpe:/a:redhat:shim</remote-id> + <remote-id type="github">rhboot/shim</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/shim/shim-15.8.ebuild b/sys-boot/shim/shim-15.8.ebuild new file mode 100644 index 000000000000..843e7c262c15 --- /dev/null +++ b/sys-boot/shim/shim-15.8.ebuild @@ -0,0 +1,30 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +RPM_COMPRESS_TYPE=zstd +inherit rpm secureboot + +DESCRIPTION="Fedora's signed UEFI shim" +HOMEPAGE="https://src.fedoraproject.org/rpms/shim" +SRC_URI="amd64? ( https://kojipkgs.fedoraproject.org/packages/shim/${PV}/3/x86_64/shim-x64-${PV}-3.x86_64.rpm + https://kojipkgs.fedoraproject.org/packages/shim/${PV}/3/x86_64/shim-ia32-${PV}-3.x86_64.rpm ) + x86? ( https://kojipkgs.fedoraproject.org/packages/shim/${PV}/3/x86_64/shim-x64-${PV}-3.x86_64.rpm + https://kojipkgs.fedoraproject.org/packages/shim/${PV}/3/x86_64/shim-ia32-${PV}-3.x86_64.rpm ) + arm64? ( https://kojipkgs.fedoraproject.org/packages/shim/${PV}/3/aarch64/shim-aa64-${PV}-3.aarch64.rpm )" +S="${WORKDIR}/boot/efi/EFI" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64 arm64 x86" + +src_install() { + insinto /usr/share/${PN} + doins BOOT/BOOT*.EFI + doins fedora/mm*.efi + + # Shim is already signed with Microsoft keys, but MokManager still needs + # signing with our key otherwise we have to enrol the Fedora key in Mok list + secureboot_auto_sign --in-place +} diff --git a/sys-boot/shim/shim-16.1_p8.ebuild b/sys-boot/shim/shim-16.1_p8.ebuild new file mode 100644 index 000000000000..cc01a800c607 --- /dev/null +++ b/sys-boot/shim/shim-16.1_p8.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +RPM_COMPRESS_TYPE=zstd +inherit rpm secureboot + +MAJORMINOR_V="$(ver_cut 1-2)" +PATCH_V="$(ver_cut 4)" + +DESCRIPTION="Fedora's signed UEFI shim" +HOMEPAGE="https://src.fedoraproject.org/rpms/shim" +SRC_URI=" + amd64? ( + https://kojipkgs.fedoraproject.org/packages/shim/${MAJORMINOR_V}/${PATCH_V}/x86_64/shim-x64-${MAJORMINOR_V}-${PATCH_V}.x86_64.rpm + https://kojipkgs.fedoraproject.org/packages/shim/${MAJORMINOR_V}/${PATCH_V}/x86_64/shim-ia32-${MAJORMINOR_V}-${PATCH_V}.x86_64.rpm + ) + x86? ( + https://kojipkgs.fedoraproject.org/packages/shim/${MAJORMINOR_V}/${PATCH_V}/x86_64/shim-x64-${MAJORMINOR_V}-${PATCH_V}.x86_64.rpm + https://kojipkgs.fedoraproject.org/packages/shim/${MAJORMINOR_V}/${PATCH_V}/x86_64/shim-ia32-${MAJORMINOR_V}-${PATCH_V}.x86_64.rpm + ) + arm64? ( https://kojipkgs.fedoraproject.org/packages/shim/${MAJORMINOR_V}/${PATCH_V}/aarch64/shim-aa64-${MAJORMINOR_V}-${PATCH_V}.aarch64.rpm )" +S="${WORKDIR}/usr/lib/efi/shim/${MAJORMINOR_V}-${PATCH_V}/EFI" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" + +src_install() { + insinto /usr/share/${PN} + doins BOOT/BOOT*.EFI + doins fedora/mm*.efi + + # Shim is already signed with Microsoft keys, but MokManager still needs + # signing with our key otherwise we have to enrol the Fedora key in Mok list + secureboot_auto_sign --in-place +} diff --git a/sys-boot/silo/Manifest b/sys-boot/silo/Manifest new file mode 100644 index 000000000000..21a7b23314ec --- /dev/null +++ b/sys-boot/silo/Manifest @@ -0,0 +1 @@ +DIST silo-1.4.14_p20200602.tar.gz 183668 BLAKE2B e229cdb9fbc5f0111aa49919f4b3b91c0770492fa06f91bda15c65af160b728b9409365c3ff0a93091b1e3011c60d0b0bec1101ffabaddbaef7e1083158830b1 SHA512 7a70fe25c1bb3ce655e4fbb85b00fe0d29fe0a6f98b80c1b8267b72bc9324ac0749cd050921163cc286e094f7d9bc81315d63ff02d2442b5c30ce350a537fcc1 diff --git a/sys-boot/silo/metadata.xml b/sys-boot/silo/metadata.xml new file mode 100644 index 000000000000..81daa9304f4e --- /dev/null +++ b/sys-boot/silo/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>sparc@gentoo.org</email> + <name>SPARC architecture team</name> +</maintainer> +<use> + <flag name="tilo-only">Install only the tilo netboot tool</flag> +</use> +</pkgmetadata> diff --git a/sys-boot/silo/silo-1.4.14_p20200602.ebuild b/sys-boot/silo/silo-1.4.14_p20200602.ebuild new file mode 100644 index 000000000000..5fea5c9a5428 --- /dev/null +++ b/sys-boot/silo/silo-1.4.14_p20200602.ebuild @@ -0,0 +1,71 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit mount-boot flag-o-matic toolchain-funcs vcs-snapshot + +MY_SNAPSHOT="${PN}-9277bfd433e398d0a6eabec79edead52d4cb8125" + +DESCRIPTION="SPARC/UltraSPARC Improved Loader, a boot loader for sparc" +SRC_URI="https://git.kernel.org/pub/scm/linux/kernel/git/davem/silo.git/snapshot/${MY_SNAPSHOT}.tar.gz -> ${P}.tar.gz" +HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/davem/silo.git;a=summary" + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="-* ~sparc" +IUSE="tilo-only" + +DEPEND="sys-fs/e2fsprogs + sys-apps/sparc-utils" +RDEPEND="" + +src_prepare() { + default + + # Set the correct version + sed -i -e "s/1.4.14/1.4.14_git20200602/g" Rules.make || die + + # Fix build failure + sed -i -e "s/-fno-strict-aliasing/-fno-strict-aliasing -mcpu=v9/g" Rules.make || die + + # Don't strip ieee32.b during compile + sed -i -e '/^ $(STRIP) ieee32.b/d' first/Makefile || die +} + +_emake() { + # We inject '-m32' / '-m elf32_sparc' to follow 'Rules.make' defaults. + + emake \ + HOSTCC="$(tc-getBUILD_CC)" \ + CC="$(tc-getCC) -m32" \ + STRIP="$(tc-getSTRIP)" \ + NM="$(tc-getNM)" \ + LD="$(tc-getLD) -m elf32_sparc" \ + TILO_ONLY=$(usex tilo-only yes no) \ + \ + "$@" +} + +src_compile() { + filter-flags "-fstack-protector" + + _emake +} + +src_install() { + _emake DESTDIR="${D}" install + + dodoc first-isofs/README.SILO_ISOFS docs/README* +} + +pkg_postinst() { + use tilo-only && return + + mount-boot_pkg_postinst + ewarn "NOTE: If this is an upgrade to an existing SILO install," + ewarn " you will need to re-run silo as the /boot/second.b" + ewarn " file has changed, else the system will fail to load" + ewarn " SILO at the next boot." + ewarn +} diff --git a/sys-boot/syslinux/Manifest b/sys-boot/syslinux/Manifest new file mode 100644 index 000000000000..199f8fc51470 --- /dev/null +++ b/sys-boot/syslinux/Manifest @@ -0,0 +1,2 @@ +DIST syslinux-6.04-pre1.tar.xz 5283272 BLAKE2B 800e5977ed13b26a1756c33d8625e850631b642e26a86e3328196ddd998596693c3a26db0ada4c0ba78a4ba692a1cc01886b6eb693d877ddafcfb325ecdeb639 SHA512 7927dd39be8e2dcf4138a6fea33def67d19d938379d694f15b48fdd2f5924c028b7a9e7bd71d0c7c6630c203e9e2a54296628e530632ad5e6f55b1ebefe8fc98 +DIST syslinux-6.04-pre3.tar.gz 10760898 BLAKE2B 708bb7f3ecbe1888471f3be0102270c056bf8c5be22013f36b56c90f13f5358ce1853722b14b962d8156cd1f045b9687166b98a1d7ad2853acbe6303fa40fae9 SHA512 0619a25347f3964e0c7c6ff629b2f59f01bd9e0afd822f46b67f26b8c84cbc55534cf7b22ff1bf83eec4986fd2d8f1646a3d750190a7c6c50251affc0b62594d diff --git a/sys-boot/syslinux/files/6.04_pre1/0001-Strip-the-.note.gnu.property-section-for-the-mbr.patch b/sys-boot/syslinux/files/6.04_pre1/0001-Strip-the-.note.gnu.property-section-for-the-mbr.patch new file mode 100644 index 000000000000..5d823436bec8 --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0001-Strip-the-.note.gnu.property-section-for-the-mbr.patch @@ -0,0 +1,47 @@ +From 60fef313164d1048cf11423656732953776e5e2f Mon Sep 17 00:00:00 2001 +From: Lukas Schwaighofer <lukas@schwaighofer.name> +Date: Sat, 18 Aug 2018 12:48:21 +0200 +Subject: [PATCH 1/5] Strip the .note.gnu.property section for the mbr + +This section is added since binutils Debian version 2.31.1-2 and causes mbr.bin +to grow in size beyond what can fit into the master boot record. + +Forwarded: https://www.syslinux.org/archives/2018-August/026168.html +--- + mbr/i386/mbr.ld | 6 +++++- + mbr/x86_64/mbr.ld | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/mbr/i386/mbr.ld b/mbr/i386/mbr.ld +index d14ba802..6d489904 100644 +--- a/mbr/i386/mbr.ld ++++ b/mbr/i386/mbr.ld +@@ -69,5 +69,9 @@ SECTIONS + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +- /DISCARD/ : { *(.note.GNU-stack) } ++ /DISCARD/ : ++ { ++ *(.note.GNU-stack) ++ *(.note.gnu.property) ++ } + } +diff --git a/mbr/x86_64/mbr.ld b/mbr/x86_64/mbr.ld +index ae27d49a..5b46db66 100644 +--- a/mbr/x86_64/mbr.ld ++++ b/mbr/x86_64/mbr.ld +@@ -68,5 +68,9 @@ SECTIONS + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +- /DISCARD/ : { *(.note.GNU-stack) } ++ /DISCARD/ : ++ { ++ *(.note.GNU-stack) ++ *(.note.gnu.property) ++ } + } +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/6.04_pre1/0002-Force-the-linker-to-put-all-sections-into-a-single-P.patch b/sys-boot/syslinux/files/6.04_pre1/0002-Force-the-linker-to-put-all-sections-into-a-single-P.patch new file mode 100644 index 000000000000..33b6a36c63ea --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0002-Force-the-linker-to-put-all-sections-into-a-single-P.patch @@ -0,0 +1,311 @@ +From 0c646f067a6b766a5ce0434e5e4e7b839b511331 Mon Sep 17 00:00:00 2001 +From: Lukas Schwaighofer <lukas@schwaighofer.name> +Date: Sat, 18 Aug 2018 16:56:35 +0200 +Subject: [PATCH 2/5] Force the linker to put all sections into a single + PT_LOAD segment + +This is required when using binutils >= 2.31 which writes two PT_LOAD segments +by default. This is not supported by the wrapper.c script used to convert the +shared object into an elf binary. + +Forwarded: https://www.syslinux.org/archives/2018-August/026167.html +--- + efi/i386/syslinux.ld | 37 +++++++++++++++++++++---------------- + efi/x86_64/syslinux.ld | 37 +++++++++++++++++++++---------------- + 2 files changed, 42 insertions(+), 32 deletions(-) + +diff --git a/efi/i386/syslinux.ld b/efi/i386/syslinux.ld +index bab3fc74..19c16479 100644 +--- a/efi/i386/syslinux.ld ++++ b/efi/i386/syslinux.ld +@@ -19,6 +19,11 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") + OUTPUT_ARCH(i386) + ENTRY(_start) + ++PHDRS ++{ ++ all PT_LOAD ; ++} ++ + SECTIONS + { + . = 0; +@@ -31,7 +36,7 @@ SECTIONS + *(.text) + *(.text.*) + __text_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -40,7 +45,7 @@ SECTIONS + *(.rodata) + *(.rodata.*) + __rodata_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -49,14 +54,14 @@ SECTIONS + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __ctors_end = .; +- } ++ } :all + + .dtors : { + __dtors_start = .; + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __dtors_end = .; +- } ++ } :all + + . = ALIGN(4096); + .rel : { +@@ -64,7 +69,7 @@ SECTIONS + *(.rel.data) + *(.rel.data.*) + *(.rel.ctors) +- } ++ } :all + + . = ALIGN(4); + +@@ -72,14 +77,14 @@ SECTIONS + __gnu_hash_start = .; + *(.gnu.hash) + __gnu_hash_end = .; +- } ++ } :all + + + .dynsym : { + __dynsym_start = .; + *(.dynsym) + __dynsym_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -87,7 +92,7 @@ SECTIONS + __dynstr_start = .; + *(.dynstr) + __dynstr_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -104,7 +109,7 @@ SECTIONS + KEEP (*(.got.plt)) + KEEP (*(.got)) + __got_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -112,7 +117,7 @@ SECTIONS + __dynamic_start = .; + *(.dynamic) + __dynamic_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -122,19 +127,19 @@ SECTIONS + *(.data.*) + *(.lowmem) + __data_end = .; +- } ++ } :all + + .reloc : { + *(.reloc) +- } ++ } :all + + .symtab : { + *(.symtab) +- } ++ } :all + + .strtab : { + *(.strtab) +- } ++ } :all + + .bss (NOLOAD) : { + /* the EFI loader doesn't seem to like a .bss section, +@@ -148,7 +153,7 @@ SECTIONS + __bss_end = .; + *(.sbss) + *(.scommon) +- } ++ } :all + __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start); + __bss_dwords = (__bss_len + 3) >> 2; + +@@ -161,7 +166,7 @@ SECTIONS + *(.hugebss) + *(.hugebss.*) + __hugebss_end = .; +- } ++ } :all + + _end = .; + +diff --git a/efi/x86_64/syslinux.ld b/efi/x86_64/syslinux.ld +index 450641c6..a2c124fd 100644 +--- a/efi/x86_64/syslinux.ld ++++ b/efi/x86_64/syslinux.ld +@@ -19,6 +19,11 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") + OUTPUT_ARCH(i386:x86-64) + ENTRY(_start) + ++PHDRS ++{ ++ all PT_LOAD ; ++} ++ + SECTIONS + { + . = 0; +@@ -31,7 +36,7 @@ SECTIONS + *(.text) + *(.text.*) + __text_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -40,7 +45,7 @@ SECTIONS + *(.rodata) + *(.rodata.*) + __rodata_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -49,14 +54,14 @@ SECTIONS + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __ctors_end = .; +- } ++ } :all + + .dtors : { + __dtors_start = .; + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __dtors_end = .; +- } ++ } :all + + . = ALIGN(4096); + .rel : { +@@ -64,7 +69,7 @@ SECTIONS + *(.rel.data) + *(.rel.data.*) + *(.rel.ctors) +- } ++ } :all + + . = ALIGN(4); + +@@ -72,14 +77,14 @@ SECTIONS + __gnu_hash_start = .; + *(.gnu.hash) + __gnu_hash_end = .; +- } ++ } :all + + + .dynsym : { + __dynsym_start = .; + *(.dynsym) + __dynsym_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -87,7 +92,7 @@ SECTIONS + __dynstr_start = .; + *(.dynstr) + __dynstr_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -104,7 +109,7 @@ SECTIONS + KEEP (*(.got.plt)) + KEEP (*(.got)) + __got_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -112,7 +117,7 @@ SECTIONS + __dynamic_start = .; + *(.dynamic) + __dynamic_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -122,19 +127,19 @@ SECTIONS + *(.data.*) + *(.lowmem) + __data_end = .; +- } ++ } :all + + .reloc : { + *(.reloc) +- } ++ } :all + + .symtab : { + *(.symtab) +- } ++ } :all + + .strtab : { + *(.strtab) +- } ++ } :all + + .bss (NOLOAD) : { + /* the EFI loader doesn't seem to like a .bss section, +@@ -148,7 +153,7 @@ SECTIONS + __bss_end = .; + *(.sbss) + *(.scommon) +- } ++ } :all + __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start); + __bss_dwords = (__bss_len + 3) >> 2; + +@@ -161,7 +166,7 @@ SECTIONS + *(.hugebss) + *(.hugebss.*) + __hugebss_end = .; +- } ++ } :all + + _end = .; + +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/6.04_pre1/0003-GCC-10-compatibility-patch.patch b/sys-boot/syslinux/files/6.04_pre1/0003-GCC-10-compatibility-patch.patch new file mode 100644 index 000000000000..6d60eab14bbb --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0003-GCC-10-compatibility-patch.patch @@ -0,0 +1,99 @@ +From b92e6e8f624c96acf2ce80192a893ee25de527a1 Mon Sep 17 00:00:00 2001 +From: Lukas Schwaighofer <lukas@schwaighofer.name> +Date: Sun, 16 Aug 2020 15:23:21 +0200 +Subject: [PATCH 3/5] GCC-10 compatibility patch + +* Add `-fcommon` to most gcc invocations to allow duplicate definitions +* __builtin_strlen is not really a "builtin" an implementation still + needs to be provided (source: + https://bugzilla.suse.com/show_bug.cgi?id=1166605#c5). Work around the + issue by supplying an inline function. The strlen function added to + dos/string.h was copied from com32/lib/strlen.c. +--- + dos/string.h | 11 ++++++++++- + mk/efi.mk | 1 + + mk/elf.mk | 1 + + mk/embedded.mk | 2 +- + mk/lib.mk | 2 +- + 5 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/dos/string.h b/dos/string.h +index f648de2d..c4649f5f 100644 +--- a/dos/string.h ++++ b/dos/string.h +@@ -5,12 +5,21 @@ + #ifndef _STRING_H + #define _STRING_H + ++#include <stddef.h> ++ + /* Standard routines */ + #define memcpy(a,b,c) __builtin_memcpy(a,b,c) + #define memmove(a,b,c) __builtin_memmove(a,b,c) + #define memset(a,b,c) __builtin_memset(a,b,c) + #define strcpy(a,b) __builtin_strcpy(a,b) +-#define strlen(a) __builtin_strlen(a) ++ ++static inline size_t strlen(const char *s) ++{ ++ const char *ss = s; ++ while (*ss) ++ ss++; ++ return ss - s; ++} + + /* This only returns true or false */ + static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n) +diff --git a/mk/efi.mk b/mk/efi.mk +index f097ad22..407bc077 100644 +--- a/mk/efi.mk ++++ b/mk/efi.mk +@@ -25,6 +25,7 @@ FORMAT=efi-app-$(EFI_SUBARCH) + + CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(EFI_SUBARCH) \ + -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \ ++ -fcommon \ + -Wall -I$(com32)/include -I$(com32)/include/sys \ + -I$(core)/include -I$(core)/ $(ARCHOPT) \ + -I$(com32)/lib/ -I$(com32)/libutil/include -std=gnu99 \ +diff --git a/mk/elf.mk b/mk/elf.mk +index b46dbd06..dc265ce9 100644 +--- a/mk/elf.mk ++++ b/mk/elf.mk +@@ -55,6 +55,7 @@ GPLINCLUDE = + endif + + CFLAGS = $(GCCOPT) $(GCCWARN) -W -Wall \ ++ -fcommon \ + -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ -DDYNAMIC_MODULE \ + -nostdinc -iwithprefix include \ + -I$(com32)/libutil/include -I$(com32)/include \ +diff --git a/mk/embedded.mk b/mk/embedded.mk +index 488dc0fc..fae13e20 100644 +--- a/mk/embedded.mk ++++ b/mk/embedded.mk +@@ -57,7 +57,7 @@ LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) + LD += -m elf_$(ARCH) + + # Note: use += for CFLAGS and SFLAGS in case something is set in MCONFIG.local +-CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES) ++CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare -fcommon $(OPTFLAGS) $(INCLUDES) + SFLAGS += $(CFLAGS) -D__ASSEMBLY__ + + .SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss +diff --git a/mk/lib.mk b/mk/lib.mk +index f8591e56..6dd54295 100644 +--- a/mk/lib.mk ++++ b/mk/lib.mk +@@ -49,7 +49,7 @@ OPTFLAGS = -Os -march=$(MARCH) -falign-functions=0 -falign-jumps=0 \ + -falign-labels=0 -ffast-math -fomit-frame-pointer + WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline + +-CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS) ++CFLAGS = $(OPTFLAGS) $(REQFLAGS) -fcommon $(WARNFLAGS) $(LIBFLAGS) + + ifeq ($(FWCLASS),EFI) + CFLAGS += -mno-red-zone +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/6.04_pre1/0004-Inherit-toolchain-vars-from-environment.patch b/sys-boot/syslinux/files/6.04_pre1/0004-Inherit-toolchain-vars-from-environment.patch new file mode 100644 index 000000000000..40784f9b2698 --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0004-Inherit-toolchain-vars-from-environment.patch @@ -0,0 +1,72 @@ +From 46d58e2b03e15a863aed8661b9ee922da4930a3e Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Mon, 30 May 2022 11:57:07 -0400 +Subject: [PATCH 4/5] Inherit toolchain vars from environment + +--- + mk/syslinux.mk | 36 ++++++++++++++++++------------------ + 1 file changed, 18 insertions(+), 18 deletions(-) + +diff --git a/mk/syslinux.mk b/mk/syslinux.mk +index 593ff75f..91d984e8 100644 +--- a/mk/syslinux.mk ++++ b/mk/syslinux.mk +@@ -37,7 +37,7 @@ ifdef DEBUG + DEBUGOPT = -DDEBUG=$(DEBUG) + endif + +-NASM = nasm ++NASM ?= nasm + NASMOPT = -Ox $(DEBUGOPT) + + PERL = perl +@@ -46,29 +46,29 @@ UPX = upx + + CHMOD = chmod + +-CC = gcc ++CC ?= gcc + gcc_ok = $(shell tmpf=gcc_ok.$$$$.tmp; \ + if $(CC) $(GCCOPT) $(1) -c $(topdir)/dummy.c \ + -o $$tmpf 2>/dev/null ; \ + then echo '$(1)'; else echo '$(2)'; fi; \ + rm -f $$tmpf) + +-LD = ld +-OBJDUMP = objdump +-OBJCOPY = objcopy +-STRIP = strip +-AR = ar +-NM = nm +-RANLIB = ranlib +-STRIP = strip +-GZIPPROG = gzip +-XZ = xz +-PNGTOPNM = pngtopnm +-MCOPY = mcopy +-MFORMAT = mformat +-MKISOFS = mkisofs +-SED = sed +-WGET = wget ++LD ?= ld ++OBJDUMP ?= objdump ++OBJCOPY ?= objcopy ++STRIP ?= strip ++AR ?= ar ++NM ?= nm ++RANLIB ?= ranlib ++STRIP ?= strip ++GZIPPROG ?= gzip ++XZ ?= xz ++PNGTOPNM ?= pngtopnm ++MCOPY ?= mcopy ++MFORMAT ?= mformat ++MKISOFS ?= mkisofs ++SED ?= sed ++WGET ?= wget + + com32 = $(topdir)/com32 + +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/6.04_pre1/0005-Fix-build-with-GCC-14.patch b/sys-boot/syslinux/files/6.04_pre1/0005-Fix-build-with-GCC-14.patch new file mode 100644 index 000000000000..41414ed0f522 --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0005-Fix-build-with-GCC-14.patch @@ -0,0 +1,62 @@ +From 321433861cc9cd3c7e0ee02830e561bc0f956998 Mon Sep 17 00:00:00 2001 +From: rpm-build <rpm-build> +Date: Sun, 4 Feb 2024 11:46:02 -0500 +Subject: [PATCH] Fix build with GCC 14 + +com32/lib/syslinux/debug.c: In function ‘syslinux_debug’: +com32/lib/syslinux/debug.c:91:5: error: implicit declaration of function ‘printf’ + +com32/libupload/upload_tftp.c: In function ‘upload_tftp_write’: +com32/libupload/upload_tftp.c:64:11: error: implicit declaration of function ‘tftp_put’ + +com32/chain/chain.c: In function ‘main’: +com32/chain/chain.c:517:44: error: passing argument 3 of ‘loadfile’ from incompatible pointer type +com32/include/syslinux/loadfile.h:11:37: note: expected ‘size_t *’ but argument is of type ‘addr_t *’ + +Upstream-Status: Inactive-Upstream [no upstream] +--- + com32/chain/chain.c | 2 +- + com32/lib/syslinux/debug.c | 1 + + com32/libupload/tftp.h | 3 +++ + 3 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/com32/chain/chain.c b/com32/chain/chain.c +index 4e9e32d..b11b880 100644 +--- a/com32/chain/chain.c ++++ b/com32/chain/chain.c +@@ -514,7 +514,7 @@ int main(int argc, char *argv[]) + if (opt.file) { + fdat.base = (opt.fseg << 4) + opt.foff; + +- if (loadfile(opt.file, &fdat.data, &fdat.size)) { ++ if (loadfile(opt.file, &fdat.data, (size_t*)&fdat.size)) { + error("Couldn't read the boot file."); + goto bail; + } +diff --git a/com32/lib/syslinux/debug.c b/com32/lib/syslinux/debug.c +index d9ab863..e8f53d5 100644 +--- a/com32/lib/syslinux/debug.c ++++ b/com32/lib/syslinux/debug.c +@@ -1,6 +1,7 @@ + #include <linux/list.h> + #include <string.h> + #include <stdbool.h> ++#include <stdio.h> + + #ifdef DYNAMIC_DEBUG + +diff --git a/com32/libupload/tftp.h b/com32/libupload/tftp.h +index 323dc16..09aa40b 100644 +--- a/com32/libupload/tftp.h ++++ b/com32/libupload/tftp.h +@@ -19,4 +19,7 @@ TFTP_OK = 11, /* Not in RFC */ + }; + + extern const char *tftp_string_error_message[]; ++ ++extern int tftp_put(struct url_info *url, int flags, struct inode *inode, ++ const char **redir, char *data, int data_length); + #endif +-- +2.43.0 + diff --git a/sys-boot/syslinux/files/6.04_pre3/0005-Include-efisetjmp.h-from-efi.h.patch b/sys-boot/syslinux/files/6.04_pre3/0005-Include-efisetjmp.h-from-efi.h.patch new file mode 100644 index 000000000000..0d32d7167024 --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre3/0005-Include-efisetjmp.h-from-efi.h.patch @@ -0,0 +1,24 @@ +From 9889f441d006d11d0fb0b726b9f81396ce6fcfbd Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Mon, 30 May 2022 14:22:28 -0400 +Subject: [PATCH 5/5] Include efisetjmp.h from efi.h + +--- + efi/efi.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/efi/efi.h b/efi/efi.h +index c266532f..250c511e 100644 +--- a/efi/efi.h ++++ b/efi/efi.h +@@ -22,6 +22,7 @@ + + #include <efi.h> + #include <efilib.h> ++#include <efisetjmp.h> + #include <efistdarg.h> + + /* Delay for 100 ms */ +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/syslinux-6.03-sysmacros.patch b/sys-boot/syslinux/files/syslinux-6.03-sysmacros.patch new file mode 100644 index 000000000000..af464fe534e1 --- /dev/null +++ b/sys-boot/syslinux/files/syslinux-6.03-sysmacros.patch @@ -0,0 +1,34 @@ +https://bugs.gentoo.org/579928 + +From d84db34dbe39d55b4d7e868764c056689aa0793b Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Tue, 19 Apr 2016 01:56:41 -0400 +Subject: [PATCH] extlinux: pull in sys/sysmacros.h for major/minor/makedev + +These functions are defined in sys/sysmacros.h, so add the include to +main.c. This is already handled correctly in mountinfo.c. Otherwise +we get build failures like: + +main.o: In function 'find_device_sysfs': +extlinux/main.c:1131: undefined reference to 'minor' + +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +--- + extlinux/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/extlinux/main.c b/extlinux/main.c +index a7ebd49..ebff7ea 100644 +--- a/extlinux/main.c ++++ b/extlinux/main.c +@@ -38,6 +38,7 @@ + #include <sysexits.h> + #include <sys/ioctl.h> + #include <sys/stat.h> ++#include <sys/sysmacros.h> + #include <sys/types.h> + #include <sys/mount.h> + #include <sys/vfs.h> +-- +2.7.4 + diff --git a/sys-boot/syslinux/files/syslinux-6.04-binutils-2.41.patch b/sys-boot/syslinux/files/syslinux-6.04-binutils-2.41.patch new file mode 100644 index 000000000000..56762aa756d5 --- /dev/null +++ b/sys-boot/syslinux/files/syslinux-6.04-binutils-2.41.patch @@ -0,0 +1,74 @@ +https://bugs.gentoo.org/913129 +--- a/gnu-efi/gnu-efi-3.0/Make.defaults ++++ b/gnu-efi/gnu-efi-3.0/Make.defaults +@@ -114,4 +114,4 @@ CFLAGS += $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing \ + -fno-merge-constants -ffreestanding -fno-stack-protector \ + -fno-stack-check + ASFLAGS += $(ARCH3264) +-LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings ++LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings -z notext +--- a/gnu-efi/gnu-efi-3.0/apps/Makefile ++++ b/gnu-efi/gnu-efi-3.0/apps/Makefile +@@ -52,7 +52,7 @@ ifneq (,$(findstring FreeBSD,$(OS))) + LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds + endif + +-LDFLAGS += -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS) ++LDFLAGS += -shared -z notext -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS) + + LOADLIBES += -lefi -lgnuefi + LOADLIBES += $(shell $(CC) $(ARCH3264) -print-libgcc-file-name) +--- a/mk/com32.mk ++++ b/mk/com32.mk +@@ -80,7 +80,7 @@ SFLAGS = $(GCCOPT) $(GCCWARN) \ + -I$(topdir)/core/include + + COM32LD = $(com32)/lib/$(ARCH)/elf.ld +-LDFLAGS = -m elf_$(ARCH) -shared --hash-style=gnu -T $(COM32LD) ++LDFLAGS = -m elf_$(ARCH) -shared -z notext --hash-style=gnu -T $(COM32LD) + LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) + + LNXCFLAGS = -I$(com32)/libutil/include $(GCCWARN) -O -g \ +--- a/mk/efi.mk ++++ b/mk/efi.mk +@@ -38,7 +38,7 @@ CRT0 := $(LIBDIR)/crt0-efi-$(EFI_SUBARCH).o + LDSCRIPT := $(LIBDIR)/elf_$(EFI_SUBARCH)_efi.lds + + LDFLAGS = -T $(SRC)/$(ARCH)/syslinux.ld -Bsymbolic -pie -nostdlib -znocombreloc \ +- -L$(LIBDIR) --hash-style=gnu -m elf_$(ARCH) $(CRT0) -E ++ -L$(LIBDIR) -z notext --hash-style=gnu -m elf_$(ARCH) $(CRT0) -E + + SFLAGS = $(GCCOPT) $(GCCWARN) $(ARCHOPT) \ + -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \ +--- a/mk/elf.mk ++++ b/mk/elf.mk +@@ -68,7 +68,7 @@ GCCOPT += -mregparm=3 -DREGPARM=3 + endif + + SFLAGS = $(GCCOPT) -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ +-LDFLAGS = -m elf_$(ARCH) -shared --hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld --as-needed ++LDFLAGS = -m elf_$(ARCH) -shared -z notext --hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld --as-needed + LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) + + LNXCFLAGS = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE +--- a/mk/lib.mk ++++ b/mk/lib.mk +@@ -205,7 +205,7 @@ CORELIBOBJS = \ + $(LIBENTRY_OBJS) \ + $(LIBMODULE_OBJS) + +-LDFLAGS = -m elf_$(ARCH) --hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld ++LDFLAGS = -m elf_$(ARCH) -z notext --hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld + + .SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss + +--- a/core/Makefile ++++ b/core/Makefile +@@ -158,6 +158,7 @@ NASM_ELF = elf + %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS) + $(LD) $(LDFLAGS) -pie -Bsymbolic \ + -T $(LDSCRIPT) \ ++ -z notext \ + --unresolved-symbols=report-all \ + -E --hash-style=gnu -M -o $@ $< \ + --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group \ diff --git a/sys-boot/syslinux/files/syslinux-musl.patch b/sys-boot/syslinux/files/syslinux-musl.patch new file mode 100644 index 000000000000..31a4df4c865a --- /dev/null +++ b/sys-boot/syslinux/files/syslinux-musl.patch @@ -0,0 +1,24 @@ +--- a/efi/wrapper.h ++++ b/efi/wrapper.h +@@ -26,6 +26,21 @@ + #define __packed __attribute__((packed)) + #define OFFSETOF(t,m) ((size_t)&((t *)0)->m) + ++#include <stdint.h> ++ ++#ifndef __uint8_t ++#define __uint8_t uint8_t ++#endif ++#ifndef __uint16_t ++#define __uint16_t uint16_t ++#endif ++#ifndef __uint32_t ++#define __uint32_t uint32_t ++#endif ++#ifndef __uint64_t ++#define __uint64_t uint64_t ++#endif ++ + struct header { + __uint16_t msdos_signature; + __uint8_t _pad1[0x16]; diff --git a/sys-boot/syslinux/metadata.xml b/sys-boot/syslinux/metadata.xml new file mode 100644 index 000000000000..f3144c449789 --- /dev/null +++ b/sys-boot/syslinux/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>base-system@gentoo.org</email> + <name>Gentoo Base System</name> + </maintainer> + <use> + <flag name="bios">Enable BIOS support</flag> + <flag name="uefi">Enable UEFI support</flag> + </use> + <upstream> + <remote-id type="cpe">cpe:/a:gentoo:syslinux</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild b/sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild new file mode 100644 index 000000000000..4280886494b2 --- /dev/null +++ b/sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild @@ -0,0 +1,107 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs flag-o-matic secureboot + +DESCRIPTION="SYSLINUX, PXELINUX, ISOLINUX, EXTLINUX and MEMDISK bootloaders" +HOMEPAGE="https://www.syslinux.org/" +MY_P=${P/_/-} +SRC_URI="https://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/6.04/${MY_P}.tar.xz" + +S=${WORKDIR}/${MY_P} + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* amd64 x86" +IUSE="abi_x86_32 abi_x86_64 +bios +uefi" +REQUIRED_USE="|| ( bios uefi ) + uefi? ( || ( abi_x86_32 abi_x86_64 ) )" + +BDEPEND=" + dev-lang/perl + bios? ( dev-lang/nasm ) + sys-devel/gcc:* +" +RDEPEND=" + sys-apps/util-linux + sys-fs/mtools + dev-perl/Crypt-PasswdMD5 + dev-perl/Digest-SHA1 +" +DEPEND="${RDEPEND} + virtual/os-headers +" + +QA_EXECSTACK="usr/share/syslinux/*" +QA_WX_LOAD="usr/share/syslinux/*" +QA_PRESTRIPPED="usr/share/syslinux/.*" +QA_FLAGS_IGNORED=".*" + +pkg_setup() { + use uefi && secureboot_pkg_setup +} + +src_prepare() { + local PATCHES=( + "${FILESDIR}/syslinux-6.03-sysmacros.patch" + "${FILESDIR}/${PV}" + "${FILESDIR}/syslinux-6.04-binutils-2.41.patch" + "${FILESDIR}/syslinux-musl.patch" + ) + default + + # Force gcc because build failed with clang, #729426 + if ! tc-is-gcc ; then + ewarn "syslinux can be built with gcc only." + ewarn "Ignoring CC=$(tc-getCC) and forcing ${CHOST}-gcc" + export CC=${CHOST}-gcc + export CXX=${CHOST}-g++ + tc-is-gcc || die "tc-is-gcc failed in spite of CC=${CC}" + fi +} + +src_compile() { + filter-lto #863722 + + local DATE=$(date -u -r NEWS +%Y%m%d) + local HEXDATE=$(printf '0x%08x' "${DATE}") + + tc-export AR CC LD OBJCOPY RANLIB + unset CFLAGS LDFLAGS + + if use bios; then + emake bios DATE="${DATE}" HEXDATE="${HEXDATE}" UPX=false + fi + if use uefi; then + if use abi_x86_32; then + emake efi32 DATE="${DATE}" HEXDATE="${HEXDATE}" + fi + if use abi_x86_64; then + emake efi64 DATE="${DATE}" HEXDATE="${HEXDATE}" + fi + fi +} + +src_install() { + local firmware=( $(usev bios) ) + if use uefi; then + use abi_x86_32 && firmware+=( efi32 ) + use abi_x86_64 && firmware+=( efi64 ) + fi + local args=( + INSTALLROOT="${ED}" + MANDIR='$(DATADIR)/man' + "${firmware[@]}" + install + ) + emake -j1 "${args[@]}" + if use bios; then + mv "${ED}"/usr/bin/keytab-{lilo,syslinux} || die + fi + einstalldocs + dostrip -x /usr/share/syslinux + + use uefi && secureboot_auto_sign --in-place +} diff --git a/sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild b/sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild new file mode 100644 index 000000000000..54ba79b89d9b --- /dev/null +++ b/sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild @@ -0,0 +1,122 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs flag-o-matic secureboot + +DESCRIPTION="SYSLINUX, PXELINUX, ISOLINUX, EXTLINUX and MEMDISK bootloaders" +HOMEPAGE="https://www.syslinux.org/" +MY_P=${P/_/-} +SRC_URI="https://git.zytor.com/syslinux/syslinux.git/snapshot/${MY_P}.tar.gz" + +S=${WORKDIR}/${MY_P} + +LICENSE="GPL-2" +SLOT="0" +#KEYWORDS="-* ~amd64 ~x86" +IUSE="abi_x86_32 abi_x86_64 +bios +uefi" +REQUIRED_USE="|| ( bios uefi ) + uefi? ( || ( abi_x86_32 abi_x86_64 ) )" + +RESTRICT="test" + +BDEPEND=" + dev-lang/perl + bios? ( dev-lang/nasm ) + sys-devel/gcc:* +" +RDEPEND=" + sys-apps/util-linux + sys-fs/mtools + dev-perl/Crypt-PasswdMD5 + dev-perl/Digest-SHA1 +" +DEPEND="${RDEPEND} + uefi? ( sys-boot/gnu-efi[abi_x86_32(-)?,abi_x86_64(-)?] ) + virtual/os-headers +" + +QA_EXECSTACK="usr/share/syslinux/*" +QA_WX_LOAD="usr/share/syslinux/*" +QA_PRESTRIPPED="usr/share/syslinux/.*" +QA_FLAGS_IGNORED=".*" + +pkg_setup() { + use uefi && secureboot_pkg_setup +} + +src_prepare() { + local PATCHES=( + "${FILESDIR}/6.04_pre1" + "${FILESDIR}/6.04_pre3" + "${FILESDIR}/syslinux-musl.patch" + ) + default + + # Force gcc because build failed with clang, #729426 + if ! tc-is-gcc ; then + ewarn "syslinux can be built with gcc only." + ewarn "Ignoring CC=$(tc-getCC) and forcing ${CHOST}-gcc" + export CC=${CHOST}-gcc + export CXX=${CHOST}-g++ + tc-is-gcc || die "tc-is-gcc failed in spite of CC=${CC}" + fi +} + +efimake() { + local ABI="${1}" + local libdir="$(get_libdir)" + shift + local args=( + EFIINC="${ESYSROOT}/usr/include/efi" + LIBDIR="${ESYSROOT}/usr/${libdir}" + LIBEFI="${ESYSROOT}/usr/${libdir}/libefi.a" + "${@}" + ) + emake "${args[@]}" +} + +src_compile() { + filter-lto #863722 + + local DATE=$(date -u -r NEWS +%Y%m%d) + local HEXDATE=$(printf '0x%08x' "${DATE}") + + tc-export AR CC LD OBJCOPY RANLIB + unset CFLAGS LDFLAGS + + if use bios; then + emake bios DATE="${DATE}" HEXDATE="${HEXDATE}" UPX=false + fi + if use uefi; then + if use abi_x86_32; then + efimake x86 efi32 DATE="${DATE}" HEXDATE="${HEXDATE}" + fi + if use abi_x86_64; then + efimake amd64 efi64 DATE="${DATE}" HEXDATE="${HEXDATE}" + fi + fi +} + +src_install() { + local firmware=( $(usev bios) ) + if use uefi; then + use abi_x86_32 && firmware+=( efi32 ) + use abi_x86_64 && firmware+=( efi64 ) + fi + local args=( + INSTALLROOT="${ED}" + MANDIR='$(DATADIR)/man' + "${firmware[@]}" + install + ) + emake -j1 "${args[@]}" + if use bios; then + mv "${ED}"/usr/bin/keytab-{lilo,syslinux} || die + fi + einstalldocs + dostrip -x /usr/share/syslinux + + use uefi && secureboot_auto_sign --in-place +} diff --git a/sys-boot/tboot/Manifest b/sys-boot/tboot/Manifest new file mode 100644 index 000000000000..3c9ef91b05fa --- /dev/null +++ b/sys-boot/tboot/Manifest @@ -0,0 +1 @@ +DIST tboot-1.11.3.tar.gz 924627 BLAKE2B 5c734121f3c8ef206963fbfb6d1a044f36f3ec4893999357a95a208867101ad14e79289519353f9e634a6c16c824c0af3cdaa7baa436359b6d04e93c5b0054f7 SHA512 777026cdfb31041dd7d9dd4d208c888e6fe8259171d1340ea7936f22053362ac1ec64017319626dbcb6a9a1283c8819c9a8fe1107b9b2f3898380fd0abcc047b diff --git a/sys-boot/tboot/files/tboot-1.10.3-disable-Werror.patch b/sys-boot/tboot/files/tboot-1.10.3-disable-Werror.patch new file mode 100644 index 000000000000..5285227713ad --- /dev/null +++ b/sys-boot/tboot/files/tboot-1.10.3-disable-Werror.patch @@ -0,0 +1,12 @@ +diff -r 5a30b6b09e77 Config.mk +--- a/Config.mk Fri Dec 10 15:35:42 2021 +0100 ++++ b/Config.mk Sun Dec 12 14:53:57 2021 -0600 +@@ -39,7 +39,7 @@ + /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;) + + +-CFLAGS_WARN = -Wall -Wformat-security -Werror -Wstrict-prototypes \ ++CFLAGS_WARN = -Wall -Wformat-security -Wstrict-prototypes \ + -Wextra -Winit-self -Wswitch-default -Wunused-parameter \ + -Wwrite-strings \ + $(call cc-option,$(CC),-Wlogical-op,) \ diff --git a/sys-boot/tboot/files/tboot-1.10.3-disable-strip.patch b/sys-boot/tboot/files/tboot-1.10.3-disable-strip.patch new file mode 100644 index 000000000000..c7a7fd04c7b5 --- /dev/null +++ b/sys-boot/tboot/files/tboot-1.10.3-disable-strip.patch @@ -0,0 +1,14 @@ +diff -r 5a30b6b09e77 Config.mk +--- a/Config.mk Fri Dec 10 15:35:42 2021 +0100 ++++ b/Config.mk Sun Dec 12 14:52:19 2021 -0600 +@@ -56,10 +56,6 @@ + OBJCOPY ?= objcopy + OBJDUMP ?= objdump + +-ifeq ($(debug),n) +-INSTALL_STRIP ?= -s +-endif +- + INSTALL ?= install + INSTALL_DIR = $(INSTALL) -d -m0755 -p + INSTALL_DATA = $(INSTALL) -m0644 -p diff --git a/sys-boot/tboot/files/tboot-1.10.3-dont-call-toolchain-directly.patch b/sys-boot/tboot/files/tboot-1.10.3-dont-call-toolchain-directly.patch new file mode 100644 index 000000000000..29840e9113e4 --- /dev/null +++ b/sys-boot/tboot/files/tboot-1.10.3-dont-call-toolchain-directly.patch @@ -0,0 +1,24 @@ +diff -r 5a30b6b09e77 safestringlib/makefile +--- a/safestringlib/makefile Fri Dec 10 15:35:42 2021 +0100 ++++ b/safestringlib/makefile Tue Dec 21 12:40:01 2021 -0600 +@@ -29,7 +29,7 @@ + $(CC) $(LDFLAGS) -c -o $@ $< $(CFLAGS) + + libsafestring.a: $(OBJ) +- ar rcs $@ $^ ++ $(AR) rcs $@ $^ + + + _TESTFUNCS = Safe_String_UnitTestMain.c test_strcmp_s.c test_strnlen_s.c test_memcmp16_s.c test_strcpyfldin_s.c test_strnterminate_s.c test_memcmp32_s.c test_strcpyfldout_s.c test_strpbrk_s.c test_memcmp_s.c test_strcpyfld_s.c test_strprefix_s.c test_memcpy16_s.c test_strcpy_s.c test_strremovews_s.c test_memcpy32_s.c test_strcspn_s.c test_strspn_s.c test_memcpy_s.c test_strfirstchar_s.c test_strstr_s.c test_memmove16_s.c test_strfirstdiff_s.c test_strtok_s.c test_memmove32_s.c test_strfirstsame_s.c test_strtolowercase_s.c test_memmove_s.c test_strisalphanumeric_s.c test_strtouppercase_s.c test_memset16_s.c test_strisascii_s.c test_strzero_s.c test_memset32_s.c test_strisdigit_s.c test_wcpcpy_s.c test_memset_s.c test_strishex_s.c test_wcscat_s.c test_memzero16_s.c test_strislowercase_s.c test_wcscpy_s.c test_memzero32_s.c test_strismixed_s.c test_wcsncat_s.c test_memzero_s.c test_strispassword_s.c test_wcsncpy_s.c test_strisuppercase_s.c test_wcsnlen_s.c test_stpcpy_s.c test_strlastchar_s.c test_wmemcmp_s.c test_stpncpy_s.c test_strlastdiff_s.c test_wmemcpy_s.c test_strcasecmp_s.c test_strlastsame_s.c test_wmemmove_s.c test_strcasestr_s.c test_strljustify_s.c test_wmemset_s.c test_strcat_s.c test_strncat_s.c test_strcmpfld_s.c test_strncpy_s.c +diff -r 5a30b6b09e77 tboot/Makefile +--- a/tboot/Makefile Fri Dec 10 15:35:42 2021 +0100 ++++ b/tboot/Makefile Tue Dec 21 12:40:01 2021 -0600 +@@ -34,7 +34,7 @@ + TARGET_LDS := $(CURDIR)/common/tboot.lds + + $(TARGET).strip : $(TARGET) +- strip $< -o $@ ++ $(STRIP) $< -o $@ + + $(TARGET).gz : $(TARGET).strip + gzip -n -f -9 < $< > $@ diff --git a/sys-boot/tboot/files/tboot-1.10.5-fix-pconf-element.patch b/sys-boot/tboot/files/tboot-1.10.5-fix-pconf-element.patch new file mode 100644 index 000000000000..a3b5138c5de0 --- /dev/null +++ b/sys-boot/tboot/files/tboot-1.10.5-fix-pconf-element.patch @@ -0,0 +1,21 @@ +# HG changeset patch +# User Christopher Byrne <salah.coronya@gmail.com> +# Date 1645847383 21600 +# Fri Feb 25 21:49:43 2022 -0600 +# Node ID bbf8373779e4653be2e2cfbaf14e1abb1ae42af4 +# Parent 5941842afb661f0e78085cb1317781d362583a38 +lcptools-v2/pconf_legacy.c: Add missing BE size_of_pcrs to hash buffer + +Signed-of-by: Christopher Byrne <salah.coronya@gmail.com> + +diff --git a/lcptools-v2/pconf_legacy.c b/lcptools-v2/pconf_legacy.c +--- a/lcptools-v2/pconf_legacy.c ++++ b/lcptools-v2/pconf_legacy.c +@@ -241,6 +241,7 @@ + ERROR("Error: failed to allocate buffer for composite digest.\n"); + return false; + } ++ buff->size_of_pcrs = htonl(no_of_pcrs * SHA1_DIGEST_SIZE); + memcpy_s( + &buff->pcr_selection, + sizeof buff->pcr_selection, diff --git a/sys-boot/tboot/metadata.xml b/sys-boot/tboot/metadata.xml new file mode 100644 index 000000000000..95c77d820750 --- /dev/null +++ b/sys-boot/tboot/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>perfinion@gentoo.org</email> + <name>Jason Zaman</name> + </maintainer> + <longdescription lang="en"> + A pre-kernel/VMM module that uses Intel(R) Trusted Execution Technology to perform a measured and verified launch of an OS kernel/VMM. + </longdescription> + <upstream> + <remote-id type="sourceforge">tboot</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/tboot/tboot-1.11.3.ebuild b/sys-boot/tboot/tboot-1.11.3.ebuild new file mode 100644 index 000000000000..2dd62fe49384 --- /dev/null +++ b/sys-boot/tboot/tboot-1.11.3.ebuild @@ -0,0 +1,77 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit mount-boot toolchain-funcs + +DESCRIPTION="Performs a measured and verified boot using Intel Trusted Execution Technology" +HOMEPAGE="https://sourceforge.net/projects/tboot/" +SRC_URI="https://downloads.sourceforge.net/${PN}/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="-* ~amd64 ~x86" +IUSE="custom-cflags selinux" + +# requires patching the kernel src +RESTRICT="test" + +DEPEND="dev-libs/openssl:0=[-bindist(-)]" + +RDEPEND="${DEPEND} + sys-boot/grub:2 + selinux? ( sec-policy/selinux-tboot )" + +DOCS=( README.md COPYING CHANGELOG ) +PATCHES=( "${FILESDIR}/${PN}-1.10.3-disable-Werror.patch" + "${FILESDIR}/${PN}-1.10.3-disable-strip.patch" + "${FILESDIR}/${PN}-1.10.3-dont-call-toolchain-directly.patch" + "${FILESDIR}/${PN}-1.10.5-fix-pconf-element.patch" ) + +pkg_setup() { + if tc-is-clang; then + eerror "tboot is a freestanding application that uses gcc" + eerror "extensions in fundemental ways, include VLAIS" + eerror "(Variable Length Arrays in Structs) and will not" + eerror "compile with clang witout upstream action" + die "Cannot compile with clang. See bug #832020" + fi +} + +src_configure() { + tc-export AS LD CC CPP AR RANLIB NM OBJCOPY OBJDUMP STRIP + + default +} + +src_compile() { + use custom-cflags && export TBOOT_CFLAGS=${CFLAGS} || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS + + if use amd64; then + export MAKEARGS="TARGET_ARCH=x86_64" + else + export MAKEARGS="TARGET_ARCH=i686" + fi + + default +} + +src_install() { + emake DISTDIR="${D}" install + + dodoc "${DOCS[@]}" + dodoc docs/*.{txt,md} + + cd "${ED}" || die + mkdir -p usr/lib/tboot/ || die + mv boot usr/lib/tboot/ || die +} + +pkg_postinst() { + cp "${ROOT}/usr/lib/tboot/boot/"* "${ROOT}/boot/" || die + + ewarn "Please remember to download the SINIT AC Module relevant" + ewarn "for your platform from:" + ewarn "http://software.intel.com/en-us/articles/intel-trusted-execution-technology/" +} diff --git a/sys-boot/uefi-mkconfig/Manifest b/sys-boot/uefi-mkconfig/Manifest new file mode 100644 index 000000000000..daf33019dd62 --- /dev/null +++ b/sys-boot/uefi-mkconfig/Manifest @@ -0,0 +1,3 @@ +DIST uefi-mkconfig-2.3.tar.gz 10295 BLAKE2B cae2301b1c181f87efbb47fbb393184ed383d763932999719223a298062cd802c318aeb9a1e4571483fe872b31ee27c86186a1200531d038e4ffe867ac683361 SHA512 730546552739db386249e0f86bce029ccb2695bd4b065326ae91ae92ab350ee387e46b661514b80728e609aa851a78efdda97a86fd7418c6f0044341c393c452 +DIST uefi-mkconfig-3.3.tar.gz 14444 BLAKE2B 028562cf41ad4e936a60fad695ab9342f9c06f67e8ccb5afaaf72ad1d5cde3938e8b344d64c375b9468c61fb7074645c5f9ab6c8f351ed93215ae0b7d8d96143 SHA512 5a8236edffef7a3de8d463dcca1006bf54f3e86538d3fd797e49ec545056bab4d974b7e64fe9a37110c1cc671d4261197074cbcb35be0744e02a3742ebb8e398 +DIST uefi-mkconfig-3.4.tar.gz 14752 BLAKE2B bfe433937a233e07636c7d9a08ef91ce528ef3d8a2fcbdc045b135d632633236e9b9de9a0c913f301703da66375093868a6fb9630ccb187f6436fada663b7f32 SHA512 148304f8781cbdaf68845eb7db36d83881f653558d797cb8f288d2f8ae31e0f63f194972c6f4cb1b8f718e2d385cf34a4ddca2f41e92ac826631865910abfdb5 diff --git a/sys-boot/uefi-mkconfig/metadata.xml b/sys-boot/uefi-mkconfig/metadata.xml new file mode 100644 index 000000000000..51417dd31740 --- /dev/null +++ b/sys-boot/uefi-mkconfig/metadata.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM 'https://www.gentoo.org/dtd/metadata.dtd'> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>jakub@gdos.sk</email> + <name>Jakub Gajdoš</name> + </maintainer> + <maintainer type="person" proxied="proxy"> + <email>nowa@gentoo.org</email> + <name>Nowa Ammerlaan</name> + </maintainer> + <upstream> + <remote-id type="github">Biosias/uefi-mkconfig</remote-id> + <bugs-to>https://github.com/Biosias/uefi-mkconfig/issues</bugs-to> + </upstream> +</pkgmetadata> diff --git a/sys-boot/uefi-mkconfig/uefi-mkconfig-2.3.ebuild b/sys-boot/uefi-mkconfig/uefi-mkconfig-2.3.ebuild new file mode 100644 index 000000000000..eb46eef391d5 --- /dev/null +++ b/sys-boot/uefi-mkconfig/uefi-mkconfig-2.3.ebuild @@ -0,0 +1,36 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit linux-info optfeature + +DESCRIPTION="Automatic management of UEFI entries" +HOMEPAGE="https://github.com/Biosias/uefi-mkconfig" +SRC_URI="https://github.com/Biosias/uefi-mkconfig/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~x86" + +RDEPEND=" + app-shells/bash + sys-boot/efibootmgr +" + +CONFIG_CHECK="~EFI_STUB" + +src_install() { + dobin uefi-mkconfig + einstalldocs +} + +pkg_postinst() { + elog "uefi-mkconfig: Automatic management of UEFI entries" + elog "Run uefi-mkconfig while having all efi partitions mounted" + elog "Please use with care, this package was tested on a limited number of machines" + elog "Some problems may arise due to different implementations of UEFI" + elog "Don't forget to add kernel commands to the configuration file before using this package!" + elog + optfeature "Add UEFI entries on kernel installation " \ "sys-kernel/installkernel[-systemd,efistub]" +} diff --git a/sys-boot/uefi-mkconfig/uefi-mkconfig-3.3.ebuild b/sys-boot/uefi-mkconfig/uefi-mkconfig-3.3.ebuild new file mode 100644 index 000000000000..b592bd242b4a --- /dev/null +++ b/sys-boot/uefi-mkconfig/uefi-mkconfig-3.3.ebuild @@ -0,0 +1,36 @@ +# Copyright 2024-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit linux-info optfeature + +DESCRIPTION="Automatic management of UEFI entries" +HOMEPAGE="https://github.com/Biosias/uefi-mkconfig" +SRC_URI="https://github.com/Biosias/uefi-mkconfig/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64 ~arm ~arm64 x86" + +RDEPEND=" + app-shells/bash + sys-boot/efibootmgr +" + +CONFIG_CHECK="~EFI_STUB" + +src_install() { + dobin uefi-mkconfig + einstalldocs +} + +pkg_postinst() { + elog "uefi-mkconfig: Automatic management of UEFI entries" + elog "Run uefi-mkconfig while having all efi partitions mounted" + elog "Please use with care, this package was tested on a limited number of machines" + elog "Some problems may arise due to different implementations of UEFI" + elog "Don't forget to add kernel commands to the configuration file before using this package!" + elog + optfeature "Add UEFI entries on kernel installation " \ "sys-kernel/installkernel[-systemd,efistub]" +} diff --git a/sys-boot/uefi-mkconfig/uefi-mkconfig-3.4.ebuild b/sys-boot/uefi-mkconfig/uefi-mkconfig-3.4.ebuild new file mode 100644 index 000000000000..54b9f51239c7 --- /dev/null +++ b/sys-boot/uefi-mkconfig/uefi-mkconfig-3.4.ebuild @@ -0,0 +1,36 @@ +# Copyright 2024-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit linux-info optfeature + +DESCRIPTION="Automatic management of UEFI entries" +HOMEPAGE="https://github.com/Biosias/uefi-mkconfig" +SRC_URI="https://github.com/Biosias/uefi-mkconfig/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64 ~arm arm64 x86" + +RDEPEND=" + app-shells/bash + sys-boot/efibootmgr +" + +CONFIG_CHECK="~EFI_STUB" + +src_install() { + dobin uefi-mkconfig + einstalldocs +} + +pkg_postinst() { + elog "uefi-mkconfig: Automatic management of UEFI entries" + elog "Run uefi-mkconfig while having all efi partitions mounted" + elog "Please use with care, this package was tested on a limited number of machines" + elog "Some problems may arise due to different implementations of UEFI" + elog "Don't forget to add kernel commands to the configuration file before using this package!" + elog + optfeature "Add UEFI entries on kernel installation " \ "sys-kernel/installkernel[-systemd,efistub]" +} diff --git a/sys-boot/ventoy-bin/Manifest b/sys-boot/ventoy-bin/Manifest new file mode 100644 index 000000000000..1eb038e75bdf --- /dev/null +++ b/sys-boot/ventoy-bin/Manifest @@ -0,0 +1 @@ +DIST ventoy-1.0.98-linux.tar.gz 19840507 BLAKE2B 4d1f3c6e727c70ff4c1fda7dcf59467b54d9b50edf880170cd69df2fdab995bcee370635b44be091247d5e687c2a2367c57de33b4e48823cbc5bc33b050cdea2 SHA512 40914e5a13e78b72fe677c99cfa68c0bb46fceddc979a7dd1f1a3e2fa30568f3b21250cbf02df59f4a06373a47a4c181d44e46f7f4eb08f413ad6c24cd2a1a65 diff --git a/sys-boot/ventoy-bin/files/sanitize.patch b/sys-boot/ventoy-bin/files/sanitize.patch new file mode 100644 index 000000000000..ed98be7aa78f --- /dev/null +++ b/sys-boot/ventoy-bin/files/sanitize.patch @@ -0,0 +1,163 @@ +Author: DuckSoft <realducksoft@gmail.com> + +I just cannot stand such a dirty package. +Let me do some optimisations. + +If you are interested to improve this patch, welcome to mail me. + +diff -rup old/tool/ventoy_lib.sh new/tool/ventoy_lib.sh +--- tool/ventoy_lib.sh 2021-12-02 16:59:42.148650182 +0100 ++++ tool/ventoy_lib.sh 2021-12-02 17:01:17.214720518 +0100 +@@ -29,7 +29,7 @@ vterr() { + } + + vtdebug() { +- echo "$*" >> ./log.txt ++ echo "$*" >>/var/log/ventoy.log + } + + vtoy_gen_uuid() { +@@ -52,30 +52,6 @@ vtoy_gen_uuid() { + + check_tool_work_ok() { + +- if echo 1 | hexdump > /dev/null; then +- vtdebug "hexdump test ok ..." +- else +- vtdebug "hexdump test fail ..." +- ventoy_false +- return +- fi +- +- if mkexfatfs -V > /dev/null; then +- vtdebug "mkexfatfs test ok ..." +- else +- vtdebug "mkexfatfs test fail ..." +- ventoy_false +- return +- fi +- +- if vtoycli fat -T; then +- vtdebug "vtoycli fat test ok ..." +- else +- vtdebug "vtoycli fat test fail ..." +- ventoy_false +- return +- fi +- + vtdebug "tool check success ..." + ventoy_true + } +@@ -311,7 +287,7 @@ format_ventoy_disk_mbr() { + else + vtdebug "format disk by fdisk ..." + +-fdisk $DISK >>./log.txt 2>&1 <<EOF ++fdisk $DISK >>/var/log/ventoy.log 2>&1 <<EOF + o + n + p +diff -rup old/tool/VentoyWorker.sh new/tool/VentoyWorker.sh +--- tool/VentoyWorker.sh 2021-12-02 16:59:31.485642239 +0100 ++++ tool/VentoyWorker.sh 2021-12-02 17:02:00.326752183 +0100 +@@ -105,7 +105,7 @@ vtdebug "MODE=$MODE FORCE=$FORCE RESERVE + if check_tool_work_ok; then + vtdebug "check tool work ok" + else +- vterr "Some tools can not run on current system. Please check log.txt for details." ++ vterr "Some tools can not run on current system. Please check /var/log/ventoy.log for details." + exit 1 + fi + +diff -rup old/Ventoy2Disk.sh new/Ventoy2Disk.sh +--- Ventoy2Disk.sh 2021-12-02 16:59:05.205622608 +0100 ++++ Ventoy2Disk.sh 2021-12-02 17:03:29.037816991 +0100 +@@ -32,48 +32,4 @@ echo " https://www.ventoy.net" + echo '**********************************************' + echo '' + +- +-if ! [ -f ./boot/boot.img ]; then +- if [ -d ./grub ]; then +- echo "Don't run Ventoy2Disk.sh here, please download the released install package, and run the script in it." +- else +- echo "Please run under the correct directory!" +- fi +- exit 1 +-fi +- +-echo "############# Ventoy2Disk $* [$TOOLDIR] ################" >> ./log.txt +-date >> ./log.txt +- +-#decompress tool +-echo "decompress tools" >> ./log.txt +-cd ./tool/$TOOLDIR +- +-ls *.xz > /dev/null 2>&1 +-if [ $? -eq 0 ]; then +- [ -f ./xzcat ] && chmod +x ./xzcat +- +- for file in $(ls *.xz); do +- echo "decompress $file" >> ./log.txt +- xzcat $file > ${file%.xz} +- [ -f ./${file%.xz} ] && chmod +x ./${file%.xz} +- [ -f ./$file ] && rm -f ./$file +- done +-fi +- +-cd ../../ +-chmod +x -R ./tool/$TOOLDIR +- +- +-if [ -f /bin/bash ]; then +- /bin/bash ./tool/VentoyWorker.sh $* +-else +- ash ./tool/VentoyWorker.sh $* +-fi +- +-if [ -n "$OLDDIR" ]; then +- CURDIR=$(pwd) +- if [ "$CURDIR" != "$OLDDIR" ]; then +- cd "$OLDDIR" +- fi +-fi ++./tool/VentoyWorker.sh $* +diff -rup old/VentoyPlugson.sh new/VentoyPlugson.sh +--- VentoyPlugson.sh 2022-12-24 06:00:51.000000000 -0700 ++++ VentoyPlugson.sh 2022-12-24 08:18:59.154268575 -0700 +@@ -34,8 +34,6 @@ if echo $machine | grep -E -q 'aarch64|a + TOOLDIR=aarch64 + elif echo $machine | grep -E -q 'x86_64|amd64'; then + TOOLDIR=x86_64 +-elif echo $machine | grep -E -q 'mips64'; then +- TOOLDIR=mips64el + elif echo $machine | grep -E -q 'i[3-6]86'; then + TOOLDIR=i386 + else +diff -rup old/VentoyWeb.sh new/VentoyWeb.sh +--- VentoyWeb.sh 2021-12-02 16:58:51.885612627 +0100 ++++ VentoyWeb.sh 2021-12-02 17:04:43.437871014 +0100 +@@ -15,12 +15,6 @@ print_err() { + echo "" + } + +-uid=$(id -u) +-if [ $uid -ne 0 ]; then +- print_err "Please use sudo or run the script as root." +- exit 1 +-fi +- + OLDDIR=$(pwd) + + if uname -m | egrep -q 'aarch64|arm64'; then +@@ -85,8 +79,8 @@ if ps -ef | grep "V2DServer.*$HOST.*$POR + exit 1 + fi + +-LOGFILE=log.txt +-#delete the log.txt if it's more than 8MB ++LOGFILE=/var/log/ventoy.log ++#delete the ventoy.log if it's more than 8MB + if [ -f $LOGFILE ]; then + logsize=$(stat -c '%s' $LOGFILE) + if [ $logsize -gt 8388608 ]; then diff --git a/sys-boot/ventoy-bin/files/ventoy b/sys-boot/ventoy-bin/files/ventoy new file mode 100644 index 000000000000..b6feeaa81b1d --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoy @@ -0,0 +1,4 @@ +#!/bin/sh + +cd /opt/ventoy || exit 1 +exec ./Ventoy2Disk.sh "$@" diff --git a/sys-boot/ventoy-bin/files/ventoy-extend-persistent b/sys-boot/ventoy-bin/files/ventoy-extend-persistent new file mode 100644 index 000000000000..9616aa3a3d15 --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoy-extend-persistent @@ -0,0 +1,3 @@ +#!/bin/sh + +exec /opt/ventoy/ExtendPersistentImg.sh "$@" diff --git a/sys-boot/ventoy-bin/files/ventoy-persistent b/sys-boot/ventoy-bin/files/ventoy-persistent new file mode 100644 index 000000000000..c955fb6f158f --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoy-persistent @@ -0,0 +1,3 @@ +#!/bin/sh + +exec /opt/ventoy/CreatePersistentImg.sh "$@" diff --git a/sys-boot/ventoy-bin/files/ventoy.desktop b/sys-boot/ventoy-bin/files/ventoy.desktop new file mode 100644 index 000000000000..f74c7739cf8a --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoy.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Icon=ventoy +Name=Ventoy +Exec=ventoygui +Terminal=false +Hidden=false +Categories=Utility +Comment=Ventoy2Disk GUI diff --git a/sys-boot/ventoy-bin/files/ventoy.install b/sys-boot/ventoy-bin/files/ventoy.install new file mode 100644 index 000000000000..7ff7012f41a9 --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoy.install @@ -0,0 +1,17 @@ +post_install() { + printf "$(tput setaf 4) ->$(tput sgr0; tput bold) %s$(tput sgr0)\n" \ + 'NOTE: You can create persistence images for ventoy with the "ventoy-persistent" command,' + printf "$(tput setaf 4) ->$(tput sgr0; tput bold) %s$(tput sgr0)\n" \ + ' and losslessly expand persistence ".dat" files using "ventoy-extend-persistent",' + printf "$(tput setaf 4) ->$(tput sgr0; tput bold) %s$(tput sgr0)\n" \ + ' which are shortcuts to "/opt/ventoy/CreatePersistentImg.sh" and' + printf "$(tput setaf 4) ->$(tput sgr0; tput bold) %s$(tput sgr0)\n" \ + ' "/opt/ventoy/ExtendPersistentImg.sh", respectively.' + printf "$(tput setaf 4) ->$(tput sgr0; tput bold) %s$(tput sgr0)\n" \ + ' (See https://www.ventoy.net/en/plugin_persistence.html for documentation.)' +} + +post_remove() { + # Remove log file + rm -rf /opt/ventoy/ +} diff --git a/sys-boot/ventoy-bin/files/ventoygui b/sys-boot/ventoy-bin/files/ventoygui new file mode 100644 index 000000000000..887535f72f76 --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoygui @@ -0,0 +1,9 @@ +#!/bin/sh + +cd /opt/ventoy || exit 1 + +if [ "$(uname -m)" = "x86_64" ]; then + ./VentoyGUI.x86_64 "$@" +elif [ "$(uname -m)" = "aarch64" ]; then + ./VentoyGUI.aarch64 "$@" +fi diff --git a/sys-boot/ventoy-bin/files/ventoyplugson b/sys-boot/ventoy-bin/files/ventoyplugson new file mode 100644 index 000000000000..f1e7b2d362b4 --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoyplugson @@ -0,0 +1,4 @@ +#!/bin/sh + +cd /opt/ventoy || exit 1 +exec ./VentoyPlugson.sh "$@" diff --git a/sys-boot/ventoy-bin/files/ventoyweb b/sys-boot/ventoy-bin/files/ventoyweb new file mode 100644 index 000000000000..fefe649136c6 --- /dev/null +++ b/sys-boot/ventoy-bin/files/ventoyweb @@ -0,0 +1,4 @@ +#!/bin/sh + +cd /opt/ventoy || exit 1 +exec ./VentoyWeb.sh "$@" diff --git a/sys-boot/ventoy-bin/metadata.xml b/sys-boot/ventoy-bin/metadata.xml new file mode 100644 index 000000000000..03be99ae4dd2 --- /dev/null +++ b/sys-boot/ventoy-bin/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!-- maintainer-needed --> + <upstream> + <remote-id type="github">ventoy/Ventoy</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/ventoy-bin/ventoy-bin-1.0.98-r1.ebuild b/sys-boot/ventoy-bin/ventoy-bin-1.0.98-r1.ebuild new file mode 100644 index 000000000000..c19679fb9196 --- /dev/null +++ b/sys-boot/ventoy-bin/ventoy-bin-1.0.98-r1.ebuild @@ -0,0 +1,96 @@ +# Copyright 2024-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit desktop xdg + +DESCRIPTION="Creator of bootable USBs, with ability to copy ISOs, persistence storage" +HOMEPAGE="https://www.ventoy.net" +SRC_URI="https://github.com/ventoy/Ventoy/releases/download/v${PV}/ventoy-${PV}-linux.tar.gz" + +S="${WORKDIR}"/ventoy-${PV} + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64" + +RESTRICT="strip mirror" + +RDEPEND=" + app-accessibility/at-spi2-core:2 + dev-libs/glib:2 + sys-fs/dosfstools + || ( sys-fs/exfatprogs sys-fs/exfat-utils ) + sys-fs/fuse-exfat + sys-block/parted + x11-libs/cairo + x11-libs/gdk-pixbuf:2 + x11-libs/gtk+:3 + x11-libs/pango +" +# sys-fs/fuse-exfat is needed for mount, without it: +# mount: /mnt: unknown filesystem type 'exfat' + +QA_PREBUILT="*" # Against "does not respect LDFLAGS" + +CARCH="x86_64" + +src_prepare() { + # Decompress tools + pushd tool/$CARCH || die + for file in *.xz; do + xzcat "$file" >"${file%.xz}" || die + chmod +x "${file%.xz}" || die + done + + # Cleanup .xz crap + rm -fv ./*.xz || die + popd || die + + # Apply sanitize patch + eapply -p0 "${FILESDIR}/sanitize.patch" + + # Log location + sed -i 's|log\.txt|/var/log/ventoy.log|g' WebUI/static/js/languages.js tool/languages.json || die + + # Non-POSIX compliant scripts + sed -i 's|bin/sh|usr/bin/env bash|g' tool/{ventoy_lib.sh,VentoyWorker.sh} || die + + # Clean up unused binaries + # Preserving mkexfatfs and mount.exfat-fuse because exfatprogs is incompatible + for binary in xzcat hexdump; do + rm -fv tool/$CARCH/$binary || die + done + default +} + +src_install() { + insopts -m0644 + insinto /opt/ventoy/boot/ + doins boot/* + insinto /opt/ventoy/ventoy/ + doins ventoy/* + insopts -m0755 + insinto /opt/ventoy/tool/ + doins tool/*.{cer,glade,json,sh,xz} + insinto /opt/ventoy/tool/$CARCH/ + doins tool/$CARCH/* + insinto /opt/ventoy/ + doins ./*.sh plugin WebUI "VentoyGUI.$CARCH" + + # Install .desktop + insopts -m0644 + insinto /usr/share/pixmaps/ + newins WebUI/static/img/VentoyLogo.png ventoy.png + domenu "${FILESDIR}/ventoy.desktop" + + # Link system binaries + for binary in xzcat hexdump; do + dosym -r /usr/bin/$binary /opt/ventoy/tool/$CARCH/$binary + done + + dobin "${FILESDIR}"/ventoy{,gui,web,plugson,-{,extend-}persistent} + + rm "${D}"/opt/ventoy/tool/x86_64/Ventoy2Disk.gtk2 || die +} diff --git a/sys-boot/woeusb-ng/Manifest b/sys-boot/woeusb-ng/Manifest new file mode 100644 index 000000000000..cc515198d1a7 --- /dev/null +++ b/sys-boot/woeusb-ng/Manifest @@ -0,0 +1 @@ +DIST woeusb-ng-0.2.12.tar.gz 219102 BLAKE2B d146697ce4143adc62b489a5dbd09bd2dd02d910a51357a27b1a92663eee279c6fa3bdd39b0f01e46f445cb0170c3b0dbf37ed7fdc442386247ff2acb85791e8 SHA512 3323d1f33f3c009652555ca20827d3ab902a59c21b4e57725ac7efb702c60c8ab8a572f77c7f5e4da91713ea5412811358870d6100e13e5828421645b7464c38 diff --git a/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-fix-pkg-discovery.patch b/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-fix-pkg-discovery.patch new file mode 100644 index 000000000000..33d84aa3179b --- /dev/null +++ b/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-fix-pkg-discovery.patch @@ -0,0 +1,28 @@ +Fix setuptools package discovery issues by using custom discovery. + +``` +/usr/lib/python3.12/site-packages/setuptools/command/build_py.py:212: _Warning: Package 'WoeUSB.data' is absent from the `packages` configuration. + ``` + +There's an open PR to improve the packaging methods. +https://github.com/WoeUSB/WoeUSB-ng/pull/79 +--- a/setup.py ++++ b/setup.py +@@ -2,7 +2,7 @@ import os + import shutil + import stat + +-from setuptools import setup ++from setuptools import setup, find_namespace_packages + from setuptools.command.develop import develop + from setuptools.command.install import install + +@@ -57,7 +57,7 @@ setup( + author_email='jakubmateusz@poczta.onet.pl', + license='GPL-3', + zip_safe=False, +- packages=['WoeUSB'], ++ packages=find_namespace_packages(exclude=['doc', 'miscellaneous']), + include_package_data=True, + scripts=[ + 'WoeUSB/woeusb', diff --git a/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-python3.12.patch b/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-python3.12.patch new file mode 100644 index 000000000000..dfda16cdb417 --- /dev/null +++ b/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-python3.12.patch @@ -0,0 +1,16 @@ +https://github.com/WoeUSB/WoeUSB-ng/pull/134 +Fix invalid escape sequence +\. is not a valid escape sequence since Python 3.12 and generates a warning. +It will become an error in a future version. +https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes +--- a/WoeUSB/workaround.py ++++ b/WoeUSB/workaround.py +@@ -52,7 +52,7 @@ def support_windows_7_uefi_boot(source_fs_mountpoint, target_fs_mountpoint): + :param target_fs_mountpoint: + :return: + """ +- grep = subprocess.run(["grep", "--extended-regexp", "--quiet", "^MinServer=7[0-9]{3}\.[0-9]", ++ grep = subprocess.run(["grep", "--extended-regexp", "--quiet", r"^MinServer=7[0-9]{3}\.[0-9]", + source_fs_mountpoint + "/sources/cversion.ini"], + stdout=subprocess.PIPE).stdout.decode("utf-8").strip() + if grep == "" and not os.path.isfile(source_fs_mountpoint + "/bootmgr.efi"): diff --git a/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-skip-postinstall.patch b/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-skip-postinstall.patch new file mode 100644 index 000000000000..3f632d3db67c --- /dev/null +++ b/sys-boot/woeusb-ng/files/woeusb-ng-0.2.12-skip-postinstall.patch @@ -0,0 +1,13 @@ +Prevent installing files to hardcoded locations. + +There's an open PR to improve the packaging methods. +https://github.com/WoeUSB/WoeUSB-ng/pull/79 +--- a/setup.py ++++ b/setup.py +@@ -68,6 +68,5 @@ setup( + ], + cmdclass={ + 'develop': PostDevelopCommand, +- 'install': PostInstallCommand + } + ) diff --git a/sys-boot/woeusb-ng/metadata.xml b/sys-boot/woeusb-ng/metadata.xml new file mode 100644 index 000000000000..bbe0695f9f03 --- /dev/null +++ b/sys-boot/woeusb-ng/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>pastalian46@gmail.com</email> + <name>Takuya Wakazono</name> + </maintainer> + <maintainer type="project" proxied="proxy"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <upstream> + <remote-id type="github">WoeUSB/WoeUSB-ng</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/woeusb-ng/woeusb-ng-0.2.12-r1.ebuild b/sys-boot/woeusb-ng/woeusb-ng-0.2.12-r1.ebuild new file mode 100644 index 000000000000..ffc8e011f13a --- /dev/null +++ b/sys-boot/woeusb-ng/woeusb-ng-0.2.12-r1.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +DISTUTILS_SINGLE_IMPL=1 +PYTHON_COMPAT=( python3_{13..14} ) + +inherit desktop distutils-r1 optfeature xdg + +MY_PN="WoeUSB-ng" +DESCRIPTION="Create a Windows USB stick installer from an iso image (rewrite of WoeUSB)" +HOMEPAGE="https://github.com/WoeUSB/WoeUSB-ng" +SRC_URI="https://github.com/WoeUSB/WoeUSB-ng/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${MY_PN}-${PV}" + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="amd64" +IUSE="gui" + +RDEPEND=" + !sys-boot/woeusb + || ( + >=app-arch/7zip-24.09[symlink(+)] + app-arch/p7zip + ) + sys-apps/util-linux + sys-block/parted + sys-boot/grub:2 + sys-fs/dosfstools + sys-fs/ntfs3g[ntfsprogs] + $(python_gen_cond_dep ' + dev-python/termcolor[${PYTHON_USEDEP}] + gui? ( dev-python/wxpython:4.0[${PYTHON_USEDEP}] ) + ') +" + +PATCHES=( + "${FILESDIR}"/${P}-fix-pkg-discovery.patch + "${FILESDIR}"/${P}-python3.12.patch + "${FILESDIR}"/${P}-skip-postinstall.patch +) + +src_prepare() { + distutils-r1_src_prepare + python_fix_shebang WoeUSB + + # fix hardcoded org.freedesktop.policykit.exec.path + sed -i "s|/usr/local/bin|${EPREFIX}/usr/bin|" \ + miscellaneous/com.github.woeusb.woeusb-ng.policy \ + WoeUSB/utils.py || die +} + +src_install() { + distutils-r1_src_install + + if use gui; then + dobin WoeUSB/woeusbgui + + insinto /usr/share/polkit-1/actions + doins miscellaneous/com.github.woeusb.woeusb-ng.policy + + doicon -s 256 WoeUSB/data/woeusb-logo.png + make_desktop_entry woeusbgui WoeUSB-ng woeusb-logo Utility + fi +} + +pkg_postinst() { + xdg_pkg_postinst + optfeature "Legacy PC bootmode support" "sys-boot/grub:2[grub_platforms_pc]" +} diff --git a/sys-boot/yaboot-static/Manifest b/sys-boot/yaboot-static/Manifest new file mode 100644 index 000000000000..77a7d03ac7d5 --- /dev/null +++ b/sys-boot/yaboot-static/Manifest @@ -0,0 +1 @@ +DIST yaboot-static-1.3.17.tbz2 162142 BLAKE2B ddaa1e01c08b926a0fb295e350ba8a80a0b2c5d0cc7a8346d05e7e6c7441b9748f781a82382afcaad770ed04ebd4e3032bd16e605b8ad984b13ab9564500890a SHA512 23caf8d7308aba7402f13fc558e2182f63317fa7cf502899503247d2d2b8741b8327b447a50edce775eed0ea02fed5b675f4b40c8bafd956cbd25662c9f2ad72 diff --git a/sys-boot/yaboot-static/files/new-ofpath-devspec.patch b/sys-boot/yaboot-static/files/new-ofpath-devspec.patch new file mode 100644 index 000000000000..822173904ad3 --- /dev/null +++ b/sys-boot/yaboot-static/files/new-ofpath-devspec.patch @@ -0,0 +1,30 @@ +Fix the devspec path on newer kernels + +--- a/usr/sbin/ofpath ++++ b/usr/sbin/ofpath +@@ -85,11 +85,20 @@ + [ "$DEBUG" = 1 ] && echo "Devpath is: $DEVPATH" + + ### Get the OF Path of the controller +-case ${DISK_NAME} in +- sd*|sg*|sr*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../../devspec) ;; +- hd*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../devspec) ;; +- *) CONTROLLER_PATH="" ;; +-esac ++if [ -e "${DEVPATH}/../../devspec" ]; then ++ ### /dev/hd* ++ CONTROLLER_PATH=$(cat ${DEVPATH}/../../devspec); ++elif [ -e "${DEVPATH}/../../../devspec" ]; then ++ ### /dev/sd* on kernel <3.3 ++ CONTROLLER_PATH=$(cat ${DEVPATH}/../../../devspec); ++elif [ -e "${DEVPATH}/../../../../devspec" ]; then ++ ### /dev/sd* on kernel 3.3+ ++ CONTROLLER_PATH=$(cat ${DEVPATH}/../../../../devspec); ++else ++ ### None of the above... ++ CONTROLLER_PATH=""; ++fi ++ + if [ -z "$CONTROLLER_PATH" ]; then + echo "Unable to determine controller path!" + exit 1 diff --git a/sys-boot/yaboot-static/metadata.xml b/sys-boot/yaboot-static/metadata.xml new file mode 100644 index 000000000000..675be6dd398c --- /dev/null +++ b/sys-boot/yaboot-static/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>ppc@gentoo.org</email> + <name>PowerPC architecture team</name> +</maintainer> +</pkgmetadata> diff --git a/sys-boot/yaboot-static/yaboot-static-1.3.17-r2.ebuild b/sys-boot/yaboot-static/yaboot-static-1.3.17-r2.ebuild new file mode 100644 index 000000000000..cf88b3abb22c --- /dev/null +++ b/sys-boot/yaboot-static/yaboot-static-1.3.17-r2.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Generated by using quickpkg on a ppc32 machine, compiled with -O2 -pipe. + +EAPI=7 + +DESCRIPTION="Static yaboot ppc boot loader for machines with open firmware" +HOMEPAGE="http://yaboot.ozlabs.org/" +SRC_URI="mirror://gentoo/yaboot-static-${PV}.tbz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* ppc ppc64" +IUSE="ibm" + +DEPEND="" +RDEPEND=" + !sys-boot/yaboot + sys-apps/ibm-powerpc-utils + !ibm? ( + sys-fs/hfsutils + sys-fs/hfsplusutils + sys-fs/mac-fdisk + )" + +S=${WORKDIR} + +QA_PRESTRIPPED=" + /usr/lib/yaboot/yaboot + /usr/lib/yaboot/yaboot.chrp + /usr/lib/yaboot/addnote +" + +src_prepare() { + default + eapply "${FILESDIR}/new-ofpath-devspec.patch" +} + +src_install() { + cp -pPR "${WORKDIR}"/* "${D}" || die +} diff --git a/sys-boot/yaboot/Manifest b/sys-boot/yaboot/Manifest new file mode 100644 index 000000000000..70d55ac518fe --- /dev/null +++ b/sys-boot/yaboot/Manifest @@ -0,0 +1,2 @@ +DIST e2fsprogs-1.42.13.tar.gz 6511931 BLAKE2B 2f849e82ad366f86d9d166f1901a99a8ac0ddc94471a29fb0de9132ae2ba8f8dc0f4c143acf889afdaa1daf1c57e7bf545a2b4e15ebb8463667f2768a8bc2ebb SHA512 d341790f55c3bff34425369063757280b9ba6ac08f405e14f94f299345ae76c0dc6e90871b746cc98c73467448d888fe5bc029688b5eed5fd22c3c37bf285cd0 +DIST yaboot-1.3.17.tar.gz 224325 BLAKE2B 41f96266f2342eebbfdc3c0eb64eeaf59e55a31d7388f86839cf9318d231ef808d3aa16fb3b3fdfe85a6fca743e191d064f0ed633723f135a7ca25483e460566 SHA512 da910c4c6ca2de817342bf4dbcefe2857606043e614782581a86bae206cf6cfe5597ad47aea15369feb60e02d8a4f9f4aa3b12863d715c757584c1f4d7ffb9de diff --git a/sys-boot/yaboot/files/chrpfix.patch b/sys-boot/yaboot/files/chrpfix.patch new file mode 100644 index 000000000000..59ea7a072633 --- /dev/null +++ b/sys-boot/yaboot/files/chrpfix.patch @@ -0,0 +1,23 @@ +--- a/Makefile.orig 2004-03-22 12:04:32.056149336 -0600 ++++ b/Makefile 2004-03-22 12:05:51.824138328 -0600 +@@ -103,9 +103,11 @@ + + all: yaboot addnote mkofboot + +-yaboot: $(OBJS) ++yaboot: $(OBJS) addnote + $(LD) $(LFLAGS) $(OBJS) $(LLIBS) $(lgcc) -o second/$@ + chmod -x second/yaboot ++ cp second/yaboot second/yaboot.chrp ++ util/addnote second/yaboot.chrp + + addnote: + $(CC) $(UCFLAGS) -o util/addnote util/addnote.c +@@ -185,6 +187,7 @@ + install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/ + install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man8/ + install -o root -g root -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot ++ install -o root -g root -m 0644 second/yaboot.chrp ${ROOT}/$(PREFIX)/lib/yaboot + install -o root -g root -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote + install -o root -g root -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot + install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath diff --git a/sys-boot/yaboot/files/e2fsprogs-1.42.13-sysmacros.h.patch b/sys-boot/yaboot/files/e2fsprogs-1.42.13-sysmacros.h.patch new file mode 100644 index 000000000000..8bf887026ead --- /dev/null +++ b/sys-boot/yaboot/files/e2fsprogs-1.42.13-sysmacros.h.patch @@ -0,0 +1,85 @@ +From 3fb715b55426875902dfef3056b2cf7335953178 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Fri, 19 May 2017 13:25:59 -0400 +Subject: [PATCH] include sys/sysmacros.h as needed + +The minor/major/makedev macros are not entirely standard. glibc has had +the definitions in sys/sysmacros.h since the start, and wants to move away +from always defining them implicitly via sys/types.h (as this pollutes the +namespace in violation of POSIX). Other C libraries have already dropped +them. Since the configure script already checks for this header, use that +to pull in the header in files that use these macros. + +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +Signed-off-by: Theodore Ts'o <tytso@mit.edu> +--- + lib/blkid/devname.c | 3 +++ + lib/blkid/devno.c | 3 +++ + lib/ext2fs/finddev.c | 3 +++ + lib/ext2fs/ismounted.c | 3 +++ + misc/mk_hugefiles.c | 3 +++ + 7 files changed, 22 insertions(+) + +--- a/lib/blkid/devname.c ++++ b/lib/blkid/devname.c +@@ -36,6 +36,9 @@ + #if HAVE_SYS_MKDEV_H + #include <sys/mkdev.h> + #endif ++#ifdef HAVE_SYS_SYSMACROS_H ++#include <sys/sysmacros.h> ++#endif + #include <time.h> + + #include "blkidP.h" +--- a/lib/blkid/devno.c ++++ b/lib/blkid/devno.c +@@ -31,6 +31,9 @@ + #if HAVE_SYS_MKDEV_H + #include <sys/mkdev.h> + #endif ++#ifdef HAVE_SYS_SYSMACROS_H ++#include <sys/sysmacros.h> ++#endif + + #include "blkidP.h" + +--- a/lib/ext2fs/finddev.c ++++ b/lib/ext2fs/finddev.c +@@ -31,6 +31,9 @@ + #if HAVE_SYS_MKDEV_H + #include <sys/mkdev.h> + #endif ++#ifdef HAVE_SYS_SYSMACROS_H ++#include <sys/sysmacros.h> ++#endif + + #include "ext2_fs.h" + #include "ext2fs.h" +--- a/lib/ext2fs/ismounted.c ++++ b/lib/ext2fs/ismounted.c +@@ -49,6 +49,9 @@ + #endif /* HAVE_GETMNTINFO */ + #include <string.h> + #include <sys/stat.h> ++#ifdef HAVE_SYS_SYSMACROS_H ++#include <sys/sysmacros.h> ++#endif + + #include "ext2_fs.h" + #include "ext2fs.h" +--- a/misc/mk_hugefiles.c ++++ b/misc/mk_hugefiles.c +@@ -35,6 +35,9 @@ extern int optind; + #include <sys/ioctl.h> + #include <sys/types.h> + #include <sys/stat.h> ++#ifdef HAVE_SYS_SYSMACROS_H ++#include <sys/sysmacros.h> ++#endif + #include <libgen.h> + #include <limits.h> + #include <blkid/blkid.h> +-- +2.20.1 + diff --git a/sys-boot/yaboot/files/new-ofpath b/sys-boot/yaboot/files/new-ofpath new file mode 100644 index 000000000000..5e395b251a8e --- /dev/null +++ b/sys-boot/yaboot/files/new-ofpath @@ -0,0 +1,143 @@ +#!/bin/sh +############################################################################### +# Determines the Open Firmware path based on the linux device name +# +# Joseph Jezak <josejx@gentoo.org> Copyright (C) 2010 +# Rewrite of OFPath for newer kernels/scsi configurations +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################### + +### Set this to 1 to turn on debugging messages +DEBUG=0 + +### Find the device tree +if [ ! -e /proc/device-tree ]; then + echo 1>&2 "ofpath: Cannot find the device tree!" + exit 1 +fi +DEV_TREE="/proc/device-tree" + +### Check if sys is mounted +if ! (grep -q '.* .* sysfs ' /proc/mounts 2> /dev/null) ; then + echo 1>&2 "ofpath: sysfs must be mounted for ofpath to support this system" + exit 1 +fi + +### Get the sysfs mount point +SYS="$(m=`grep '.* .* sysfs ' /proc/mounts | head -n 1` ; echo `d=${m#* };echo ${d%% *}`)" +if [ -z "$SYS" -o ! -d "$SYS" ] ; then + echo 1>&2 "ofpath: Unable to determine sysfs mountpoint" + exit 1 +fi + + +### Get the device from the user +### We dereference links to support devices like /dev/cdrom1 +DEVICE=$1 +if [ -z "$DEVICE" ]; then + echo 1>&2 "ofpath: No device specified!" + exit 1 +fi +DEVICE=$(readlink -f "$DEVICE") +DEVICE=$(basename $DEVICE) +if [ -z "$DEVICE" ] || [ ! -e "/dev/$DEVICE" ]; then + echo 1>&2 "ofpath: Invalid device: /dev/$DEVICE" + exit 1 +fi +[ "$DEBUG" = 1 ] && echo "Device is: $DEVICE" + +### Get the partition if we have it +case ${DEVICE} in + sd*) PARTITION="${DEVICE#sd?}" ;; + ### No partition for sr/sg devices + sr*|sg*) PARTITION="${DEVICE#sr?}" ;; + hd*) PARTITION="${DEVICE#hd?}" ;; + *) echo "Unknown device string."; exit 1;; +esac +if [ ! -z "$PARTITION" ] && [ "$DEBUG" = 1 ]; then + echo "Partition: $PARTITION" +fi + +### Get the disk device name +DISK_NAME="${DEVICE%%${PARTITION}}" +[ "$DEBUG" = 1 ] && echo "Disk Name: $DISK_NAME" + +### Find the devspec for the controller +DEVPATH=$(cd -P "$SYS/block/${DISK_NAME}/device" && pwd) +if [ -z "$DEVPATH" ]; then + echo "Unable to determine device path!" + exit 1 +fi +[ "$DEBUG" = 1 ] && echo "Devpath is: $DEVPATH" + +### Get the OF Path of the controller +case ${DISK_NAME} in + sd*|sg*|sr*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../../devspec) ;; + hd*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../devspec) ;; + *) CONTROLLER_PATH="" ;; +esac +if [ -z "$CONTROLLER_PATH" ]; then + echo "Unable to determine controller path!" + exit 1 +fi +[ "$DEBUG" = 1 ] && echo "Controller Path is: $CONTROLLER_PATH" + +### Generate the disk number and partition info +case ${DISK_NAME} in + sd*|sg*|sr*) + DISK_NO="$(cd ${DEVPATH}/../; pwd)"; + DISK_NO="${DISK_NO##*:}"; + ;; + hd*) + DISK_NO="$(cd ${DEVPATH}/../; pwd)"; + DISK_NO="${DISK_NO##*ide}"; + ;; + *) echo "Unsupported disk type!"; exit 1 ;; +esac +DISK_NO="disk@${DISK_NO}:" +[ "$DEBUG" = 1 ] && echo "Disk Number: ${DISK_NO}" + +### We need to get the controller port path (if it has one) +if [ ! -d "$DEV_TREE/$CONTROLLER_PATH/disk" ] && [ ! -d "$DEV_TREE/$CONTROLLER_PATH/$DISK_NO" ]; then + ### FIXME I don't know if every scsi device uses the host nomenclature + case ${DISK_NAME} in + sd*|sg*|sr*) + PORT="$(cd ${DEVPATH}/../../; pwd)"; + PORT="${PORT##*host}"; + CTL_PORT="${CONTROLLER_PATH##*/}"; + CTL_PORT="${CTL_PORT%%-root*}"; + PORT="$CTL_PORT@$PORT" + [ "$DEBUG" = 1 ] && echo "Port: $PORT" + ;; + *) echo "Unsupported disk type!"; exit 1 ;; + esac +fi + +### Add the partition information if required +if [ ! -z $PARTITION ]; then + DISK_NO="$DISK_NO$PARTITION" +fi + +### Build the OF Path +if [ -z "$PORT" ]; then + OFPATH="$CONTROLLER_PATH/$DISK_NO" +else + OFPATH="$CONTROLLER_PATH/${PORT}/$DISK_NO" +fi + +### Print out the ofpath +echo $OFPATH diff --git a/sys-boot/yaboot/files/new-ofpath-devspec.patch b/sys-boot/yaboot/files/new-ofpath-devspec.patch new file mode 100644 index 000000000000..e9ad749d8f06 --- /dev/null +++ b/sys-boot/yaboot/files/new-ofpath-devspec.patch @@ -0,0 +1,28 @@ +--- a/ybin/ofpath.bak 2012-05-09 12:24:51.709911981 -0400 ++++ b/ybin/ofpath 2012-05-09 12:32:19.661560544 -0400 +@@ -85,11 +85,20 @@ + [ "$DEBUG" = 1 ] && echo "Devpath is: $DEVPATH" + + ### Get the OF Path of the controller +-case ${DISK_NAME} in +- sd*|sg*|sr*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../../devspec) ;; +- hd*) CONTROLLER_PATH=$(cat ${DEVPATH}/../../devspec) ;; +- *) CONTROLLER_PATH="" ;; +-esac ++if [ -e "${DEVPATH}/../../devspec" ]; then ++ ### /dev/hd* ++ CONTROLLER_PATH=$(cat ${DEVPATH}/../../devspec); ++elif [ -e "${DEVPATH}/../../../devspec" ]; then ++ ### /dev/sd* on kernel <3.3 ++ CONTROLLER_PATH=$(cat ${DEVPATH}/../../../devspec); ++elif [ -e "${DEVPATH}/../../../../devspec" ]; then ++ ### /dev/sd* on kernel 3.3+ ++ CONTROLLER_PATH=$(cat ${DEVPATH}/../../../../devspec); ++else ++ ### None of the above... ++ CONTROLLER_PATH=""; ++fi ++ + if [ -z "$CONTROLLER_PATH" ]; then + echo "Unable to determine controller path!" + exit 1 diff --git a/sys-boot/yaboot/files/yaboot-1.3.17-nopiessp-gcc4.patch b/sys-boot/yaboot/files/yaboot-1.3.17-nopiessp-gcc4.patch new file mode 100644 index 000000000000..1ab2a3eecc3e --- /dev/null +++ b/sys-boot/yaboot/files/yaboot-1.3.17-nopiessp-gcc4.patch @@ -0,0 +1,38 @@ +disable ssp usage in yaboot itself + +unfortunately, since we link against external libs that themselves were built +with ssp turned on, we have to provide stubs to keep the linking from failing + +--- yaboot-1.3.13/Config.gentoo ++++ yaboot-1.3.13/Config.gentoo +@@ -0,0 +1,6 @@ ++check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ ++ then echo "$(1)"; else echo "$(2)"; fi) ++ ++CFLAGS += $(call check_gcc, -fno-stack-protector) ++CFLAGS += $(call check_gcc, --nopie) ++ +--- yaboot-1.3.13/Makefile ++++ yaboot-1.3.13/Makefile +@@ -1,6 +1,7 @@ + ## Setup + + include Config ++include Config.gentoo + + VERSION = 1.3.13 + # Debug mode (spam/verbose) +@@ -79,7 +80,7 @@ HOSTCFLAGS = -O2 $(CFLAGS) -Wall -I/usr/ + second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o \ + second/iso_util.o \ + lib/nonstd.o \ +- lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o ++ lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o lib/ssp.o + + ifeq ($(USE_MD5_PASSWORDS),y) + OBJS += second/md5.o +--- yaboot-1.3.14/lib/ssp.c ++++ yaboot-1.3.14/lib/ssp.c +@@ -0,0 +1,2 @@ ++void __stack_chk_fail(void) {} ++void __stack_chk_fail_local(void) {} diff --git a/sys-boot/yaboot/files/yaboot-stubfuncs.patch b/sys-boot/yaboot/files/yaboot-stubfuncs.patch new file mode 100644 index 000000000000..ba6fcc7b3606 --- /dev/null +++ b/sys-boot/yaboot/files/yaboot-stubfuncs.patch @@ -0,0 +1,231 @@ +Stub out some functions that are not provided (and unneeded) + +--- a/lib/malloc.c ++++ b/lib/malloc.c +@@ -64,6 +64,15 @@ void *malloc (unsigned int size) + return caddr; + } + ++/* Calloc wrapper for malloc */ ++void *memset(void *s, int c, size_t n); ++void *calloc(size_t nmemb, size_t size) { ++ void *caddr; ++ caddr = malloc(nmemb * size); ++ memset(caddr, 0, nmemb * size); ++ return caddr; ++} ++ + /* Do not fall back to the malloc above as posix_memalign is needed by + * external libraries not yaboot */ + int posix_memalign(void **memptr, size_t alignment, size_t size) +--- a/lib/nonstd.c ++++ b/lib/nonstd.c +@@ -65,3 +65,208 @@ + { + return NULL; + } ++ ++int lseek(int fd, int offset, int whence) { ++ // XXX: This whence addition seems wrong .. ++ return prom_lseek((void *)fd, whence + offset); ++} ++ ++int lseek64(int fd, int64_t offset, int whence) { ++ return lseek(fd, offset, whence); ++} ++ ++int open(const char *pathname, int flags) { ++ return (int) prom_open((char *)pathname); ++} ++ ++int open64(const char *pathname, int flags) { ++ return open(pathname, flags); ++} ++ ++// Internal glibc fortify calls. ++int __open64_2(const char *path, int flags) { ++ return open64(path, flags); ++} ++ ++int read(int fd, void *buf, size_t count) { ++ return prom_read((void *)fd, buf, count); ++} ++ ++int write(int fd, const void *buf, size_t count) { ++ return prom_write((void *)fd, (void *)buf, count); ++} ++ ++int close(int fd) { ++ prom_close((void *)fd); ++ return 0; ++} ++ ++int pread(int fd, void *buf, size_t count, int32_t offset) { ++ int curr = lseek(fd, 0, 0 /*SEEK_CUR*/); ++ lseek(fd, offset, 0 /*SEEK_SET*/); ++ int ret = read(fd, buf, count); ++ lseek(fd, curr, 0 /*SEEK_SET*/); ++ return ret; ++} ++ ++int pread64(int fd, void *buf, int64_t count, int64_t offset) { ++ return pread(fd, buf, count, offset); ++} ++ ++int pwrite(int fd, const void *buf, size_t count, int32_t offset) { ++ int curr = lseek(fd, 0, 0 /*SEEK_CUR*/); ++ lseek(fd, offset, 0 /*SEEK_SET*/); ++ int ret = write(fd, buf, count); ++ lseek(fd, curr, 0 /*SEEK_SET*/); ++ return ret; ++} ++ ++int pwrite64(int fd, const void *buf, int64_t count, int64_t offset) { ++ return pwrite(fd, buf, count, offset); ++} ++ ++// No fsync, just assume we've sync'd ++int fsync(int fd) { ++ return 0; ++} ++ ++// ext2 libs only use this to turn off caches currently ++int fcntl(int fd, int cmd, ...) { ++ return 0; ++} ++ ++void exit(int status) { ++ prom_exit(); ++} ++ ++int __printf_chk(int flag, const char *format, ...) { ++ va_list ap; ++ va_start (ap, format); ++ prom_vfprintf (prom_stdout, format, ap); ++ va_end (ap); ++ ++ return 0; ++} ++ ++int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) { ++ va_list ap; ++ va_start(ap, format); ++ // No sprintf? :( ++ va_end(ap); ++ return 0; ++ ++} ++ ++int __fprintf_chk(FILE *stream, int flag, const char *format, ...) { ++ va_list ap; ++ va_start (ap, format); ++ prom_vfprintf (prom_stdout, format, ap); ++ va_end (ap); ++ ++ return 0; ++} ++ ++void *memcpy(void *dest, const void *src, size_t n); ++void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) { ++ return memcpy(dest, src, n); ++} ++ ++// But these are all dummy functions ++int __xstat64 (int __ver, const char *__filename, void *__stat_buf) { ++ return 0; ++} ++ ++int stat64(const char *path, void *stat_buf) { ++ return 0; ++} ++ ++int fstat64(int fildes, void *stat_buf) { ++ return 0; ++} ++ ++int __fxstat64 (int __ver, int __filedesc, void *__stat_buf) { ++ return 0; ++} ++ ++signed int random(void) { ++ return 0; ++} ++ ++void srandom(unsigned int seed) { ++ return; ++} ++ ++int rand(void) { ++ return 0; ++} ++ ++void srand(unsigned int seed) { ++ return; ++} ++ ++unsigned int sleep(unsigned int seconds) { ++ return 0; ++} ++ ++int gettimeofday(void *tv, void *tz) { ++ return 0; ++} ++ ++long sysconf(int name) { ++ return 0; ++} ++ ++int getpagesize(void) { ++ return 0; ++} ++ ++int gethostname(char *name, size_t len) { ++ return 0; ++} ++ ++int getpid(void) { ++ return 0; ++} ++ ++int getuid(void) { ++ return 0; ++} ++ ++void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) { ++ return; ++} ++ ++int * __errno_location(void) { ++ return 0; ++} ++ ++size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) { ++ return 0; ++} ++ ++int ioctl(int d, int request, ...) { ++ return 0; ++} ++ ++int fallocate(int fd, int mode, unsigned int offset, unsigned int len) { ++ return 0; ++} ++ ++int uname(void *buf) { ++ return 0; ++} ++ ++int setrlimit(int resource, void *rlim) { ++ return 0; ++} ++ ++unsigned long long int strtoull(const char *nptr, char **endptr, int base) { ++ return 0; ++} ++ ++int getrlimit(int resource, void *rlim) { ++ return 0; ++} ++ ++int stderr = 0; ++int perror = 0; diff --git a/sys-boot/yaboot/files/yabootconfig-1.3.13.patch b/sys-boot/yaboot/files/yabootconfig-1.3.13.patch new file mode 100644 index 000000000000..4bc13eef8b18 --- /dev/null +++ b/sys-boot/yaboot/files/yabootconfig-1.3.13.patch @@ -0,0 +1,42 @@ +--- yaboot-1.3.13.orig/ybin/yabootconfig 2004-11-04 21:57:17.000000000 -0500 ++++ yaboot-1.3.13/ybin/yabootconfig 2004-11-04 22:40:45.503060512 -0500 +@@ -5,6 +5,8 @@ + ## yabootconfig generates a simple /etc/yaboot.conf + ## Copyright (C) 2001, 2002, 2003 Ethan Benson + ## ++## Patched for Gentoo and dual boot - Mark Guertin <gerk@gentoo.org> ++## + ## 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 +@@ -264,6 +266,30 @@ + return 0 + } + ++dualboot() ++{ ++ DRIVELIST=`ls -d /dev/?d?* | grep "[sh]d[abcdefghijkl]" | cut -b 6-8 | sort -u` ++ ++ for i in $DRIVELIST ++ do ++ HFS=`mac-fdisk -l "/dev/$i" | grep '\<Apple_HFS\>' | grep -v "CDROM" | cut -d" " -f1` ++ for h in $HFS ++ do ++ if [ !-x `hpmount -r $h` > /dev/null 2>&1 ] ; then ++ if [ `hpls mach_kernel 2>/dev/null` ] ; then ++ [ "$QUIET" = 0 ] && echo "Found possible OS X/Darwin partition at $h" ++ OSX=$h ++ fi ++ if [ "`hpls "System Folder" 2>/dev/null`" ] ; then ++ [ "$QUIET" = 0 ] && echo "Found possible Mac OS partition at $h" ++ MACOS=$h ++ fi ++ hpumount $h > /dev/null 2>&1 ++ fi ++ done ++ done ++} ++ + ########## + ## Main ## + ########## diff --git a/sys-boot/yaboot/metadata.xml b/sys-boot/yaboot/metadata.xml new file mode 100644 index 000000000000..675be6dd398c --- /dev/null +++ b/sys-boot/yaboot/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>ppc@gentoo.org</email> + <name>PowerPC architecture team</name> +</maintainer> +</pkgmetadata> diff --git a/sys-boot/yaboot/yaboot-1.3.17-r4.ebuild b/sys-boot/yaboot/yaboot-1.3.17-r4.ebuild new file mode 100644 index 000000000000..d9ec91501d94 --- /dev/null +++ b/sys-boot/yaboot/yaboot-1.3.17-r4.ebuild @@ -0,0 +1,117 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic toolchain-funcs + +# yaboot is sensitive to external libc dependencies +# of e2fsprogs. Pin to known working versions. +# As a bonus we can control CFLAGS used to build e2fsprogs. +# See compile_bundled_e2fsprogs() below and https://bugs.gentoo.org/641560 +E2FS_P="e2fsprogs-1.42.13" + +DESCRIPTION="PPC Bootloader" +HOMEPAGE="http://yaboot.ozlabs.org" +SRC_URI=" + http://yaboot.ozlabs.org/releases/${P}.tar.gz + https://downloads.sourceforge.net/e2fsprogs/${E2FS_P}.tar.gz +" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* ppc -ppc64" +IUSE="ibm" + +DEPEND="" +RDEPEND=" + !sys-boot/yaboot-static + sys-apps/ibm-powerpc-utils + !ibm? ( + sys-fs/hfsutils + sys-fs/hfsplusutils + sys-fs/mac-fdisk + )" + +PATCHES=( + # dual boot patch + "${FILESDIR}/yabootconfig-1.3.13.patch" + "${FILESDIR}/chrpfix.patch" + "${FILESDIR}/${P}-nopiessp-gcc4.patch" + "${FILESDIR}/${PN}-stubfuncs.patch" + + # Fix the devspec path on newer kernels + "${FILESDIR}/new-ofpath-devspec.patch" +) + +src_prepare() { + # has to be copied before 'new-ofpath-devspec' + cp "${FILESDIR}/new-ofpath" "${S}/ybin/ofpath" || die + default + + pushd "${WORKDIR}/${E2FS_P}" + eapply "${FILESDIR}"/e2fsprogs-1.42.13-sysmacros.h.patch + popd + + # No need to hardcode this path -- the compiler already knows to use it. + # Error only on real errors, for prom printing format compile failure. + sed -i \ + -e 's:-I/usr/include::' \ + -e 's:-Werror:-Wno-error:g' \ + Makefile || die + + # We'll install bundled libext2fs.a here + DEPS_DIR="${T}"/bundled-deps + export DEPS_DIR +} + +src_configure() { + # ld.gold fails to link yaboot as: + # sorry, I can't find space in second/yaboot.chrp to put the note + # bug #678710 + tc-ld-disable-gold + + pushd "${WORKDIR}/${E2FS_P}" || die + econf \ + --enable-libblkid \ + --enable-libuuid \ + --disable-fsck \ + --disable-quota + popd + + default +} + +src_compile() { + # Note: we use unmodified host's CFLAGS to build depends. + emake -C "${WORKDIR}/${E2FS_P}" V=1 + # install-libs to install libext2fs.a for yaboot to statically link against + emake -C "${WORKDIR}/${E2FS_P}" DESTDIR="${DEPS_DIR}" install-libs V=1 + + unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS + # -std=gnu90 is needed to preserve 'inline' semantics + # of pre-c99 (always-inline) to avoid duplicate symbol + # definition, bug #641560. + # -L${deps_prefix}/usr/lib is needed to inject known + # working libext2fs.a as yaboot bundles header overrides + # that assume matcking implementation. System's version + # frequently does not work like in bug #641560. + emake \ + PREFIX=/usr \ + MANDIR=share/man \ + CC="$(tc-getCC) -std=gnu90" \ + LD="$(tc-getLD) -L${DEPS_DIR}/usr/lib" +} + +src_install() { + sed -i -e 's/\/local//' etc/yaboot.conf || die + emake \ + ROOT="${D}" \ + PREFIX=/usr \ + MANDIR=share/man \ + CC="$(tc-getCC) -std=gnu90" \ + LD="$(tc-getLD) -L${DEPS_DIR}/usr/lib" \ + \ + install + mv "${ED}"/etc/yaboot.conf{,.sample} || die +} diff --git a/sys-boot/zfsbootmenu/Manifest b/sys-boot/zfsbootmenu/Manifest new file mode 100644 index 000000000000..53008d73be09 --- /dev/null +++ b/sys-boot/zfsbootmenu/Manifest @@ -0,0 +1,5 @@ +DIST zfsbootmenu-1.12.0.tar.gz 1688946 BLAKE2B 291dcc813767def653bc4983cb9ff4c5b1d9f191cb8fee6e9a58cd6826fe0204606aa095339e9eeb6e4dd3201f5f9ad1b4cc3a26712960bf057198225f4b65f9 SHA512 5af3d258eee3ade3e9e11e084f4de0d251acc952348fdc4d3656b32f8fec7460c2d59fa883e06f482bd2f59e1055d6b908cf43c29aee47059d369231197a6645 +DIST zfsbootmenu-2.2.2.tar.gz 1830178 BLAKE2B e2191e26215214ce2ed803bf0659aea9ba629fcb35acb75e6398731b5edcee4bc2820203844c80998e39fd4c6eb904244fce6a37126038cd816156466976100a SHA512 895491305bf97147252a63a28d378823068e83417146a949d018b49b6e6d3274af434e8047082dad08494f6db44429a9948531321750b88b0eaf282710356914 +DIST zfsbootmenu-2.3.0.tar.gz 1891010 BLAKE2B 2e84204994008c85ba0ad7231fe442bd02cbb45d57b3dfd707b86d1484b155dc8309958cd66d90336897e9841596aa74d6ffa4a969bca0e65679806ac8233e94 SHA512 9b8e2d5ea258a32cd09a9382faaa21beea54f2ed825fa747f10ffe0b9f191c257b023019ec76dc882e649e8ea6fcd8e310632bba6c783228c594e3d0fee2c9c8 +DIST zfsbootmenu-3.0.1.tar.gz 1905474 BLAKE2B 879eb533c333eb95eba7d6d003e3a5ec9446aa7a6443dc28f5c7002c20bfea229601cddb670a24b0638aa94ad14b038822d389488b5028c47484ffc39f7d1633 SHA512 8176ba9325a0d7f06ce9007a2a46cbb1a66f876987ef281f2fac0e0584dfd206ef55211de4af3aa9ae23d64788060119b070c9083e33928a85542efd07c08c95 +DIST zfsbootmenu-3.1.0.tar.gz 1912653 BLAKE2B 37a209dd50ce1da74f4f1d4e20f051cdac121efb71066c944cac43ff3a7d3186e7756c6fe65a393bc50d90cd03f84c7204dd1eb42728fa70dccb1246b5135142 SHA512 79d2134e827e27dbcc170f47b7c8f465f64d70a1bb6ddb2f05553a0515ccdc75e857e5378fd4fb9d61f3b07d3b0be8e163bde755dd09e0f7e599ebf14c575810 diff --git a/sys-boot/zfsbootmenu/files/zfsbootmenu-branding.patch b/sys-boot/zfsbootmenu/files/zfsbootmenu-branding.patch new file mode 100644 index 000000000000..95e2e130b200 --- /dev/null +++ b/sys-boot/zfsbootmenu/files/zfsbootmenu-branding.patch @@ -0,0 +1,20 @@ +--- a/etc/zfsbootmenu/config.yaml ++++ b/etc/zfsbootmenu/config.yaml +@@ -3,14 +3,15 @@ Global: + BootMountPoint: /boot/efi + DracutConfDir: /etc/zfsbootmenu/dracut.conf.d + Components: +- ImageDir: /boot/efi/EFI/void ++ ImageDir: /boot/efi/EFI/gentoo + Versions: 3 + Enabled: true + syslinux: + Config: /boot/syslinux/syslinux.cfg + Enabled: false + EFI: +- ImageDir: /boot/efi/EFI/void ++ ImageDir: /boot/efi/EFI/gentoo ++ Stub: /usr/lib/systemd/boot/efi/linuxx64.elf.stub + Versions: false + Enabled: false + Kernel: diff --git a/sys-boot/zfsbootmenu/files/zfsbootmenu-stub-location.patch b/sys-boot/zfsbootmenu/files/zfsbootmenu-stub-location.patch new file mode 100644 index 000000000000..74803e866e2b --- /dev/null +++ b/sys-boot/zfsbootmenu/files/zfsbootmenu-stub-location.patch @@ -0,0 +1,13 @@ +diff --git a/etc/zfsbootmenu/config.yaml b/etc/zfsbootmenu/config.yaml +index e8b196c..38b2812 100644 +--- a/etc/zfsbootmenu/config.yaml ++++ b/etc/zfsbootmenu/config.yaml +@@ -14,6 +14,7 @@ Components: + Enabled: false + EFI: + ImageDir: /boot/efi/EFI/zbm ++ Stub: /usr/lib/systemd/boot/efi/linuxx64.efi.stub + Versions: false + Enabled: false + Kernel: + diff --git a/sys-boot/zfsbootmenu/metadata.xml b/sys-boot/zfsbootmenu/metadata.xml new file mode 100644 index 000000000000..41b20f957f79 --- /dev/null +++ b/sys-boot/zfsbootmenu/metadata.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>artemis@artemis.sh</email> + <name>Artemis Everfree</name> + </maintainer> + <maintainer type="person"> + <email>c@cgps.ch</email> + <name>Chaquen Beliakov Amaya</name> + </maintainer> + <maintainer type="person"> + <email>ceres@ceressees.dev</email> + <name>Ceres Milner</name> + </maintainer> + <upstream> + <remote-id type="github">zbm-dev/zfsbootmenu</remote-id> + </upstream> +</pkgmetadata> diff --git a/sys-boot/zfsbootmenu/zfsbootmenu-1.12.0.ebuild b/sys-boot/zfsbootmenu/zfsbootmenu-1.12.0.ebuild new file mode 100644 index 000000000000..ab7602504dc8 --- /dev/null +++ b/sys-boot/zfsbootmenu/zfsbootmenu-1.12.0.ebuild @@ -0,0 +1,32 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="ZFS bootloader for root-on-ZFS systems" +HOMEPAGE="https://zfsbootmenu.org" +SRC_URI="https://github.com/zbm-dev/zfsbootmenu/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +PATCHES=( + "${FILESDIR}"/${PN}-branding.patch +) + +RDEPEND=" +app-shells/fzf +sys-apps/kexec-tools +sys-block/mbuffer +dev-perl/Sort-Versions +dev-perl/Config-IniFiles +dev-perl/YAML-PP +dev-perl/boolean +sys-fs/zfs +sys-kernel/dracut" + +pkg_postinst () { + elog "Please consult upstream doumentation to install the bootloader + https://github.com/zbm-dev/zfsbootmenu" +} diff --git a/sys-boot/zfsbootmenu/zfsbootmenu-2.2.2.ebuild b/sys-boot/zfsbootmenu/zfsbootmenu-2.2.2.ebuild new file mode 100644 index 000000000000..655734a81bdb --- /dev/null +++ b/sys-boot/zfsbootmenu/zfsbootmenu-2.2.2.ebuild @@ -0,0 +1,44 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="ZFS bootloader for root-on-ZFS systems" +HOMEPAGE="https://zfsbootmenu.org" +SRC_URI="https://github.com/zbm-dev/zfsbootmenu/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +PATCHES=( + "${FILESDIR}"/${PN}-stub-location.patch +) + +RDEPEND=" +app-shells/fzf +dev-lang/perl +dev-perl/boolean +dev-perl/Config-IniFiles +dev-perl/Sort-Versions +dev-perl/YAML-PP +sys-apps/kexec-tools +sys-block/mbuffer +sys-fs/zfs +sys-kernel/dracut +" + +src_compile() { + # There's a makefile in the source repo but it's only for install. There's + # nothing to compile since zfsbootmenu is all scripts. + true +} + +src_install() { + emake DESTDIR="${D}" install +} + +pkg_postinst () { + elog "Please consult upstream doumentation to install the bootloader + https://github.com/zbm-dev/zfsbootmenu" +} diff --git a/sys-boot/zfsbootmenu/zfsbootmenu-2.3.0.ebuild b/sys-boot/zfsbootmenu/zfsbootmenu-2.3.0.ebuild new file mode 100644 index 000000000000..655734a81bdb --- /dev/null +++ b/sys-boot/zfsbootmenu/zfsbootmenu-2.3.0.ebuild @@ -0,0 +1,44 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="ZFS bootloader for root-on-ZFS systems" +HOMEPAGE="https://zfsbootmenu.org" +SRC_URI="https://github.com/zbm-dev/zfsbootmenu/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +PATCHES=( + "${FILESDIR}"/${PN}-stub-location.patch +) + +RDEPEND=" +app-shells/fzf +dev-lang/perl +dev-perl/boolean +dev-perl/Config-IniFiles +dev-perl/Sort-Versions +dev-perl/YAML-PP +sys-apps/kexec-tools +sys-block/mbuffer +sys-fs/zfs +sys-kernel/dracut +" + +src_compile() { + # There's a makefile in the source repo but it's only for install. There's + # nothing to compile since zfsbootmenu is all scripts. + true +} + +src_install() { + emake DESTDIR="${D}" install +} + +pkg_postinst () { + elog "Please consult upstream doumentation to install the bootloader + https://github.com/zbm-dev/zfsbootmenu" +} diff --git a/sys-boot/zfsbootmenu/zfsbootmenu-3.0.1.ebuild b/sys-boot/zfsbootmenu/zfsbootmenu-3.0.1.ebuild new file mode 100644 index 000000000000..16eac75b1dc5 --- /dev/null +++ b/sys-boot/zfsbootmenu/zfsbootmenu-3.0.1.ebuild @@ -0,0 +1,55 @@ +# Copyright 2023-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit prefix + +DESCRIPTION="ZFS bootloader for root-on-ZFS systems" +HOMEPAGE="https://zfsbootmenu.org" +SRC_URI="https://github.com/zbm-dev/zfsbootmenu/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +PATCHES=( + "${FILESDIR}"/${PN}-stub-location.patch +) + +RDEPEND=" +app-shells/fzf +dev-lang/perl +dev-perl/boolean +dev-perl/Config-IniFiles +dev-perl/Sort-Versions +dev-perl/YAML-PP +sys-apps/kexec-tools +sys-block/mbuffer +sys-fs/zfs +sys-kernel/dracut +" + +src_prepare() { + default + hprefixify bin/* + if [[ -n ${BROOT} ]]; then + sed -e "s,#!/bin/sh,#!${BROOT}/bin/sh," \ + -i install-tree.sh releng/version.sh || die + fi +} + +src_compile() { + # There's a makefile in the source repo but it's only for install. There's + # nothing to compile since zfsbootmenu is all scripts. + true +} + +src_install() { + emake DESTDIR="${ED}" EXAMPLES="/usr/share/doc/${PF}" install +} + +pkg_postinst () { + elog "Please consult Gentoo wiki to configure the bootloader + https://wiki.gentoo.org/wiki/ZFS/rootfs#ZFSBootMenu" +} diff --git a/sys-boot/zfsbootmenu/zfsbootmenu-3.1.0.ebuild b/sys-boot/zfsbootmenu/zfsbootmenu-3.1.0.ebuild new file mode 100644 index 000000000000..bb6611907941 --- /dev/null +++ b/sys-boot/zfsbootmenu/zfsbootmenu-3.1.0.ebuild @@ -0,0 +1,58 @@ +# Copyright 2023-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit prefix + +DESCRIPTION="ZFS bootloader for root-on-ZFS systems" +HOMEPAGE="https://zfsbootmenu.org" +SRC_URI="https://github.com/zbm-dev/zfsbootmenu/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm64" + +PATCHES=( + "${FILESDIR}"/${PN}-stub-location.patch +) + +RDEPEND=" +app-shells/fzf +dev-lang/perl +dev-perl/boolean +dev-perl/Config-IniFiles +dev-perl/Sort-Versions +dev-perl/YAML-PP +sys-apps/kexec-tools +sys-block/mbuffer +sys-fs/zfs +sys-kernel/dracut +" + +src_prepare() { + default + hprefixify bin/* + if [[ -n ${BROOT} ]]; then + sed -e "s,#!/bin/sh,#!${BROOT}/bin/sh," \ + -i install-tree.sh releng/version.sh || die + fi +} + +src_compile() { + # There's a makefile in the source repo but it's only for install. There's + # nothing to compile since zfsbootmenu is all scripts. + true +} + +src_install() { + emake DESTDIR="${ED}" EXAMPLES="/usr/share/doc/${PF}" install +} + +pkg_postinst () { + elog "Please consult Gentoo wiki to configure the bootloader + https://wiki.gentoo.org/wiki/ZFS/ZFSBootMenu" + elog "To create en EFI image, an EFI stub loader is needed." + elog "To use the stub loader provided by systemdboot, enable + the boot and kernel-install USE flags for sys-apps/systemd-utils" +} |
