# Gentoo ## Setup network ln -s /etc/init.d/net.lo /etc/init.d/net.eth0 /etc/init.d/net.eth0 emacs /etc/conf.d/net #add domain name #or rc-service dhcpcd start rc-update add dhcpcd ## Start sshd rc-service sshd start ## Install open-vm-tools emerge --ask app-emulation/open-vm-tools ## check for installed files qlist pybugz | grep bin ## check for the package containing the installed file equery b /usr/share/edk2-ovmf/OVMF_CODE.fd ## list dependent packages of a package equery depends llvm ## Remove/uninstall if no dependents emerge -cav www-client/firefox ## Remove even if there are dependents emerge -C www-client/firefox ## Remove all old packages emerge -ca emerge --depclean -a ## Remerge all dependencies. emerge -eav ## Remove older distfiles and binpkgs eclean-dist -d eclean-pkg -d ## add package to world emerge --noreplace boost cmake or add to /var/lib/portage/world ## unmerge with dependents emerge --deselect $package followed by emerge -ca emerge -uUDa @world && emerge -ca ## add -O to ignore blocks ## if conflicts -1 ## --autounmask=n if don't want to pull masked packages ## binpkg -gkKG ## run this after kernel upgrade else graphics modules for nvidia won't load emerge @module-rebuild emerge @x11-module-rebuild ## rebuild pkges whose lib dependecies are renamed during their upgrade emerge @preserved-rebuild ### gentoo-kernel echo "sys-kernel/gentoo-kernel savedconfg" > /etc/portage/package.use/world ebuild /var/db/repos/gentoo/sys-kernel/gentoo-kernel/gentoo-kernel-6.1.22.ebuild configure cd /var/tmp/portage/sys-kernel/gentoo-kernel-6.1.22/work/modprep/ make menuconfig ebuild /var/db/repos/gentoo/sys-kernel/gentoo-kernel/gentoo-kernel-6.1.22.ebuild configure ebuild /var/db/repos/gentoo/sys-kernel/gentoo-kernel/gentoo-kernel-6.1.22.ebuild merge ## emerge variables USE FEATURES ## list all emerge variables emerge --info ## update use dispatch-conf cfg-update etc-update ## red = use flag was and is still enabled ## blue = use flag was and is still disabled ## yellow = use flag will change with this emerge, also shows percent sign for a cue without colors ## N = new, R = reinstall same version, U = upgrade version, D = downgrade, S = slotted package, B = package blocking occurred [=] - dependency-package should have same use flag of the dependent-package. e.g openssh -> openssl[bindist=] ## TODO: Set CONFIG_VMWARE_BALLOON CONFIG_VMWARE_VMCI CONFIG_VMWARE_VMCI_VSOCKETS ## enable service /sbin/rc-update add default rc-service avahi-daemon start ## Sync entire system to new USE flags emerge --update --deep --with-bdeps=y --newuse --ask --verbose --keep-going -k @world --exclude "net-libs/nodejs cross-aarch64-unknown-linux-musl/gcc net-libs/nodejs cross-aarch64-unknown-linux-musl/* dev-lang/rust virtual/rust mail-client/evolution cross-aarch64-unknown-linux-musl/binutils sys-devel/llvm-common sys-devel/llvm sys-devel/clang-common sys-devel/clang-runtime sys-devel/clang sys-cluster/ceph app-office/libreoffice-l10n app-office/libreoffice net-print/cups" ## !!! Multiple package instances within a single package slot have been pulled ## !!! into the dependency graph, resulting in a slot conflict: emerge --ask --oneshot =app-emulation/emul-linux-x86-xlibs-20120520 ## To emerge the library alone USE="-*" emerge pidgin ## Install sources and debug symbols for some-package or some-library vi /etc/portage/env/debugsyms CFLAGS="${CFLAGS} -ggdb" CXXFLAGS="${CXXFLAGS} -ggdb" FEATURES="${FEATURES} splitdebug compressdebug -nostrip" USE="debug" vi /etc/portage/env/installsources FEATURES="${FEATURES} installsources" vi /etc/portage/package.env category/some-package debugsyms category/some-library debugsyms installsources emerge debugedit ## Accept Keywords specify whether to use stable or unstable start with =, <= and (>= or nothing) ## Time echo "Asia/Kolkata" > /etc/timezone emerge --config sys-libs/timezone-data ## if connected over ssh check the client terminal's locale setting vi /etc/locale.gen locale-gen vi /etc/conf.d/hwclock eselect locale list eselect locale set 5 env-update && source /etc/profile ## startx `rc-update add elogind boot` ## set hostname root #nano -w /etc/conf.d/hostname ## Set the hostname variable to the selected host name hostname="tux" ## set domain root #nano -w /etc/conf.d/net ## Set the dns_domain_lo variable to the selected domain name ``` dns_domain_lo="FerryFair.com" config_end1="dhcp" routes_end1="192.168.2.0/24 via 192.168.100.2 192.168.0.0/24 via 192.168.100.2" ``` ## Check available package versions eix udftools ## Check package stability equery keywords ## check ebuild to which a file belongs to equery b /usr/include/error.h ## Install specific version emerge --ask --autounmask-write =sys-fs/udftools-2.0 ## nano /etc/sysctl.conf net.ipv4.ip_forward = 1 net.ipv4.conf.default.rp_filter = 1 ## stacked runlevel `sudo rc-update -s add default bsp` ## List available C compilers gcc-config -l ## Switch to compiler profile gcc-config aarch64-unknown-linux-gnu-8.2.0 ## Cross compile ``` emerge --ask sys-devel/crossdev sudo eselect repository create cross_llvm-aarch64-gentoo-linux-musl ``` - edit `/etc/portage/repos.conf/eselect-repo.conf` ``` [cross_llvm-aarch64-gentoo-linux-musl] location = /var/db/repos/cross_llvm-aarch64-gentoo-linux-musl priority = 10 masters = gentoo auto-sync = no ``` ``` sudo crossdev -oS cross_llvm-aarch64-gentoo-linux-musl --llvm --target aarch64-gentoo-linux-musl crossdev -C cross_llvm-aarch64-unknown-linux-musl binutils-config aarch64-unknown-linux-musl crossdev -t help ``` ## -S for stable CFLAGS="-O2 -pipe" crossdev -t aarch64-unknown-linux-musl ## if this fails with package is masked then add the package like ## =cross-aarch64-unknown-linux-musl/musl-1.2.2-r7 ## in /etc/portage/package.unmask/world emerge --sync portage-crossdev emerge-wrapper --target aarch64-unknown-linux-musl --init cd /usr/aarch64-unknown-linux-musl emacs etc/portage/make.conf ## adjust -march on emerge zlib error cd etc/portage ln -s ../../usr/portage/profiles/default/linux/arm64/17.0 make.profile sudo ARCH=arm64 PORTAGE_CONFIGROOT=/usr/aarch64-unknown-linux-musl/ CROSS_COMPILE=aarch64-unknown-linux-musl- eselect profile set --force 11 eselect kernel linux-rpi aarch64-unknown-linux-musl-emerge -avkNU @system cd /usr/aarch64-unknown-linux-musl/ mount_n_chroot sudo FEATURES="-xattr" emerge -avk @world ## package.mask has precedence over package.unmask ## attach logs bugz attach -c "text/plain" -d "build log" $bugnumber $log CCACHE_DISABLE=YES CCACHE_RECACHE=yes emerge --oneshot cat/pkg ccache -s shows cache hit statistics ARCH=arm64 PORTAGE_CONFIGROOT=/usr/aarch64-RPi3B-linux-musl CROSS_COMPILE=aarch64-RPi3B-linux-musl- ebuild /usr/portage/sys-libs/pam/pam-1.3.0-r2.ebuild {digest|unpack|prepare|compile|preinst|install|postinst|qmerge|merge} ROOT="/" CBUILD=aarch64-unknown-linux-musl HOSTCC=${CBUILD}-gcc PORTAGE_TMPDIR=${ROOT}tmp/ CCACHE_DIR="${ROOT}/var/CCache" emerge --update --deep --with-bdeps=y --newuse --ask --verbose @world aarch64-...-emerge --root=/mnt/sdb2 --sysroot=/mnt/sdb2 -Kav @world git diff | tee ../files/indent.patch ## local patches - `` ## save iptables sudo rc-service iptables save ## grub grub-install --target=x86_64-efi --efi-directory=/boot grub-mkconfig -o /boot/grub/grub.cfg ## fonts emerge -av noto noto-emoji ## RaspberryPi make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-musl- menuconfig rc-update del hwclock boot nano /etc/portage/make.conf ACCEPT_KEYWORDS="~arm64" emerge --sync or emerge-webrsync emaint sync --auto eselect profile list emerge --update --deep --with-bdeps=y --newuse --ask --verbose -k @world echo "*/*::rpi3 ~arm64" >> /etc/portage/package.accept_keywords/rpi3-repo ## Check distributed cc DISTCC_DIR="/var/tmp/portage/.distcc/" distccmon-text 1 ## useful emerge packs emerge bc ## select default python eselect python list mkdir -pv $LFS/{dev,proc,sys,run} mknod -m 600 $LFS/dev/console c 5 1 mknod -m 666 $LFS/dev/null c 1 3 ## shairport-sync airplay emerge -av dev-libs/libdaemon dev-libs/popt sys-devel/libtool app-doc/xmltoman dev-libs/libconfig ## gnome suspend or sleep Alt + mouse over power button ## USE flags meaning bindist - "binary distribution" It will disable the compilation of patented code ### Android adb shell su - /data/gentoo/usr/local/bin/gentoo_init