This commit is contained in:
emmett1 2020-07-02 23:33:24 +08:00
parent d4888352ff
commit fab6a7deae
77 changed files with 214 additions and 143 deletions

View file

@ -134,7 +134,7 @@ PKGS="filesystem linux-api-headers man-pages glibc tzdata zlib bzip2 file readli
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 libpng which freetype2 dosfstools grub-efi
curl ports httpup gpm libevent links"
curl ports httpup gpm libevent links mtools syslinux"
if [ ! -f $LFS/var/lib/pkg/db ]; then
lfs_dirs

View file

@ -73,7 +73,7 @@ mkdir -p $WDIR
printstep "Preparing isolinux files..."
mkdir -p $WDIR/{lfs,isolinux,boot}
for file in $isolinux_files; do
cp /usr/share/syslinux/$file $WDIR/isolinux
cp $LFS/usr/share/syslinux/$file $WDIR/isolinux || die "failed copying '$file'"
done
#cp isolinux/splash.png $WDIR/isolinux
cp $FILEDIR/isolinux.cfg $WDIR/isolinux
@ -92,19 +92,19 @@ printstep "Preparing kernel and initramfs..."
cp $LFS/boot/vmlinuz-lfs $WDIR/boot/vmlinuz || die "failed copying kernel"
cp files/livecd.hook $LFS/etc/mkinitramfs.d
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"
mv $LFS/boot/initrd-lfs.img $WDIR/boot/initrd || die "failed copying initrd"
chroot_run mkinitramfs -k $kernver -a livecd -o /boot/initrd-live.img || die "failed create initramfs"
mv $LFS/boot/initrd-live.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
if [ -f $LFS/usr/share/grub/unicode.pf2 ];then
cp $LFS/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 -a $LFS/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

0
LICENSE Normal file → Executable file
View file

0
README.md Normal file → Executable file
View file

97
enter-chroot Executable file
View file

@ -0,0 +1,97 @@
#!/bin/sh
#
# script to enter chroot
#
printhelp() {
cat << EOF
Usage:
$(basename $0) [command]
If 'command' is unspecified, ${0##*/} will launch /bin/sh.
EOF
}
msgerr() {
echo "ERROR: $*"
}
unmount() {
while true; do
mountpoint -q $1 || break
umount $1 2>/dev/null
done
}
[ "$(id -u)" = "0" ] || {
msgerr "$(basename $0) need root access!"
printhelp
exit 1
}
LFS="/mnt/lfs"
if [ -f ./config ]; then
. ./config
fi
[ -d "$LFS" ] || {
msgerr "Directory '$LFS' not exist!"
printhelp
exit 1
}
if [ ! "$1" ]; then
CMD="/bin/sh"
else
CMD=$*
fi
if [ -e /sys/firmware/efi/systab ]; then
EFI_SYSTEM=1
fi
mount --bind /dev $LFS/dev
mount -t devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -t proc proc $LFS/proc
mount -t sysfs sysfs $LFS/sys
if [ -n "$EFI_SYSTEM" ]; then
mount --bind /sys/firmware/efi/efivars $LFS/sys/firmware/efi/efivars
fi
mount -t tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then
mkdir -p $LFS/$(readlink $LFS/dev/shm)
fi
[ -f $LFS/etc/resolv.conf ] && {
backupresolvconf=1
mv $LFS/etc/resolv.conf $LFS/etc/resolv.conf.tmp
}
cp -L /etc/resolv.conf $LFS/etc
chroot "$LFS" /usr/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin $CMD
retval=$?
[ "$backupresolvconf" = 1 ] && {
mv $LFS/etc/resolv.conf.tmp $LFS/etc/resolv.conf
}
unmount $LFS/dev/pts
unmount $LFS/dev
unmount $LFS/run
unmount $LFS/proc
if [ -n "$EFI_SYSTEM" ]; then
unmount $LFS/sys/firmware/efi/efivars
fi
unmount $LFS/sys
exit $retval

0
files/core.httpup Normal file → Executable file
View file

0
files/grub.cfg Normal file → Executable file
View file

0
patches/lfs-bootscripts_add-support-uefi.patch Normal file → Executable file
View file

0
patches/pkgutils_fix-build-needed-trigger.patch Normal file → Executable file
View file

0
ports/core/.httpup-repgen-ignore Normal file → Executable file
View file

0
ports/core/REPO Normal file → Executable file
View file

0
ports/core/dbus/update Normal file → Executable file
View file

0
ports/core/efibootmgr/update Normal file → Executable file
View file

View file

View file

View file

0
ports/core/filesystem/group Normal file → Executable file
View file

0
ports/core/filesystem/issue Normal file → Executable file
View file

0
ports/core/filesystem/passwd Normal file → Executable file
View file

0
ports/core/flex/update Normal file → Executable file
View file

0
ports/core/fuse2/update Normal file → Executable file
View file

0
ports/core/gpm/update Normal file → Executable file
View file

0
ports/core/less/update Normal file → Executable file
View file

View file

0
ports/core/libevent/update Normal file → Executable file
View file

0
ports/core/libnl/update Normal file → Executable file
View file

0
ports/core/linux-firmware/update Normal file → Executable file
View file

0
ports/core/linux/config Normal file → Executable file
View file

11
ports/core/linux/post-install Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
if [ -f /lib/modules/KERNELVERSION ]; then
kver=$(cat /lib/modules/KERNELVERSION)
else
kver=$(file /boot/vmlinuz-lfs | cut -d ' ' -f9)
fi
mkinitramfs -q -k $kver -o /boot/initrd-lfs.img
depmod $kver

21
ports/core/mtools/Pkgfile Executable file
View file

@ -0,0 +1,21 @@
# Description: Utilities to access MS-DOS disks without mounting them
# URL: https://www.gnu.org/software/mtools/
# Maintainer: Emmett1, emmett1 dot 2miligrams at gmail dot com
name=mtools
version=4.0.24
release=1
source=(ftp://ftp.gnu.org/gnu/mtools/$name-$version.tar.bz2)
build() {
cd $name-$version
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--disable-floppyd
make
sed -i Makefile -e 's|install-scripts install-info|install-scripts|'
make -j1 prefix=$PKG/usr install
}

0
ports/core/perl/update Normal file → Executable file
View file

View file

@ -33,7 +33,7 @@ PKGMK_DOWNLOAD="yes"
# PKGMK_IGNORE_FOOTPRINT="no"
# PKGMK_IGNORE_NEW="no"
# PKGMK_NO_STRIP="no"
# PKGMK_DOWNLOAD_PROG="wget"
PKGMK_DOWNLOAD_PROG="curl"
# PKGMK_WGET_OPTS=""
# PKGMK_CURL_OPTS=""
PKGMK_COMPRESSION_MODE="xz"

View file

0
ports/core/ports/core.httpup Normal file → Executable file
View file

0
ports/core/python3/update Normal file → Executable file
View file

19
ports/core/syslinux/Pkgfile Executable file
View file

@ -0,0 +1,19 @@
# Description: Collection of boot loaders for the Linux operating system
# URL:
# Maintainer: Emmett1, emmett1 dot 2miligrams at gmail dot com
# Depends on: mtools
name=syslinux
version=6.03
release=1
source=(http://www.kernel.org/pub/linux/utils/boot/$name/$name-$version.tar.xz
$name-$version-sysmacros.patch)
build() {
cd $name-$version
patch -p1 -i $SRC/$name-$version-sysmacros.patch
make OPTFLAGS="$CFLAGS" installer
make OPTFLAGS="$CFLAGS" INSTALLROOT=$PKG MANDIR=/usr/share/man install
}

View file

@ -0,0 +1,34 @@
https://bugs.gentoo.org/579928
From d84db34dbe39d55b4d7e868764c056689aa0793b Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 19 Apr 2016 01:56:41 -0400
Subject: [PATCH] extlinux: pull in sys/sysmacros.h for major/minor/makedev
These functions are defined in sys/sysmacros.h, so add the include to
main.c. This is already handled correctly in mountinfo.c. Otherwise
we get build failures like:
main.o: In function 'find_device_sysfs':
extlinux/main.c:1131: undefined reference to 'minor'
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
extlinux/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/extlinux/main.c b/extlinux/main.c
index a7ebd49..ebff7ea 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -38,6 +38,7 @@
#include <sysexits.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/vfs.h>
--
2.7.4

0
ports/core/tzdata/update Normal file → Executable file
View file

0
rootfs/etc/issue Normal file → Executable file
View file

4
rootfs/root/README Normal file → Executable file
View file

@ -1,5 +1,5 @@
Linux From Scratch LiveCD (Unofficial
=====================================
Linux From Scratch LiveCD (Unofficial)
======================================
Project: https://github.com/emmett1/lfs-scripts
Email : emmett1.2miligrams@gmail.com

View file

@ -5,6 +5,9 @@ source=(https://www.kernel.org/pub/linux/kernel/v5.x/linux-$version.tar.xz)
build() {
cd linux-$version
make mrproper
make INSTALL_HDR_PATH=dest headers_install
cp -rv dest/include/* /tools/include
make headers
find usr/include -name '.*' -delete
rm usr/include/Makefile
mkdir -p /tools/include
cp -rv usr/include/* /tools/include
}

View file

@ -1,15 +0,0 @@
name=tcl
version=8.6.10
source=(https://downloads.sourceforge.net/tcl/tcl$version-src.tar.gz)
build() {
cd ${name}${version}
cd unix
./configure --prefix=/tools
make
make install
chmod -v u+w /tools/lib/libtcl8.6.so
make install-private-headers
ln -sv tclsh8.6 /tools/bin/tclsh
}

View file

@ -1,15 +0,0 @@
name=expect
version=5.45.4
source=(https://prdownloads.sourceforge.net/expect/expect$version.tar.gz)
build() {
cd ${name}${version}
cp -v configure{,.orig}
sed 's:/usr/local/bin:/bin:' configure.orig > configure
./configure --prefix=/tools \
--with-tcl=/tools/lib \
--with-tclinclude=/tools/include
make
make SCRIPTS="" install
}

View file

@ -7,7 +7,8 @@ build() {
sed -i s/mawk// configure
./configure --prefix=/tools \
./configure \
--prefix=/tools \
--with-shared \
--without-debug \
--without-ada \

View file

@ -4,7 +4,6 @@ source=(http://ftp.gnu.org/gnu/bash/bash-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/tools --without-bash-malloc
make
make install

View file

@ -1,9 +0,0 @@
name=dejagnu
version=1.6.2
source=(http://ftp.gnu.org/gnu/dejagnu/dejagnu-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/tools
make install
}

View file

@ -4,7 +4,6 @@ source=(http://ftp.gnu.org/gnu/bison/bison-$version.tar.xz)
build() {
cd $name-$version
./configure --prefix=/tools
make
make install

10
toolchain/16-findutils Executable file
View file

@ -0,0 +1,10 @@
name=findutils
version=4.7.0
source=(http://ftp.gnu.org/gnu/findutils/findutils-$version.tar.xz)
build() {
cd $name-$version
./configure --prefix=/tools
make
make install
}

View file

@ -1,16 +0,0 @@
name=findutils
version=4.7.0
source=(http://ftp.gnu.org/gnu/findutils/findutils-$version.tar.xz)
build() {
cd $name-$version
# fixes required by glibc-2.28
#sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
#sed -i '/unistd/a #include <sys/sysmacros.h>' gl/lib/mountlist.c
#echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h
./configure --prefix=/tools
make
make install
}

View file

@ -4,11 +4,6 @@ source=(http://ftp.gnu.org/gnu/gzip/gzip-$version.tar.xz)
build() {
cd $name-$version
#fixes required by glibc-2.28
#sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
#echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
./configure --prefix=/tools
make
make install

View file

@ -4,7 +4,6 @@ source=(http://ftp.gnu.org/gnu/make/make-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/tools --without-guile
make
make install

View file

@ -5,7 +5,7 @@ source=(https://github.com/libarchive/libarchive/releases/download/v$version/lib
build() {
cd $name-$version
./configure --prefix=/tools --without-xml2 --disable-shared
./configure --prefix=/tools --without-xml2
make
make install
}

View file

@ -10,6 +10,9 @@ build() {
patch -Np1 -i $PATCHDIR/pkgutils_add-compress-infopages.patch
patch -Np1 -i $PATCHDIR/pkgutils_fix-build-needed-trigger.patch
sed -i -e 's/ --static//' \
-e 's/ -static//' Makefile
make BINDIR=/tools/bin MANDIR=/tools/man ETCDIR=/tools/etc install
sed -i 's,/etc/pkgmk.conf,/tools/etc/pkgmk.conf,' /tools/bin/pkgmk
@ -32,6 +35,7 @@ PKGMK_SOURCE_DIR="/var/lib/pkg/src"
PKGMK_PACKAGE_DIR="/var/lib/pkg/pkg"
PKGMK_WORK_DIR="/var/lib/pkg/work/$name"
PKGMK_DOWNLOAD="yes"
PKGMK_DOWNLOAD_PROG="curl"
PKGMK_IGNORE_SIGNATURE="yes"
PKGMK_COMPRESSION_MODE="xz"

View file

@ -1,10 +0,0 @@
name=zlib
version=1.2.11
source=(https://zlib.net/zlib-$version.tar.xz)
build() {
cd $name-$version
./configure --prefix=/tools
make
make install
}

View file

@ -1,10 +0,0 @@
name=attr
version=2.4.48
source=(http://download.savannah.gnu.org/releases/attr/attr-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/tools
make
make install
}

View file

@ -1,10 +0,0 @@
name=acl
version=2.2.53
source=(http://download.savannah.gnu.org/releases/acl/acl-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/tools --disable-shared
make
make install
}

View file

@ -1,10 +0,0 @@
name=expat
version=2.2.9
source=(https://prdownloads.sourceforge.net/expat/expat-$version.tar.xz)
build() {
cd $name-$version
./configure --prefix=/tools
make
make install
}

View file

@ -1,9 +0,0 @@
name=lz4
version=1.9.2
source=(https://github.com/lz4/lz4/archive/v$version.tar.gz)
build() {
cd $name-$version
make PREFIX=/tools
make PREFIX=/tools install
}

View file

@ -1,17 +0,0 @@
name=wget
version=1.20.3
source=(https://ftp.gnu.org/gnu/wget/wget-$version.tar.gz)
build() {
cd $name-$version
./configure --prefix=/tools \
--with-ssl=openssl \
--without-libidn \
--without-libpsl \
--without-metalink \
--disable-pcre2
make
make install
echo "ca_certificate = /tools/etc/ssl/certs/ca-certificates.crt" > /tools/etc/wgetrc
}