标签:
# Disk plan # 参考,实际仅在现有分区安装测试
/EFI EFI
/boot vfat/ext2 # 分离boot、efi分区,用于BIOS & UEFI共享启动分区
/ ext4
/home ext4
/usr ext4 # 分离usr,用于通过验证后迁移至较小的固态盘
#/var ext4 # 暂不需要
swap swap
# Download stage3 && verify by sha512sum
tar xvjpf stage3-*.tar.bz2 --xattrs # p、--xattrs选项用于保持原有权限
# /etc/portage/make.conf
#CFLAGS="-march=native -O2 -pipe"
#CXXFLAGS="${CFLAGS}"
#MAKEOPTS="-j3"
# Select repo mirrors
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
mkdir /mnt/gentoo/etc/portage/repos.conf
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
# /etc/resolv.conf
cp -L /etc/resolv.conf /mnt/gentoo/etc/
# Mount all dir && chroot to new env
mount /dev/sdb4 /mnt/gentoo
mount /dev/sdb3 /mnt/gentoo/boot
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
#source /etc/profile
#PS1="(chroot) $PS1"
# Config portage
emerge-webrsync
emerge --sync
# Select profile
eselect profile list/set
#emerge --ask --update --deep --newuse @world
# Config USE /etc/portage/make.conf
# Config time area
echo "Asia/Shanghai" > /etc/timezone
emerge --config sys-libs/timezone-data
# Config language support /etc/locale.gen & /etc/env.d/02locale
locale-gen
eselect locale list/set
# Complie kernel # OpenRC,VM,文件系统:ext2、ext4、vfat、ntfs
emerge --ask sys-kernel/gentoo-sources
#emerge --ask sys-apps/pciutils
cd /usr/src/linux
make menuconfig
make && make modules_install
make install
mkdir -p /boot/efi/boot # 官方内容
cp /boot/vmlinuz-* /boot/efi/boot/bootx64.efi
# Create initramfs
emerge --ask sys-kernel/genkernel # Use to create initramfs file or auto compile kernel
genkernel --install initramfs
# Install Grub2
emerge --ask sys-boot/grub:2 # MBR
grub2-install /dev/sda
echo GRUB_PLATFORMS="efi-64" >> /etc/portage/make.conf # UEFI
emerge --ask sys-boot/grub:2
#emerge --ask --update --newuse --verbose --ask sys-boot/grub:2
grub2-install --target=x86_64-efi --efi-directory=/boot
grub2-mkconfig -o /boot/grub/grub.cfg
# Config init env
/etc/fstab
/etc/conf.d/hostname
/etc/conf.d/net # Set config_eth0= && routes_eth0=
ln -s net.lo net.eth0
rc-update add net.eth0 default
#/etc/rc.conf
#/etc/conf.d/keymaps
#/etc/conf.d/hwclock
# Sys tools "*Syslogd *dhcpcd cronie mlocate ..."
#emerge --ask sys-kernel/linux-firmware
emerge --ask app-admin/sysklogd # Syslog
rc-update add sysklogd default
emerge --ask net-misc/dhcpcd
emerge --ask --noreplace net-misc/netifrc # Net tools
emerge --ask sys-apps/pcmciautils
# Exit && reboot to new OS
#umount -l /mnt/gentoo/dev{/shm,/pts,}
#umount /mnt/gentoo{/boot,/sys,/proc,}
#reboot
# References:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
http://www.jinbuguo.com/kernel/longterm-3_10-options.html # 内核选项
标签:
原文地址:http://www.cnblogs.com/NewBrash/p/5495320.html