[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2022-12-04 Thread Robin H. Johnson
commit: 19b45d085c9fe12820eaa5d89eb9469a8d8b3bb3
Author: Robin H. Johnson  gentoo  org>
AuthorDate: Mon Dec  5 05:35:34 2022 +
Commit: Robin H. Johnson  gentoo  org>
CommitDate: Mon Dec  5 05:36:21 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=19b45d08

sys-boot/mbr-gpt: add safety check

If the compiler/linker/objdump options make the mbr too large, bail out,
so nobody accidently wipes out the start of their drives with a large
MBR.

Signed-off-by: Robin H. Johnson  gentoo.org>

 sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild | 5 +
 sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild | 7 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
index 3073a1e1cfed..1b062d5e5648 100644
--- a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
@@ -44,6 +44,11 @@ src_prepare() {
 
 src_compile() {
emake CC="$(tc-getCC)"
+   # validate the size, it MUST fit into an MBR (440 bytes!)
+   size=$(stat --printf='%s' mbr)
+   if test $size -gt 440; then
+   die "Compiled MBR is too large! Must be at most 440 bytes, was 
$size"
+   fi
 }
 
 src_install() {

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild
index df636e06b770..9359c8200a24 100644
--- a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild
@@ -27,7 +27,7 @@ QA_PRESTRIPPED="${QA_WX_LOAD}"
 QA_FLAGS_IGNORED="${QA_WX_LOAD}"
 
 # Don't strip it either; this binary reboots your host!
-RESTRICT="binchecks strip"
+RESTRICT="strip"
 
 src_prepare() {
default
@@ -46,6 +46,11 @@ src_prepare() {
 
 src_compile() {
emake CC="$(tc-getCC)"
+   # validate the size, it MUST fit into an MBR (440 bytes!)
+   size=$(stat --printf='%s' mbr)
+   if test $size -gt 440; then
+   die "Compiled MBR is too large! Must be at most 440 bytes, was 
$size"
+   fi
 }
 
 src_install() {



[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2022-12-04 Thread Robin H. Johnson
commit: f1de25303bd07f70781ec37d648b62fe7c1d3916
Author: Robin H. Johnson  gentoo  org>
AuthorDate: Mon Dec  5 05:19:25 2022 +
Commit: Robin H. Johnson  gentoo  org>
CommitDate: Mon Dec  5 05:24:44 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1de2530

sys-boot/mbr-gpt: fix PHDR/LOAD mess

"PHDR segment not covered by LOAD segment", an error meaningless for MBR
code.

The solution is buried in binutils changelogs: --no-dynamic-linker for
obscure cases like this.

Reference: https://inbox.sourceware.org/binutils/20200222023739.GB5570  
bubble.grove.modra.org/T/#u
Closes: https://bugs.gentoo.org/870913
Closes: https://bugs.gentoo.org/709510
Closes: https://bugs.gentoo.org/722206
Signed-off-by: Robin H. Johnson  gentoo.org>

 sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild | 69 
 1 file changed, 69 insertions(+)

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild
new file mode 100644
index ..df636e06b770
--- /dev/null
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r2.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+DESCRIPTION="An MBR that can handle BIOS-based boot on GPT"
+MY_P="${PN}_${PV}"
+HOMEPAGE="https://web.archive.org/web/20080704173538/http://aybabtu.com/mbr-gpt/;
+SRC_URI="https://dev.gentoo.org/~robbat2/distfiles/${MY_P}.tar.gz;
+
+LICENSE="GPL-3"
+SLOT="0"
+# This should probably NEVER go to stable. It's crazy advanced dangerous magic.
+# It's also pure ASM, so not suitable for elsewhere anyway.
+# Please don't remove it, robbat2 has a box that depends on it for # booting!
+KEYWORDS="~amd64 ~x86"
+
+# It only depends on binutils/gcc/make, and doesn't link against libc even.
+DEPEND=""
+RDEPEND=""
+
+# It's a mostly an MBR block and it does use the executable stack.
+QA_WX_LOAD="usr/lib/${PN}/boot.elf"
+QA_PRESTRIPPED="${QA_WX_LOAD}"
+QA_FLAGS_IGNORED="${QA_WX_LOAD}"
+
+# Don't strip it either; this binary reboots your host!
+RESTRICT="binchecks strip"
+
+src_prepare() {
+   default
+
+   # Messy upstream
+   emake clean
+
+   # Need to build it 32-bit for the MBR
+   # Btw, no CFLAGS are respected, it's ASM!
+   #
+   # This is not meant to be used by a dynamic linker either! 
+   # 
https://inbox.sourceware.org/binutils/20200222023739.gb5...@bubble.grove.modra.org/T/#u
+   # Shows the --no-dynamic-linker option to ld
+   sed -i -e 's/-Wall/-Wall -m32 -Wl,--no-dynamic-linker/g' 
"${S}"/Makefile || die
+}
+
+src_compile() {
+   emake CC="$(tc-getCC)"
+}
+
+src_install() {
+   # get_libdir is not correct here. We want this to go into a 32-bit 
library
+   # location.
+   insinto /usr/lib/${PN}
+   doins mbr
+
+   exeinto /usr/lib/${PN}
+   exeopts -m 700
+   doexe boot.elf
+
+   dodoc AUTHORS
+}
+
+pkg_postinst() {
+   einfo "See the instructions on the homepage, and make sure you know 
what"
+   einfo "you are doing before touching this. The mbr file does into your"
+   einfo "MBR, or alternatively you can do a creative reboot utilizing the"
+   einfo "boot.elf binary."
+}



[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2022-01-16 Thread Mike Gilbert
commit: da062f69754a54e06dfbb6956e7f93936b489a34
Author: Mike Gilbert  gentoo  org>
AuthorDate: Sun Jan 16 23:03:21 2022 +
Commit: Mike Gilbert  gentoo  org>
CommitDate: Sun Jan 16 23:03:30 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da062f69

sys-boot/mbr-gpt: drop base-system from maintainers

Signed-off-by: Mike Gilbert  gentoo.org>

 sys-boot/mbr-gpt/metadata.xml | 4 
 1 file changed, 4 deletions(-)

diff --git a/sys-boot/mbr-gpt/metadata.xml b/sys-boot/mbr-gpt/metadata.xml
index f29fedf971f0..43abbb35dc1e 100644
--- a/sys-boot/mbr-gpt/metadata.xml
+++ b/sys-boot/mbr-gpt/metadata.xml
@@ -4,10 +4,6 @@
 
robb...@gentoo.org
 
-
-   base-sys...@gentoo.org
-   Gentoo Base System
-
 
Bootable MBR including fake partition records, for legacy BIOS without 
any GPT support, and usable without hybrid disk layouts.
Install directly at the start of a disk, create GPT, ensure at least 
one partition has GUID set to BIOS Boot Partition 
(21686148-6449-6e6f-744e-656564454649).



[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2021-05-13 Thread David Seifert
commit: 42a99f0f2d7d75aaa76ef7e03fd66f993fd947c4
Author: Sam James  gentoo  org>
AuthorDate: Thu May 13 13:54:37 2021 +
Commit: David Seifert  gentoo  org>
CommitDate: Thu May 13 13:54:37 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42a99f0f

sys-boot/mbr-gpt: drop unused flag-o-matic inherit

Signed-off-by: David Seifert  gentoo.org>

 sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
index 294caff68d9..3073a1e1cfe 100644
--- a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
@@ -3,19 +3,20 @@
 
 EAPI=7
 
-inherit flag-o-matic toolchain-funcs
+inherit toolchain-funcs
 
 DESCRIPTION="An MBR that can handle BIOS-based boot on GPT"
 MY_P="${PN}_${PV}"
 
HOMEPAGE="https://web.archive.org/web/20080704173538/http://aybabtu.com/mbr-gpt/;
 SRC_URI="https://dev.gentoo.org/~robbat2/distfiles/${MY_P}.tar.gz;
+
 LICENSE="GPL-3"
 SLOT="0"
 # This should probably NEVER go to stable. It's crazy advanced dangerous magic.
 # It's also pure ASM, so not suitable for elsewhere anyway.
 # Please don't remove it, robbat2 has a box that depends on it for # booting!
 KEYWORDS="~amd64 ~x86"
-IUSE=""
+
 # It only depends on binutils/gcc/make, and doesn't link against libc even.
 DEPEND=""
 RDEPEND=""
@@ -30,12 +31,15 @@ RESTRICT="binchecks strip"
 
 src_prepare() {
default
+
# Messy upstream
emake clean
 
# Need to build it 32-bit for the MBR
# Btw, no CFLAGS are respected, it's ASM!
-   use amd64 && sed -i -e 's/-Wall/-Wall -m32/g' "${S}"/Makefile
+   if use amd64 ; then
+   sed -i -e 's/-Wall/-Wall -m32/g' "${S}"/Makefile || die
+   fi
 }
 
 src_compile() {
@@ -47,9 +51,11 @@ src_install() {
# location.
insinto /usr/lib/${PN}
doins mbr
+
exeinto /usr/lib/${PN}
exeopts -m 700
doexe boot.elf
+
dodoc AUTHORS
 }
 



[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2021-04-16 Thread David Seifert
commit: 4108eefcc5e018cdcf5e2795d91776a1fd0f7b29
Author: Sam James  gentoo  org>
AuthorDate: Fri Apr 16 10:13:45 2021 +
Commit: David Seifert  gentoo  org>
CommitDate: Fri Apr 16 10:13:45 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4108eefc

sys-boot/mbr-gpt: eutils--

Signed-off-by: Sam James  gentoo.org>
Signed-off-by: David Seifert  gentoo.org>

 sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
index b13bcd6d43d..294caff68d9 100644
--- a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit eutils flag-o-matic toolchain-funcs
+inherit flag-o-matic toolchain-funcs
 
 DESCRIPTION="An MBR that can handle BIOS-based boot on GPT"
 MY_P="${PN}_${PV}"



[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2021-04-03 Thread Sam James
commit: 231cad91d038a27d1db11b25ec9caa79b6a1202f
Author: Sam James  gentoo  org>
AuthorDate: Fri Apr  2 09:56:05 2021 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Apr  3 15:43:53 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=231cad91

sys-boot/mbr-gpt: fix variable references

Package-Manager: Portage-3.0.14-prefix, Repoman-3.0.2
Signed-off-by: Sam James  gentoo.org>

 sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
index 8df1596c640..b13bcd6d43d 100644
--- a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -21,7 +21,7 @@ DEPEND=""
 RDEPEND=""
 
 # It's a mostly an MBR block and it does use the executable stack.
-QA_WX_LOAD="usr/lib/$PN/boot.elf"
+QA_WX_LOAD="usr/lib/${PN}/boot.elf"
 QA_PRESTRIPPED="${QA_WX_LOAD}"
 QA_FLAGS_IGNORED="${QA_WX_LOAD}"
 
@@ -45,9 +45,9 @@ src_compile() {
 src_install() {
# get_libdir is not correct here. We want this to go into a 32-bit 
library
# location.
-   insinto /usr/lib/$PN
+   insinto /usr/lib/${PN}
doins mbr
-   exeinto /usr/lib/$PN
+   exeinto /usr/lib/${PN}
exeopts -m 700
doexe boot.elf
dodoc AUTHORS



[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2020-02-13 Thread David Seifert
commit: a2c1148280d23d676fd2d05a28739c381fab86b8
Author: David Seifert  gentoo  org>
AuthorDate: Thu Feb 13 21:39:02 2020 +
Commit: David Seifert  gentoo  org>
CommitDate: Thu Feb 13 21:39:02 2020 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a2c11482

sys-boot/mbr-gpt: [QA] inherit toolchain-funcs.eclass directly

Package-Manager: Portage-2.3.88, Repoman-2.3.20
Signed-off-by: David Seifert  gentoo.org>

 sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
index 915fc0e5dd5..8df1596c640 100644
--- a/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
-inherit eutils flag-o-matic
+inherit eutils flag-o-matic toolchain-funcs
 
 DESCRIPTION="An MBR that can handle BIOS-based boot on GPT"
 MY_P="${PN}_${PV}"



[gentoo-commits] repo/gentoo:master commit in: sys-boot/mbr-gpt/

2019-06-16 Thread Robin H. Johnson
commit: c65a1ab094bb97a6403ad018d8ce0c8b253e5006
Author: Robin H. Johnson  gentoo  org>
AuthorDate: Sun Jun 16 19:15:35 2019 +
Commit: Robin H. Johnson  gentoo  org>
CommitDate: Sun Jun 16 19:17:14 2019 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c65a1ab0

sys-boot/mbr-gpt: EAPI7, fixups

This is a very niche package, but still useful and needed to boot some
old hardware.

Fixes: https://bugs.gentoo.org/429396
Fixes: https://bugs.gentoo.org/371333
Package-Manager: Portage-2.3.67, Repoman-2.3.12
Signed-off-by: Robin H. Johnson  gentoo.org>

 ...br-gpt-0.0.1.ebuild => mbr-gpt-0.0.1-r1.ebuild} | 32 ++
 sys-boot/mbr-gpt/metadata.xml  |  4 +++
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/sys-boot/mbr-gpt/mbr-gpt-0.0.1.ebuild 
b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
similarity index 64%
rename from sys-boot/mbr-gpt/mbr-gpt-0.0.1.ebuild
rename to sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
index 034062e6513..915fc0e5dd5 100644
--- a/sys-boot/mbr-gpt/mbr-gpt-0.0.1.ebuild
+++ b/sys-boot/mbr-gpt/mbr-gpt-0.0.1-r1.ebuild
@@ -1,30 +1,36 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=0
+EAPI=7
 
 inherit eutils flag-o-matic
 
 DESCRIPTION="An MBR that can handle BIOS-based boot on GPT"
 MY_P="${PN}_${PV}"
-HOMEPAGE="http://aybabtu.com/mbr-gpt/;
-SRC_URI="http://aybabtu.com/mbr-gpt/${MY_P}.tar.gz;
-LICENSE="GPL-2"
+HOMEPAGE="https://web.archive.org/web/20080704173538/http://aybabtu.com/mbr-gpt/;
+SRC_URI="https://dev.gentoo.org/~robbat2/distfiles/${MY_P}.tar.gz;
+LICENSE="GPL-3"
 SLOT="0"
 # This should probably NEVER go to stable. It's crazy advanced dangerous magic.
 # It's also pure ASM, so not suitable for elsewhere anyway.
-KEYWORDS="~x86 ~amd64"
+# Please don't remove it, robbat2 has a box that depends on it for # booting!
+KEYWORDS="~amd64 ~x86"
 IUSE=""
 # It only depends on binutils/gcc/make, and doesn't link against libc even.
 DEPEND=""
 RDEPEND=""
 
 # It's a mostly an MBR block and it does use the executable stack.
-QA_WX_LOAD="usr/sbin/boot.elf"
+QA_WX_LOAD="usr/lib/$PN/boot.elf"
+QA_PRESTRIPPED="${QA_WX_LOAD}"
+QA_FLAGS_IGNORED="${QA_WX_LOAD}"
 
-src_unpack() {
-   unpack ${A}
-   cd "${S}"
+# Don't strip it either; this binary reboots your host!
+RESTRICT="binchecks strip"
+
+src_prepare() {
+   default
+   # Messy upstream
emake clean
 
# Need to build it 32-bit for the MBR
@@ -39,9 +45,11 @@ src_compile() {
 src_install() {
# get_libdir is not correct here. We want this to go into a 32-bit 
library
# location.
-   insinto /usr/lib/mbr-gpt/
+   insinto /usr/lib/$PN
doins mbr
-   dosbin boot.elf
+   exeinto /usr/lib/$PN
+   exeopts -m 700
+   doexe boot.elf
dodoc AUTHORS
 }
 

diff --git a/sys-boot/mbr-gpt/metadata.xml b/sys-boot/mbr-gpt/metadata.xml
index 9590fe15fc0..92a82843d1a 100644
--- a/sys-boot/mbr-gpt/metadata.xml
+++ b/sys-boot/mbr-gpt/metadata.xml
@@ -8,4 +8,8 @@
base-sys...@gentoo.org
Gentoo Base System
 
+
+   Bootable MBR including fake partition records, for legacy BIOS without 
any GPT support, and usable without hybrid disk layouts.
+   Install directly at the start of a disk, create GPT, ensure at least 
one partition has GUID set to BIOS Boot Partition 
(21686148-6449-6e6f-744e-656564454649).
+