Skip to content

Commit 0099f5e

Browse files
authored
Merge pull request Homebrew#208658 from rabarbra/grub-2.06
i686-elf-grub 2.06, x86_64-elf-grub 2.06 (new formulae)
2 parents 89fbc12 + 2a1a88c commit 0099f5e

File tree

3 files changed

+154
-1
lines changed

3 files changed

+154
-1
lines changed

Formula/i/i686-elf-grub.rb

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
class I686ElfGrub < Formula
2+
desc "GNU GRUB bootloader for i686-elf"
3+
homepage "https://savannah.gnu.org/projects/grub"
4+
url "https://ftp.gnu.org/gnu/grub/grub-2.06.tar.xz"
5+
mirror "https://mirrors.ocf.berkeley.edu/gnu/grub/grub-2.06.tar.xz"
6+
sha256 "b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1"
7+
license "GPL-3.0-or-later"
8+
9+
bottle do
10+
sha256 arm64_sequoia: "5e69ba0912b4af63d9096b700661f94d7eee58f29cc6918a9bddbd1464ba6ab4"
11+
sha256 arm64_sonoma: "589a6326426f6af516b6f4e9c5de899d0e04e65da8e6818be289c0773b79f727"
12+
sha256 arm64_ventura: "6019c03071dfb8b6317748ab2179c9db42f0a5fb5bc99e6beceb2f6f45c0a3a2"
13+
sha256 sonoma: "3016d288f6ea2fd6493e4217ce393b063615b95581fc4cd1c24579f8801bb019"
14+
sha256 ventura: "92b92f9ff2d8fdb59fe50b96556d481d3d247639e0354cf03eac74abf2827f6f"
15+
sha256 x86_64_linux: "6b00321d73386ac1e2c3a338fd6ea69b509bf0bd1bf6ea2025ff0a7740fc983a"
16+
end
17+
18+
depends_on "help2man" => :build
19+
depends_on "i686-elf-binutils" => :build
20+
depends_on "i686-elf-gcc" => [:build, :test]
21+
depends_on "objconv" => :build
22+
depends_on "texinfo" => :build
23+
depends_on "gettext"
24+
depends_on "xorriso"
25+
depends_on "xz"
26+
uses_from_macos "bison" => :build
27+
uses_from_macos "flex" => :build
28+
uses_from_macos "python" => :build
29+
30+
def install
31+
target = "i686-elf"
32+
ENV["CFLAGS"] = "-Os -Wno-error=incompatible-pointer-types"
33+
34+
mkdir "build" do
35+
args = %W[
36+
--disable-werror
37+
--target=#{target}
38+
--prefix=#{prefix}/#{target}
39+
--bindir=#{bin}
40+
--libdir=#{lib}/#{target}
41+
--with-platform=pc
42+
--program-prefix=#{target}-
43+
]
44+
45+
system "../configure", *args
46+
system "make"
47+
system "make", "install"
48+
end
49+
end
50+
51+
test do
52+
target = "i686-elf"
53+
(testpath/"boot.c").write <<~C
54+
__asm__(
55+
".align 4\\n"
56+
".long 0x1BADB002\\n"
57+
".long 0x0\\n"
58+
".long -(0x1BADB002 + 0x0)\\n"
59+
);
60+
C
61+
system Formula["#{target}-gcc"].bin/"#{target}-gcc", "-c", "-o", "boot", "boot.c"
62+
assert_match "0",
63+
shell_output("#{bin}/#{target}-grub-file --is-x86-multiboot boot; echo -n $?")
64+
end
65+
end

Formula/x/x86_64-elf-grub.rb

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
class X8664ElfGrub < Formula
2+
desc "GNU GRUB bootloader for x86_64-elf"
3+
homepage "https://savannah.gnu.org/projects/grub"
4+
url "https://ftp.gnu.org/gnu/grub/grub-2.06.tar.xz"
5+
mirror "https://mirrors.ocf.berkeley.edu/gnu/grub/grub-2.06.tar.xz"
6+
sha256 "b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1"
7+
license "GPL-3.0-or-later"
8+
9+
bottle do
10+
sha256 arm64_sequoia: "b76374ca36987f1bfef95216c14af606d263e17863df4d7b1a33b3cf65d953a3"
11+
sha256 arm64_sonoma: "b5687ab4349a959b3bae9afb76103ab55bb5f0902eb199ab4aba00d974fc6c49"
12+
sha256 arm64_ventura: "406969f44c862754472dac117737965cf4c1ba427eba3ff478f0ce0bbfa75cc7"
13+
sha256 sonoma: "a9e8fd25bd063a89080bee2e33d88e70fcd0227a2a8fb20e43e270d59062da95"
14+
sha256 ventura: "e1770bd69fae7db684989eee7416337abb4f301a53a1034ab39efee73547cda9"
15+
sha256 x86_64_linux: "c578c06b175f785718eafaa9e54c45bd767ba73a041cf1db73a72a6103573375"
16+
end
17+
18+
depends_on "help2man" => :build
19+
depends_on "objconv" => :build
20+
depends_on "pkgconf" => :build
21+
depends_on "texinfo" => :build
22+
depends_on "x86_64-elf-binutils" => :build
23+
depends_on "x86_64-elf-gcc" => [:build, :test]
24+
depends_on "freetype"
25+
depends_on "gettext"
26+
depends_on "mtools"
27+
depends_on "xorriso"
28+
depends_on "xz"
29+
uses_from_macos "bison" => :build
30+
uses_from_macos "flex" => :build
31+
uses_from_macos "python" => :build
32+
33+
resource "unifont" do
34+
url "https://ftp.gnu.org/gnu/unifont/unifont-16.0.02/unifont-16.0.02.pcf.gz", using: :nounzip
35+
mirror "https://mirrors.ocf.berkeley.edu/gnu/unifont/unifont-16.0.02/unifont-16.0.02.pcf.gz"
36+
sha256 "02a3fe11994d3cdaf1d4bd5d2b6b609735e6823e01764ae83b704e02ec2f640d"
37+
end
38+
39+
def install
40+
target = "x86_64-elf"
41+
ENV["CFLAGS"] = "-Os -Wno-error=incompatible-pointer-types"
42+
43+
resource("unifont").stage do
44+
cp "unifont-16.0.02.pcf.gz", buildpath/"unifont.pcf.gz"
45+
end
46+
ENV["UNIFONT"] = buildpath/"unifont.pcf.gz"
47+
48+
mkdir "build" do
49+
args = %W[
50+
--disable-werror
51+
--enable-grub-mkfont
52+
--target=#{target}
53+
--prefix=#{prefix}/#{target}
54+
--bindir=#{bin}
55+
--libdir=#{lib}/#{target}
56+
--with-platform=efi
57+
--program-prefix=#{target}-
58+
]
59+
60+
system "../configure", *args
61+
system "make"
62+
system "make", "install"
63+
64+
mkdir_p "#{prefix}/#{target}/share/grub"
65+
66+
system "./grub-mkfont",
67+
"--output=#{prefix}/#{target}/share/grub/unicode.pf2",
68+
ENV["UNIFONT"].to_s
69+
end
70+
end
71+
72+
test do
73+
target = "x86_64-elf"
74+
(testpath/"boot.c").write <<~C
75+
__asm__(
76+
".align 4\\n"
77+
".long 0x1BADB002\\n"
78+
".long 0x0\\n"
79+
".long -(0x1BADB002 + 0x0)\\n"
80+
);
81+
C
82+
system Formula["#{target}-gcc"].bin/"#{target}-gcc", "-c", "-o", "boot", "boot.c"
83+
assert_match "0",
84+
shell_output("#{bin}/#{target}-grub-file --is-x86-multiboot boot; echo -n $?")
85+
end
86+
end

audit_exceptions/mismatched_binary_allowlist.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"aws-sam-cli": "libexec/lib/python*/site-packages/samcli/local/rapid/aws-lambda-rie-*",
44
"balena-cli": "**/*",
55
"faust": "share/faust/android/app/lib/libsndfile/lib/*/libsndfile.so",
6+
"i686-elf-grub": "lib/i686-elf/grub/i386-pc/*",
67
"lima": "share/lima/lima-guestagent.Linux-*",
78
"picotool": "share/picotool/xip_ram_perms.elf",
8-
"qemu": "share/qemu/*"
9+
"qemu": "share/qemu/*",
10+
"x86_64-elf-grub": "lib/x86_64-elf/grub/i386-pc/*"
911
}

0 commit comments

Comments
 (0)