Gentoo

June 15, 2024

setup rootfs

https://www.gentoo.org/downloads/
https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-hardened-nomultilib-openrc/
https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
https://www.gentoo.org/downloads/mirrors/

sudo mkfs.fat -F 32 /dev/sda1  
sudo mkfs.ext4 /dev/sda6  
sudo mke2fs -t ext4 -O ^has_journal /dev/sda5  
sudo mount /dev/sda6 /mnt  
sudo mount /dev/sda1 /mnt/efi       #if efi partition isnt mounted  

cd ~/Downloads  
sudo tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt     #use tab after stage3 if many stage3   

 df -h /dev/sda6   
Filesystem      Size  Used Avail Use% Mounted on  
/dev/sda6        40G  1.4G   36G   4% /mnt  

sudo cp --dereference /etc/resolv.conf /mnt/etc/


chroot

chroot.sh


#!/bin/sh  
mount --rbind /dev /mnt/dev && mount --make-rslave /mnt/dev
mount --rbind /dev/pts /mnt/dev/pts && mount --make-rslave /mnt/dev/pts
mount --rbind /proc /mnt/proc && mount --make-rslave /mnt/proc
mount --rbind /sys /mnt/sys && mount --make-rslave /mnt/sys
chroot  /mnt /bin/bash

sudo bash chroot.sh

source /etc/profile 
export PS1="(chroot) ${PS1}"

compiler and use flags

nano /etc/portage/make.conf



 COMMON_FLAGS="-O2 -pipe -march=native"
 #ram/2 or nproc, if unset defaults to nproc
MAKEOPTS="-j4 -l5"

USE="-dbus -polkit -introspection -pulseaudio -llvm -X"

ACCEPT_LICENSE="*"
VIDEO_CARDS="intel "
INPUT_DEVICES="libinput"

sync

emerge-webrsync

use binpkg for heavy apps

emerge --getbinpkg pkgname
getuto   #get keyring else FEATURES="binpkg-request-signature" in make.conf
emerge --ask --verbose -G  gcc
emerge --ask --verbose -G media-libs/libva-intel-media-driver  #not availabe for hardened 


emerge --ask --oneshot app-portage/cpuid2cpuflags
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

eselect profile list 
eselect profile set xx  #if update profile required
emerge --ask --verbose --update --deep --newuse @world
emerge --ask --pretend --depclean

setup timezone

 echo "Asia/Kathmandu" > /etc/timezone
 emerge --config sys-libs/timezone-data
or just
ln -s /usr/share/zoneinfo/Asia/Kathmandu /etc/localtime

portage tmpdir

to save disk write as it extract and build src code in this dir nano /etc/fstab

tmpfs		/var/tmp/portage		tmpfs	size=2G,uid=portage,gid=portage,mode=775	0 0
mount /var/tmp/portage

/etc/portage/env/notmpfs.conf

PORTAGE_TMPDIR="/var/tmp/notmpfs"
mkdir /var/tmp/notmpfs
chown portage:portage /var/tmp/notmpfs
chmod 775 /var/tmp/notmpfs 

/etc/portage/package.env

sys-devel/gcc			notmpfs.conf

localization

nano /etc/locale.gen

en_US.UTF-8 UTF-8
locale-gen

git sync gentoo


emerge -a gentoolkit eix iwd eselect-repository

emerge eselect-repository dev-vcs/git  
rm -r /var/db/repos/gentoo
eselect repository enable gentoo

emerge --sync

use flags

cat /etc/portage/package.use/all


app-admin/doas persist

dev-libs/light udev
sys-apps/util-linux   udev
sys-devel/gcc -zstd
sys-apps/openrc -netifrc
net-wireless/iwd standalone -monitor


media-libs/mesa vaapi 
x11-libs/libdrm udev
sys-auth/seatd server builtin
gui-wm/sway -swaynag
x11-misc/i3blocks -contrib
media-video/mpv -xv alsa vaapi drm lcms
media-video/ffmpeg  vaapi alsa  mp3 libdrm lcms vorbis
media-libs/libva-intel-media-driver redistributable
media-libs/freetype  harfbuzz
app-misc/nnn -pcre
app-text/mupdf -javascript
app-text/zathura-pdf-mupdf -javascript


emerge media-libs/mesa

avoiding rust for now

cat /etc/portage/profile/package.provided

gnome-base/librsvg-2.57.3

cat /var/lib/portage/world

app-admin/doas
app-eselect/eselect-repository
app-misc/neofetch
app-misc/nnn
app-portage/eix
app-portage/gentoolkit
app-shells/bash-completion
app-text/zathura-pdf-mupdf
dev-libs/light
dev-vcs/git
gui-apps/foot
gui-apps/wl-clipboard
gui-apps/wmenu
gui-apps/wofi
gui-wm/sway
media-libs/alsa-lib
media-libs/libva-intel-media-driver
media-libs/mesa
media-sound/alsa-utils
media-sound/apulse
media-video/mpv
net-wireless/iwd
net-wireless/wireless-regdb
sys-apps/pciutils
sys-fs/dosfstools
sys-fs/ntfs3g
sys-kernel/gentoo-sources
sys-process/htop
#for firefox
x11-libs/gtk+
x11-libs/libXcomposite
x11-libs/libXcursor
x11-libs/libXdamage
x11-libs/libXi
x11-libs/libXrandr

meson args via profile
/etc/portage/env/x11-base/xorg-server
MYMESONARGS=”-Dglx=true”

# codecs for av1 : media-libs/dav1d,media-libs/libaom(refrence,complete) , media-libs/svt-av1(intel+netflix,fast), media-video/rav1e(rust+asm xiph.org)
firefox system-av1 : dav1d,libaom,media-video/libva-utils,sys-apps/pciutils

media-libs/libjpeg-turbo,media-libs/libvpx postproc,media-libs/libpng apng,media-libs/libwebp https://en.wikipedia.org/wiki/AV1

#continue ebuild ebuild $(equery w opencv) merge
ebuild /var/db/xxx/xxx.ebuild compile , install

https://github.com/kzwkt/gentoo-dell-inspiron-3501
https://wiki.gentoo.org/wiki/Dell_Inspiron_3501