From: Thomas Glanzmann Date: Sun, 27 Mar 2022 20:14:15 +0000 (+0200) Subject: small perl script to reinstall m1n1 stage1 X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/m1-debian/commitdiff_plain/42ba9b40d81a605012ec806374b4797fdd389c72?ds=inline small perl script to reinstall m1n1 stage1 --- diff --git a/m1n1stage1.pl b/m1n1stage1.pl new file mode 100644 index 0000000..422ec73 --- /dev/null +++ b/m1n1stage1.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl + +my $esp_line = `diskutil list disk0 | grep EFI`; + +my $esp_disk = undef; + +if ($esp_line =~ /(disk0s\d)/) { + $esp_disk = $1; +} + +die unless defined $esp_disk; + +my $partuuid = `diskutil info $esp_disk | grep 'Partition UUID' | awk -F: '{print \$2}'`; + +$partuuid =~ s/\s+//g; + +my $m1n1 = `curl -sL tg.st/u/m1n1-rust.bin`; + +open(OBJECT, '>', 'object.bin') || die; +print OBJECT $m1n1; +print OBJECT "chainload=$partuuid;m1n1/boot.bin\n"; +print OBJECT "chosen.asahi,efi-system-partition=$partuuid\n"; +close (OBJECT); + +system('kmutil configure-boot -c object.bin --raw --entry-point 2048 --lowest-virtual-address 0 -v /Volumes/Debian');