This commit is contained in:
emmett1 2019-10-16 17:23:02 +08:00
parent c6604a9e3d
commit 9e94a4e515
11 changed files with 189 additions and 19 deletions

View file

@ -55,6 +55,8 @@ source $CWD/config
isolinux_files="chain.c32 isolinux.bin ldlinux.c32 libutil.c32 reboot.c32 menu.c32 libcom32.c32 poweroff.c32"
OUTPUT=$OUTPUT.iso
rm -fr $WDIR
mkdir -p $WDIR
@ -81,7 +83,7 @@ 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"
cp $LFS/boot/initrd-lfs.img $WDIR/boot/initrd || die "failed copying initrd"
mv $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}

2
config
View file

@ -10,7 +10,7 @@ FILEDIR=$CWD/files
WORKDIR=/tmp
LABEL=LFSLIVECD
OUTPUT=lfslivecd.iso
OUTPUT=lfs-livecd-$(date +"%Y%m%d")
WDIR=/tmp/lfsiso
#MULTILIB=yes

View file

@ -23,9 +23,9 @@ build() {
mkdir -p $PKG/etc/sysconfig/
cat > $PKG/etc/sysconfig/ifconfig.eth0 << "EOF"
#ONBOOT="yes"
#IFACE="eth0"
#SERVICE="dhcpcd"
ONBOOT="no"
IFACE="eth0"
SERVICE="dhcpcd"
#DHCP_START="-b -q <insert appropriate start options here>"
#DHCP_STOP="-k <insert additional stop options here>"
EOF

View file

@ -70,7 +70,7 @@ build() {
# /etc
install -d $PKG/etc
for p in profile bashrc resolv.conf inputrc fstab hostname hosts shells passwd group; do
for p in profile bashrc resolv.conf inputrc fstab hostname hosts passwd group; do
install -m0644 $p $PKG/etc
done

View file

@ -5,10 +5,7 @@
#/dev/<xxx> / <fff> defaults 1 1
#/dev/<yyy> swap swap pri=1 0 0
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
# End /etc/fstab

View file

@ -6,8 +6,7 @@
name=grub
version=2.04
release=1
backup=(etc/default/grub)
source=(https://ftp.gnu.org/gnu/$name/$name-$version.tar.xz)
source=(https://ftp.gnu.org/gnu/$name/$name-$version.tar.xz grub.default)
build() {
cd $name-$version
@ -20,4 +19,6 @@ build() {
--enable-grub-mount
make
make DESTDIR=$PKG install
install -D -m0644 $SRC/grub.default $PKG/etc/default/grub
}

54
ports/grub/grub.default Executable file
View file

@ -0,0 +1,54 @@
# GRUB boot loader configuration
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Linux From Scratch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y
# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true
# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console
# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto
# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep
# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true
# Uncomment and set to the desired menu colors. Used by normal and wallpaper
# modes only. Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"
# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"
# Uncomment to make GRUB remember the last selection. This requires to
# set 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT="true"

View file

@ -4,13 +4,11 @@
# Depends on:
name=linux-firmware
version=20190717
version=20190923
release=1
source=(https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-$version.tar.gz)
build() {
cd $name-$version
make DESTDIR=$PKG install
rm $PKG/lib/firmware/{Makefile,README,configure,GPL-3,*.txt,check_whence.py}
}

View file

@ -67,14 +67,14 @@ EOF
mkdir -p $PKG/etc/sysconfig
cat > $PKG/etc/sysconfig/ifconfig.wifi0 << "EOF"
#ONBOOT="yes"
#IFACE="wlan0"
#SERVICE="wpa"
ONBOOT="no"
IFACE="wlan0"
SERVICE="wpa"
# Additional arguments to wpa_supplicant
#WPA_ARGS=""
WPA_ARGS=""
#WPA_SERVICE="dhcpcd"
WPA_SERVICE="dhcpcd"
#DHCP_START="-b -q <insert appropriate start options here>"
#DHCP_STOP="-k <insert additional stop options here>"
EOF

85
rootfs/sbin/lfs-chroot Executable file
View file

@ -0,0 +1,85 @@
#!/bin/bash
printhelp() {
cat << EOF
Usage:
$(basename $0) <newroot> <command>
(omit command to chroot only)
EOF
}
msgerr() {
echo -e "ERROR: $@"
}
if [ "$UID" != "0" ]; then
msgerr "$(basename $0) need root access!"
printhelp
exit 1
fi
LFS=$1
if [ -z $1 ]; then
msgerr "Please set directory for chroot!"
printhelp
exit 1
fi
if [ ! -d $LFS ]; then
msgerr "Directory '$LFS' not exist"
printhelp
exit 1
fi
shift
CMD=$@
if [ -z $2 ]; then
CMD="/bin/bash --login"
fi
if [ -e /sys/firmware/efi/systab ]; then
EFI_SYSTEM=1
fi
pushd $LFS &>/dev/null
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
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=$?
popd &>/dev/null
umount $LFS/dev/pts
umount $LFS/dev
umount $LFS/run
umount $LFS/proc
if [ -n "$EFI_SYSTEM" ]; then
umount $LFS/sys/firmware/efi/efivars
fi
umount $LFS/sys
exit $retval

33
rootfs/sbin/lfs-install Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
LFSMOUNT=$1
if [ ! "$LFSMOUNT" ]; then
echo "mounted location for install not define!"
exit 1
fi
if ! mountpoint -q $LFSMOUNT; then
echo "'$LFSMOUNT' is not a mountpoint!"
exit 1
fi
if [ -f "/run/initramfs/ram/root.sfs" ]; then
ROOTSFS="/run/initramfs/ram/root.sfs"
elif [ -f "/run/initramfs/medium/lfs/root.sfs" ]; then
ROOTSFS="/run/initramfs/medium/lfs/root.sfs"
else
echo "squashed image not found!"
exit 1
fi
unsquashfs -f -i -d $LFSMOUNT $ROOTSFS
if [ "$?" = "0" ]; then
echo "Successfully installed to '$LFSMOUNT'"
else
echo "failed to install lfs system"
exit 1
fi
exit 0