This commit is contained in:
emmett1
2019-10-10 23:53:41 +08:00
parent 99018af3bd
commit c6604a9e3d
12 changed files with 217 additions and 11 deletions

View File

@ -141,7 +141,7 @@ PKGS="filesystem linux-api-headers man-pages glibc tzdata zlib file readline m4
perl perl-xml-parser intltool autoconf automake xz kmod gettext elfutils libffi openssl python3 coreutils
diffutils gawk findutils groff fuse2 grub less gzip iproute2 kbd libpipeline make patch man-db tar texinfo vim procps-ng
util-linux e2fsprogs sysklogd sysvinit eudev lfs-bootscripts linux-firmware libarchive mkinitramfs linux libtasn1 p11-kit ca-certificates
wget pkgutils libnl dbus libxml2 dhcpcd wpa_supplicant lzo lz4 squashfs-tools popt efivar pciutils efibootmgr"
wget pkgutils libnl dbus libxml2 dhcpcd wpa_supplicant lzo lz4 squashfs-tools popt efivar pciutils efibootmgr libpng which freetype2 dosfstools grub-efi"
if [ ! -f $LFS/var/lib/pkg/db ]; then
lfs_dirs

View File

@ -83,6 +83,29 @@ kernver=$(file $LFS/boot/vmlinuz-lfs | cut -d ' ' -f9)
chroot_run mkinitramfs -k $kernver -a livecd -o /boot/initrd-lfs.img || die "failed create initramfs"
cp $LFS/boot/initrd-lfs.img $WDIR/boot/initrd || die "failed copying initrd"
printstep "Setup UEFI mode..."
mkdir -p $WDIR/boot/{grub/{fonts,x86_64-efi},EFI}
if [ -f /usr/share/grub/unicode.pf2 ];then
cp /usr/share/grub/unicode.pf2 $WDIR/boot/grub/fonts
fi
if [ -f $WDIR/isolinux/splash.png ]; then
cp $WDIR/isolinux/splash.png $WDIR/boot/grub/
fi
echo "set prefix=/boot/grub" > $WDIR/boot/grub-early.cfg
cp -a /usr/lib/grub/x86_64-efi/*.{mod,lst} $WDIR/boot/grub/x86_64-efi || die "Failed copying efi files"
cp $FILEDIR/grub.cfg $WDIR/boot/grub/
grub-mkimage -c $WDIR/boot/grub-early.cfg -o $WDIR/boot/EFI/bootx64.efi -O x86_64-efi -p "" iso9660 normal search search_fs_file
modprobe loop
dd if=/dev/zero of=$WDIR/boot/efiboot.img count=4096
mkdosfs -n LFSLIVECD-UEFI $WDIR/boot/efiboot.img || die "Failed mkdosfs"
mkdir -p $WDIR/boot/efiboot
mount -o loop $WDIR/boot/efiboot.img $WDIR/boot/efiboot || die "Failed mount efiboot.img"
mkdir -p $WDIR/boot/efiboot/EFI/boot
cp $WDIR/boot/EFI/bootx64.efi $WDIR/boot/efiboot/EFI/boot
umount $WDIR/boot/efiboot
rm -fr $WDIR/boot/efiboot
printstep "Making the iso..."
rm -f $OUTPUT
xorriso -as mkisofs \
@ -92,6 +115,8 @@ xorriso -as mkisofs \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-eltorito-alt-boot \
-e boot/efiboot.img \
-no-emul-boot \
-isohybrid-gpt-basdat \
-volid $LABEL \

44
files/grub.cfg Normal file
View File

@ -0,0 +1,44 @@
set default=0
set timeout=99
# set debug=all
# set pager=1
insmod all_video
if loadfont /boot/grub/fonts/unicode.pf2; then
set gfxmode=800x600
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod gfxterm
insmod png
terminal_output gfxterm
fi
if background_image /boot/grub/splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set color_normal=cyan/blue
set color_highlight=white/blue
fi
menuentry "Boot Linux From Scratch (UEFI mode)" {
linux /boot/vmlinuz ro quiet
initrd /boot/initrd
}
menuentry "Boot Linux From Scratch (UEFI mode) debug" {
set background_color=black
linux /boot/vmlinuz ro verbose
initrd /boot/initrd
}
menuentry "Boot Linux From Scratch (UEFI mode) [Ram]" {
linux /boot/vmlinuz ro quiet ram
initrd /boot/initrd
}
menuentry "Boot Linux From Scratch (UEFI mode) [Ram] debug" {
set background_color=black
linux /boot/vmlinuz ro verbose ram
initrd /boot/initrd
}

View File

@ -0,0 +1,15 @@
diff -Naur lfs-bootscripts-20190908-ori/lfs/init.d/mountvirtfs lfs-bootscripts-20190908/lfs/init.d/mountvirtfs
--- lfs-bootscripts-20190908-ori/lfs/init.d/mountvirtfs 2019-09-02 16:53:46.000000000 +0800
+++ lfs-bootscripts-20190908/lfs/init.d/mountvirtfs 2019-10-10 23:43:59.889964616 +0800
@@ -56,6 +56,11 @@
mount -o mode=0755,nosuid /dev || failed=1
fi
+ if [ -d /sys/firmware/efi/efivars ]; then
+ log_info_msg2 " ${INFO}efivarfs"
+ mount -t efivarfs efivarfs /sys/firmware/efi/efivars
+ fi
+
ln -sfn /run/shm /dev/shm
(exit ${failed})

20
ports/dosfstools/Pkgfile Executable file
View File

@ -0,0 +1,20 @@
# Description: Various utilities for use with the FAT family of file systems
# URL:
# Maintainer:
# Depends on:
name=dosfstools
version=4.1
release=1
source=(https://github.com/dosfstools/dosfstools/releases/download/v$version/dosfstools-$version.tar.xz)
build() {
cd $name-$version
./configure --prefix=/ \
--enable-compat-symlinks \
--mandir=/usr/share/man \
--docdir=/usr/share/doc/$name
make
make DESTDIR=$PKG install
}

22
ports/freetype2/Pkgfile Executable file
View File

@ -0,0 +1,22 @@
# Description: Font rasterization library
# URL: https://www.freetype.org/
# Maintainer:
# Depends on: libpng which
name=freetype2
version=2.10.1
release=1
source=(https://downloads.sourceforge.net/freetype/freetype-$version.tar.xz)
build() {
cd freetype-$version
sed -ri "s:.*(AUX_MODULES.*valid):\1:" modules.cfg
sed -r "s:.*(#.*SUBPIXEL_RENDERING) .*:\1:" \
-i include/freetype/config/ftoption.h
./configure --prefix=/usr --enable-freetype-config --disable-static
make
make DESTDIR=$PKG install
}

34
ports/grub-efi/Pkgfile Executable file
View File

@ -0,0 +1,34 @@
# Description: The GRand Unified Bootloader (EFI)
# URL:
# Maintainer:
# Depends on: grub efivar efibootmgr freetype2 dosfstools
name=grub-efi
version=2.04
release=1
source=(https://ftp.gnu.org/gnu/grub/grub-$version.tar.xz
https://ftp.gnu.org/gnu/unifont/unifont-12.1.02/unifont-12.1.02.bdf.gz)
build() {
cd grub-$version
gunzip $SRC/unifont-12.1.02.bdf.gz
cp $SRC/unifont-12.1.02.bdf unifont.bdf
./configure --prefix=/usr \
--sbindir=/sbin \
--sysconfdir=/etc \
--disable-efiemu \
--enable-grub-mkfont \
--with-platform=efi \
--target=x86_64 \
--program-prefix="" \
--program-suffix="-efi" \
--with-bootdir="/boot" \
--disable-werror
make
make DESTDIR=$PKG install
rm -r $PKG/etc/ $PKG/usr/bin $PKG/sbin $PKG/usr/share/{locale,info}
rm $PKG/usr/share/grub/grub-mkconfig_lib
}

View File

@ -7,6 +7,7 @@ name=lfs-bootscripts
version=20190908
release=1
source=(http://www.linuxfromscratch.org/lfs/downloads/development/$name-$version.tar.xz
lfs-bootscripts_add-support-uefi.patch
clock
console
inittab)
@ -18,5 +19,8 @@ build() {
install -m0644 inittab $PKG/etc
cd $name-$version
patch -Np1 -i $SRC/lfs-bootscripts_add-support-uefi.patch
make DESTDIR=$PKG install
}

View File

@ -0,0 +1,15 @@
diff -Naur lfs-bootscripts-20190908-ori/lfs/init.d/mountvirtfs lfs-bootscripts-20190908/lfs/init.d/mountvirtfs
--- lfs-bootscripts-20190908-ori/lfs/init.d/mountvirtfs 2019-09-02 16:53:46.000000000 +0800
+++ lfs-bootscripts-20190908/lfs/init.d/mountvirtfs 2019-10-10 23:43:59.889964616 +0800
@@ -56,6 +56,11 @@
mount -o mode=0755,nosuid /dev || failed=1
fi
+ if [ -d /sys/firmware/efi/efivars ]; then
+ log_info_msg2 " ${INFO}efivarfs"
+ mount -t efivarfs efivarfs /sys/firmware/efi/efivars
+ fi
+
ln -sfn /run/shm /dev/shm
(exit ${failed})

20
ports/libpng/Pkgfile Executable file
View File

@ -0,0 +1,20 @@
# Description: A collection of routines used to create PNG format graphics files
# URL: http://www.libpng.org/pub/png/libpng.html
# Maintainer:
# Depends on:
name=libpng
version=1.6.37
release=1
source=(https://downloads.sourceforge.net/$name/$name-$version.tar.xz
https://downloads.sourceforge.net/project/apng/libpng/libpng16/$name-$version-apng.patch.gz)
build() {
cd $name-$version
gzip -cd $SRC/$name-$version-apng.patch.gz | patch -p0
LIBS=-lpthread ./configure --prefix=/usr --disable-static
make
make DESTDIR=$PKG install
}

17
ports/which/Pkgfile Executable file
View File

@ -0,0 +1,17 @@
# Description: A utility to show the full path of commands
# URL: https://savannah.gnu.org/projects/which
# Maintainer:
# Depends on:
name=which
version=2.21
release=1
source=(https://ftp.gnu.org/gnu/$name/$name-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/usr
make
make DESTDIR=$PKG install
}

View File

@ -3,13 +3,3 @@
passwd -d root &>/dev/null
echo "root:root" | chpasswd -c SHA512
ETHDEV=$(ls /sys/class/net/ | grep -Exv "(lo|sit0)" | head -n1)
if [ "$ETHDEV" ]; then
cat > /etc/sysconfig/ifconfig.eth0 << EOF
ONBOOT="yes"
IFACE="$ETHDEV"
SERVICE="dhcpcd"
EOF
fi