чување f7233a4b6effdce6681d04aae5891c357d45889b
родитељ 545f684a3f18e3be5bf15e688b2ecbbf7bbec0dc
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Thu, 11 Aug 2022 23:30:23 +0200
Finish adding shim; start adding code to create raw image for boot
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 7, додавања: 146(+), брисања: 9(-)
diff --git a/03-packages.sh b/03-packages.sh
@@ -6192,10 +6192,21 @@ if [ -x /share/shim ]; then
elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
unpack_pkg ${pkg} /
else
- extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
(
cd_or_fail ${G_SRC}/${pkg}
+ git config --global --add safe.directory "${G_SRC}/${pkg}"
+ git checkout 15.6
+ git submodule init
+ git config submodule.gnu-efi.url "${G_SRC}/${pkg}/rhboot-gnu-efi"
+ git submodule update || exit 1
+
+ git apply ${G_PAT}/shim-galeb/shim-isystem.patch
+
+ cd gnu-efi
+ git apply ${G_PAT}/shim-galeb/gnu-efi-isystem.patch
+ cd - >/dev/null
+
cat <<! >MKPK
mkpk_name()
{
@@ -6209,14 +6220,30 @@ mkpk_install()
DESTDIR=/build
export CFLAGS LDFLAGS DESTDIR
- ./configure --prefix=/sucks || exit 1
+ if [ -e \${HOME}/.gitconfig ]; then
+ mv \${HOME}/.gitconfig \${HOME}/.gitconfig-old
+ fi
- make ${JN} || exit 1
- make install
+ mkdir -p \${HOME}
+ touch \${HOME}/.gitconfig
+ git config --global --add safe.directory "/${pkg}"
+
+ make ${JN} EFIDIR='GALEB' || exit 1
+ make DATATARGETDIR=/share/${pkg} DESTDIR=\${DESTDIR} install-as-data
+ install -Dm0644 BUILDING /build/share/doc/${pkg}
+ install -Dm0644 README.md /build/share/doc/${pkg}
+ install -Dm0644 README.fallback /build/share/doc/${pkg}
+ install -Dm0644 README.tpm /build/share/doc/${pkg}
+ install -Dm0644 TODO /build/share/doc/${pkg}
+
+ rm \${HOME}/.gitconfig
+ if [ -e \${HOME}/.gitconfig-old ]; then
+ mv \${HOME}/.gitconfig-old \${HOME}/.gitconfig
+ fi
}
!
mkpk ${pkg}
- remove_dir ${G_SRC}/${pkg}
+ #remove_dir ${G_SRC}/${pkg}
unpack_pkg ${pkg} /
) || exit 1
fi
diff --git a/04-finale.sh b/04-finale.sh
@@ -308,6 +308,22 @@ timestamp=$(date +'%Y-%m-%d %T')
printf "%s\t%s\t%s\n" mkpk 20220808 "${timestamp}" >>${G_PKGDB}
end_substep
+msg info "Creating /boot/EFI"
+mkdir -p ${GR}/boot/EFI
+mkdir -p ${GR}/boot/EFI/BOOT
+mkdir -p ${GR}/boot/EFI/GALEB
+
+cp_or_fail ${GR}/share/shim-15.6/shimx64.efi ${GR}/boot/EFI/BOOT/bootx64.efi
+cp_or_fail ${GR}/share/shim-15.6/fbx64.efi ${GR}/boot/EFI/BOOT/fbx64.efi
+cp_or_fail ${GR}/boot/vmlinuz ${GR}/boot/EFI/GALEB/vmlinuz
+
+msg info "Generating %s" "${GR}/boot/EFI/GALEB/BOOT.CSV"
+cat <<! >${GR}/boot/EFI/GALEB/BOOT-ASC.CSV
+vmlinuz,Galeb EFISTUB,root=/dev/sda2,Boot entry for Galeb EFISTUB
+!
+iconv -f ASCII -t UCS-2LE <${GR}/boot/EFI/GALEB/BOOT-ASC.CSV \
+ >${GR}/boot/EFI/GALEB/BOOT.CSV
+
msg info "makewhatis /share/man"
makewhatis /share/man
msg info "makewhatis /sucks/share/man"
diff --git a/TODO b/TODO
@@ -1,8 +1,9 @@
TODO
====
-[ ] Add shim
- [ ] Use shim and mksquashfs to create boot iso
+[~] Add shim
+ [x] Use shim and mksquashfs to create boot iso
+ - Using a slightly different method with raw image
[ ] See if any packages can be trimmed from the bootstrap
diff --git a/fil/rc.d/rc.init b/fil/rc.d/rc.init
@@ -171,8 +171,8 @@ export LANG
printf "%s: Boot finished at %s, spawning gettys.\n" $0 "$(date)" \
>>/tmp/boot.log
-mv /tmp/boot.log /var/log/
-chmod 0600 /var/log/boot.log
+mv /tmp/boot.log /var/log/ 2>/dev/null
+chmod 0600 /var/log/boot.log 2>/dev/null
echo
for n in 1 2 3 4; do
diff --git a/lib/pkgs.tsv b/lib/pkgs.tsv
@@ -8,6 +8,8 @@ git+https://git.sr.ht/~strahinja/svc svc-20220808
git+https://github.com/cpeuvrel/usleep-aur usleep-20220718
git+https://github.com/mirbsd/mksh mksh-20220709
git+https://github.com/onetrueawk/awk awk-20220709
+git+https://github.com/rhboot/shim.git shim-15.6
+git+https://github.com/rhboot/gnu-efi.git shim-15.6/rhboot-gnu-efi
git://git.2f30.org/pass pass-20220723
git://git.2f30.org/sdhcp sdhcp-20220716
git://git.suckless.org/9base 9base-20220706
diff --git a/pat/shim-galeb/gnu-efi-isystem.patch b/pat/shim-galeb/gnu-efi-isystem.patch
@@ -0,0 +1,13 @@
+diff --git a/Make.defaults b/Make.defaults
+index 3b56150..f00bb03 100755
+--- a/Make.defaults
++++ b/Make.defaults
+@@ -192,7 +192,7 @@ CFLAGS += $(ARCH3264) $(OPTIMIZATIONS) \
+ -ffreestanding -fno-stack-protector \
+ -fno-stack-check -nostdinc \
+ $(CFLAGS_LTO) $(CFLAGS_GCOV) \
+- -isystem $(TOPDIR)/../include/system \
++ -I $(TOPDIR)/../include/system \
+ -isystem $(shell $(CC) $(ARCH3264) -print-file-name=include) \
+ $(if $(findstring gcc,$(CC)),-fno-merge-all-constants,)
+ endif
diff --git a/pat/shim-galeb/shim-isystem.patch b/pat/shim-galeb/shim-isystem.patch
@@ -0,0 +1,78 @@
+diff --git a/Cryptlib/Makefile b/Cryptlib/Makefile
+index 89fd5cd..0ce35fa 100644
+--- a/Cryptlib/Makefile
++++ b/Cryptlib/Makefile
+@@ -8,7 +8,7 @@ FEATUREFLAGS += -nostdinc
+
+ INCLUDES = -I$(CRYPTDIR) -I$(CRYPTDIR)/Include \
+ $(EFI_INCLUDES) \
+- -isystem $(TOPDIR)/include/system \
++ -I $(TOPDIR)/include/system \
+ -isystem $(shell $(CC) -print-file-name=include)
+
+ WARNFLAGS += -Wno-unused-parameter
+diff --git a/Cryptlib/OpenSSL/Makefile b/Cryptlib/OpenSSL/Makefile
+index 795f471..ab17495 100644
+--- a/Cryptlib/OpenSSL/Makefile
++++ b/Cryptlib/OpenSSL/Makefile
+@@ -15,7 +15,7 @@ INCLUDES = -I$(OSSLDIR) -I$(CRYPTDIR) -I$(OSSLDIR)/Include/ \
+ -I$(OSSLDIR)/crypto -I$(CRYPTDIR)/Include $(EFI_INCLUDES) \
+ -I$(OSSLDIR)/crypto/asn1 -I$(OSSLDIR)/crypto/evp \
+ -I$(OSSLDIR)/crypto/modes -I$(OSSLDIR)/crypto/include \
+- -isystem $(TOPDIR)/include/system \
++ -I $(TOPDIR)/include/system \
+ -isystem $(shell $(CC) -print-file-name=include)
+
+ FEATUREFLAGS += -nostdinc
+diff --git a/Make.defaults b/Make.defaults
+index dfed9c4..c5bb900 100644
+--- a/Make.defaults
++++ b/Make.defaults
+@@ -104,7 +104,7 @@ INCLUDES = -nostdinc \
+ -I$(TOPDIR)/Cryptlib -I$(TOPDIR)/Cryptlib/Include \
+ -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH_GNUEFI) -I$(EFI_INCLUDE)/protocol \
+ -I$(TOPDIR)/include -iquote $(TOPDIR) -iquote $(shell pwd) \
+- -isystem $(TOPDIR)/include/system \
++ -I $(TOPDIR)/include/system \
+ -isystem $(shell $(CC) $(ARCH_CFLAGS) -print-file-name=include)
+
+ override DEFAULT_FEATUREFLAGS = \
+@@ -127,7 +127,7 @@ override DEFAULT_WARNFLAGS = \
+ $(call update-variable,WARNFLAGS)
+
+ override DEFAULT_WERRFLAGS = \
+- -Werror
++
+ $(call update-variable,WERRFLAGS)
+
+ CFLAGS = $(FEATUREFLAGS) \
+diff --git a/Makefile b/Makefile
+index 24ac314..de58284 100644
+--- a/Makefile
++++ b/Makefile
+@@ -171,10 +171,10 @@ lib/lib.a: | $(TOPDIR)/lib/Makefile $(wildcard $(TOPDIR)/include/*.[ch])
+ $(MAKE) VPATH=$(TOPDIR)/lib TOPDIR=$(TOPDIR) -C lib -f $(TOPDIR)/lib/Makefile
+
+ post-process-pe : $(TOPDIR)/post-process-pe.c
+- $(HOSTCC) -std=gnu11 -Og -g3 -Wall -Wextra -Wno-missing-field-initializers -Werror -o $@ $<
++ $(HOSTCC) -std=gnu11 -Og -g3 -Wall -Wextra -Wno-missing-field-initializers -o $@ $<
+
+ buildid : $(TOPDIR)/buildid.c
+- $(HOSTCC) -I/usr/include -Og -g3 -Wall -Werror -Wextra -o $@ $< -lelf
++ $(HOSTCC) -I/usr/include -Og -g3 -Wall -Wextra -o $@ $< -lelf
+
+ $(BOOTCSVNAME) :
+ @echo Making $@
+diff --git a/lib/Makefile b/lib/Makefile
+index f81c5c9..20a47b6 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -11,7 +11,7 @@ INCLUDES = $(EFI_INCLUDES) \
+ -I$(CRYPTDIR)/Include/ \
+ -I$(CRYPTDIR) \
+ -I$(TOPDIR) \
+- -isystem $(TOPDIR)/include/system \
++ -I $(TOPDIR)/include/system \
+ -isystem $(shell $(CC) -print-file-name=include)
+
+ CLANG_BUGS = $(if $(findstring gcc,$(CC)),-maccumulate-outgoing-args,)