insmod all_video
insmod gfxterm
insmod gfxmenu
set gfxmode=1920x1080,auto
terminal_output= gfxterm
set gfxpayload=keep
가장 마지막 공간에 16G 파티션 생성
fdisk에서 linux swap로 잡아주기
mkswap로 스왑 파일 시스템 생성
swap 파티션 앞에 50G 공유 파티션 설정
fdisk에서 linux data로 설정
mkfs.ext4로 파일 시스템 생성
[baecy@M5Pro ~ ] $ findmnt -D
SOURCE FSTYPE SIZE USED AVAIL USE% TARGET
devtmpfs devtmpfs 10M 0 10M 0% /dev
tmpfs tmpfs 13.6G 4K 13.6G 0% /dev/shm
tmpfs tmpfs 13.6G 1.6M 13.6G 0% /run
/dev/nvme0n1p4 ext4 491.1G 10.8G 455.2G 2% /
/dev/nvme0n1p1 vfat 511M 8.3M 502.7M 2% /efi
/dev/nvme0n1p127 ext4 48.9G 14.6G 31.8G 30% /mnt/shared-opt
n40l:/mnt/1st-bay/Gentoo-Bin nfs4 1.8T 68.8G 1.6T 4% /mnt/n40l/pkgdir
n40l:/mnt/1st-bay/Gentoo nfs4 1.8T 68.8G 1.6T 4% /mnt/n40l/srcpkg
tmpfs tmpfs 2.7G 4M 2.7G 0% /run/user/1000
/etc/fstab 수정# Main
/dev/nvme0n1p4 / ext4 defaults,noatime 1 2
/dev/nvme0n1p128 none swap sw 0 0
/dev/nvme0n1p1 /efi vfat umask=0077,tz=UTC 0 0
# Shared Opt
/dev/nvme0n1p127 /mnt/shared-opt ext4 defaults 0 0
# N40L NFS Mount
n40l:/mnt/1st-bay/Gentoo-Bin /mnt/n40l/pkgdir nfs _netdev,defaults 0 0
n40l:/mnt/1st-bay/Gentoo /mnt/n40l/srcpkg nfs _netdev,defaults 0 0
아래의 내용 중 VERSION에서 Gentoo_HOME까지의 내용중 필요한 것을 수정해서 사용하시면 됩니다.
#!/bin/bash
# Begin auto-lfs
#
# For Gentoo 12.1-systemd
# you can use it after proceeding with <7.2 Changing Owner>
# Mount and unmount kernel virtual file system and entering to chroot environment
VERSION=0.1.7
Gentoo=/mnt/gentoo
Gentoo_PART=/dev/nvme0n1p10
Gentoo_BOOT=/dev/nvme0n1p6
Gentoo_EFI=/dev/nvme0n1p2
Gentoo_HOME=/dev/nvme0n1p7
# Dedicated partition mount argument is s , -s , start
if [ "$1" == "s" ] || [ "$1" == "-s" ] || [ "$1" == "start" ]; then
if ! mountpoint -q $Gentoo; then mount $Gentoo_PART $Gentoo; fi
if ! mountpoint -q $Gentoo/boot; then mount $Gentoo_BOOT $Gentoo/boot; fi
if ! mountpoint -q $Gentoo/boot/efi; then mount $Gentoo_EFI $Gentoo/boot/efi; fi
if ! mountpoint -q $Gentoo/home; then mount $Gentoo_HOME $Gentoo/home; fi
if ! mountpoint -q /mnt/n40l/Gentoo; then mount n40l:/mnt/1st-bay/Gentoo /mnt/n40l/Gentoo; fi
# Mount point dirctory check
if [ ! -d $Gentoo/dev ]; then
echo "Make necessary directories"
mkdir -pv $Gentoo/{dev,proc,sys,run}
else
echo "All required directories have been verified."
fi
fi
# To prepare for run 'chroot', run 'umount' block if a directory exists, or run 'mount' block
case $1 in
clean|c|-c)
if mountpoint -q $Gentoo; then
# Unmount Kernel Virtual File System used in previous Gentoo sessions.
echo "Gentoo is now set to '"$Gentoo"'"
echo "Now proceed with the unmount of <Kernel Virtual File System> for chroot"
umount -q -l $Gentoo/dev/{shm,pts}
umount -q -R $Gentoo
sleep 10
for kvfs in dev/shm dev/pts sys proc run dev ; do
if mountpoint $Gentoo/$kvfs; then umount -q $Gentoo/$kvfs; fi
done
findmnt -o FSTYPE,SIZE,USED,AVAIL,USE%,TARGET | grep lfs
echo "Ok unmount unnecessary devices"
echo "Good bye"
exit 0
else
echo "Cleanup of Kernel Virtual File System is Complete."
findmnt -o FSTYPE,SIZE,USED,AVAIL,USE%,TARGET | grep gentoo
exit 0
fi
;;
start|s|-s)
# Mount the Kernel Virtual File System to Enter Gentoo chroot environment.
echo "Now proceed with the mount of <Kernel Virtual File System> for chroot"
echo "Gentoo is now set to '"$Gentoo"'"
if ! mountpoint -q $Gentoo/proc; then mount --type proc /proc $Gentoo/proc; fi
if ! mountpoint -q $Gentoo/dev; then mount --rbind /dev $Gentoo/dev; mount --make-rslave $Gentoo/dev; fi
if ! mountpoint -q $Gentoo/sys; then mount --rbind /sys $Gentoo/sys; mount --make-rslave $Gentoo/sys; fi
if ! mountpoint -q $Gentoo/run; then mount --rbind /run $Gentoo/run; mount --make-rslave $Gentoo/run; fi
if ! mountpoint -q $Gentoo/mnt/Gentoo; then mount --rbind /mnt/n40l/Gentoo $Gentoo/Gentoo; fi
findmnt -o FSTYPE,SIZE,USED,AVAIL,USE%,TARGET | grep gentoo
# Run 'chroot'
chroot "$Gentoo" $(type -p env) -i \
HOME=/root \
TERM="$TERM" \
PS1='<Gentoo> \u@\h [ \w ] \$ '\
PATH=/usr/bin:/usr/sbin \
MAKEFLAGS="-j$(nproc)" \
TESTSUITEFLAGS="-j$(nproc)" \
NINJAJOBS="$(nproc)" \
/bin/bash --login
exit 0
;;
version|v|-v)
echo "Gentoo chroot script $VERSION"
exit 0
;;
help|h|-h)
echo "Gentoo chroot script $VERSION"
echo "Usage:"
echo "clean or c- Unmount Kernel Virtual File System"
echo "start or s- Mount and run 'chroot' command with necessary variables"
echo "version or v- Print script version"
echo "help or h - This screen"
exit 0
;;
*)
#Guidance on the factors needed to execute script
echo "sh ./Auto_Gentoo.sh [ start | clean | help | version ]"
exit 0
;;
esac