Cobra MK III
Můj nový počítač
2024.04.10-Cobra2024
2024.04.10 19:57:46 SW Cobra-Mk3 gentoo Gilhad

mount /dev/nvme0n1p12 /mnt/gentoo
mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash

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

1   2024.04.10-Cobra2024

Rozhodl jsem se, že konečně udělám další systém, tentokrát pro běžné používání na všechno a s aktuálními balíčky, které budu relativně často updatovat, protože to počítač upočítá a já uý nechci věci oddělovat a zápasit se zpětnou kompatibilitou.

Los padl na partišnu 12 - devAVR, kde sice byl zárodek systému, ale ještě ani jeden uživatel. Takže všechno špatně, zpátky na stromy, bude to Cobra2024

parted  /dev/nvme0n1 name 12 NVM-Cobra2024
mount /dev/nvme0n1p12 /mnt/gentoo
cd /mnt/gentoo
#rm -rf vsechno
# ext4
parted  /dev/nvme0n1 print >>partitions.txt
# links https://www.gentoo.org/downloads/ AMD64  Stage 3 openrc
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20240407T165048Z/stage3-amd64-openrc-20240407T165048Z.tar.xz
tar xpf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
mv etc/portage/make.conf etc/portage/00-make.conf
mkdir etc/portage/make.conf
mv etc/portage/00-make.conf etc/portage/make.conf
echo 'MAKEOPTS="-j26 "'>>etc/portage/make.conf/00-make.conf
echo 'FEATURES="${FEATURES} parallel-fetch"'>>etc/portage/make.conf/00-make.conf
echo 'GENTOO_MIRRORS="$GENTOO_MIRRORS http://gilhad-repo.giltoo.gilhad.cz http://distfiles.gentoo.org http://mirror.dkm.cz/gentoo/ http://gentoo.mirror.web4u.cz/ https://mirror.wheel.sk/gentoo https://www.mirrorservice.org/sites/distfiles.gentoo.org/ http://ftp.fi.muni.cz/pub/linux/gentoo/ http://gentoo.cs.utah.edu/"' >>etc/portage/make.conf/00-make.conf

cat >>etc/portage/make.conf/02-USE <<EOF
USE="\$USE -xdg"# je to zrudnost
USE="\$USE -zeroconf"# je to zrudnost
USE="\$USE -subversion"# nechci ani v gitu
USE="\$USE -ipv6"# nepouzivame
USE="\$USE mysql"# nase hlavni db
USE="\$USE -berkleydb"# nepouzivame
USE="\$USE webp"# protoze se to siri jak mor
USE="\$USE X"# Xka asi chceme
# USE="\$USE -libglvnd"# asi nechceme
USE="\$USE -pulseaudio"# nechci pulseaudio
USE="\$USE mp3 vorbis"
USE="\$USE lm-sensors"
USE="\$USE ffmpeg ogg alsa sqlite opengl png sdl gif jpeg"
USE="\$USE -udisks"     # automagicka sprava disku
USE="\$USE -filecaps"   # asi nechci
# USE="\$USE -tmpfiles -boot"   # sytemd kraviny
# USE="\$USE -elogind"  # sytemd kraviny
USE="\$USE -nullok -passwdqc"   # novy check na komplexitu hesel
EOF

cat >>etc/portage/make.conf/debianutils <<EOF
USE="\$USE -installkernel"      # nechci instalivate kernel prez "make install", kopiruju bzImage rucne bez magie
USE="\$USE logrotate -anacron"  # rotuju prez logrotate, anacron nepouzivam
EOF
mkdir --parents /mnt/gentoo/etc/portage/repos.conf
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"

>/root/.bc
df -h  /
# Filesystem       Size  Used Avail Use% Mounted on
# /dev/nvme0n1p12   98G  1.7G   92G   2% /

emerge --sync
eselect news list
eselect news read

eselect profile list
#eselect profile set

emerge --ask --verbose --update --deep --newuse @world -q --load-average --jobs

echo "Europe/Prague" > /etc/timezone
emerge --config sys-libs/timezone-data

echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen
echo "cs_CZ.UTF-8 UTF-8" >>/etc/locale.gen
locale-gen

echo >>/etc/env.d/02locale 'LANG="C"'
echo >>/etc/env.d/90gilhad_xsession 'XSESSION="fluxbox"'
echo >>/etc/env.d/02gilhad_editor 'EDITOR=vim'
echo >>/etc/env.d/02gilhad_locale 'LC_CTYPE=cs_CZ.utf8'
env-update && source /etc/profile && export PS1="(chroot) ${PS1}"

mkdir /etc/portage/package.license
echo -e "sys-kernel/linux-firmware\tlinux-fw-redistributable no-source-code" >>/etc/portage/package.license/GPU
emerge -avq sys-kernel/linux-firmware

echo "x11-drivers/xf86-video-amdgpu udev" >> /etc/portage/package.use/GPU
echo "x11-libs/libdrm video_cards_radeon" >> /etc/portage/package.use/GPU
echo 'VIDEO_CARDS="amdgpu radeonsi"' >>/etc/portage/make.conf/GPU

emerge -avq sys-boot/efibootmgr
mount | grep efivars # must be RW otherwise try somthing like

# mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars
efibootmgr -v # just list entries for fun :)

emerge --ask --verbose --update --deep --newuse  -q --load-average --jobs -N sys-kernel/gentoo-sources sys-apps/pciutils
lspci
ls -al /usr/src/

cd /usr/src/
ln -s inux-6.6.21-gento linux l# nebo jaka je nova verze

cd /usr/src/linux
make menuconfig
Nastavení kernelu

Sensor driver: X570 boards (no WMI interface - use nct6775 driver instead)

(root=/dev/nvme0n1p12) Built-in kernel command string - podle skutecne partisny

Processor type and features  --->
  [*] Symmetric multi-processing support
  [ ] Support for extended (non-PC) x86 platforms
  [*] AMD ACPI2Platform devices support
  Processor family (Generic-x86-64)
  [*] Machine Check / overheating reporting
  [ ]   Intel MCE Features
  [*]   AMD MCE Features
  [*] CPU microcode loading support
    [ ]   Intel microcode loading support
    [*]   AMD microcode loading support
  Performance monitoring  --->
     < > Intel ***
     <*> AMD Processor Power Reporting Mechanism
  [*] Multi-core scheduler support
  [ ] Numa Memory Allocation and Scheduler Support
  -*- MTRR (Memory Type Range Register) support
  [*] EFI runtime service support
  [*]   EFI stub support
  [ ]     EFI mixed-mode support
  [*] Built-in kernel command line
  (root=/dev/nvme0n1p12  net.ifnames=0 vga=ask  amdgpu.gpu_recovery=1 amdgpu.lockup_timeout=3000 ) Built-in kernel command string

Power management and ACPI options  --->
  CPU Frequency scaling  --->
    Default CPUFreq governor (ondemand)  --->
    <*>   ACPI Processor P-States driver
    <*>   AMD frequency sensitivity feedback powersave bias

Firmware Drivers  --->
  EFI (Extensible Firmware Interface) Support  --->
    <*> EFI Variable Support via sysfs

Binary Emulations  --->
   [*] IA32 Emulation

Device Drivers --->
  NVME Support  --->
    <*> NVM Express block device
  I2C support  --->
    <*>   I2C device interface
    I2C Hardware Bus support  --->
      <M> AMD ***
      < > Intel ***
  Graphics support  --->
    <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
      [*]   Enable legacy fbdev support for your modesetting driver
    < > ATI Radeon
    <*> AMD GPU
    [ ]   Enable amdgpu support for SI parts
    [ ]   Enable amdgpu support for CIK parts
    ACP (Audio CoProcessor) Configuration  --->
      [ ] Enable AMD Audio CoProcessor IP support
      Display Engine Configuration  --->
        [*] AMD DC - Enable new display engine
        [*] DCN 2.0 family
    < > Intel 8xx/9xx/G3x/G4x/HD Graphics
     Console display driver support  --->
       (160) Initial number of console screen columns (def 80)
       (64) Initial number of console screen rows (def 25)
  <*> Sound card support  --->
    <*>   Advanced Linux Sound Architecture  --->
      HD-Audio  --->
        <*> Build Realtek HD-audio codec support
      (2048) Pre-allocated buffer size for HD-audio driver (def 64)
      [ ]   USB sound devices  ----
      [ ]   PCMCIA sound devices  ----
      < >   ALSA for SoC audio support  ----
      [ ]   X86 sound devices  ----
  Generic Driver Options --->
    [*] Maintain a devtmpfs filesystem to mount at /dev
    [*]   Automount devtmpfs at /dev, after the kernel mounted the rootfs
    Firmware loader  --->
      Build named firmware blobs into the kernel binary
        amdgpu/navi10_asd.bin amdgpu/navi10_ce.bin amdgpu/navi10_gpu_info.bin amdgpu/navi10_me.bin amdgpu/navi10_mec2.bin amdgpu/navi10_mec.bin amdgpu/navi10_pfp.bin amdgpu/navi10_rlc.bin amdgpu/navi10_sdma1.bin amdgpu/navi10_sdma.bin amdgpu/navi10_smc.bin amdgpu/navi10_sos.bin amdgpu/navi10_vcn.bin
      (/lib/firmware) Firmware blobs root directory
  Hardware Monitoring support --->
     <*>   AMD Family 10h+ temperature sensor
     <*>   Nuvoton NCT6775F and compatibles
  Input device support  --->
    <*>   Mouse interface
    <*>   Joystick interface
  HID support  --->
    -*- HID bus support
    <*>   Generic HID driver
      USB HID support  --->
        <*> USB HID transport layer
  [*] USB support  --->
    <*>     xHCI HCD (USB 3.0) support
    <*>     EHCI HCD (USB 2.0) support
    <*>     OHCI HCD (USB 1.1) support
  [*] IOMMU Hardware Support  --->
    [*]   AMD IOMMU support
    <*>     AMD IOMMU Version 2 driver
  [ ] X86 Platform Specific Device Drivers  ----

-*- Enable the block layer --->
   Partition Types --->
      [*] Advanced partition selection
      [*] EFI GUID Partition support

File systems --->
  Pseudo Filesystems --->
      [*] /proc file system support
      [*] Tmpfs virtual memory file system support (former shm fs)
  Native Language support --->
      [*] NLS ISO 8859-1  (Latin 1; Western European Languages)

Otázka na tělo, které fs potřebujeme? (ext3/ext4 viz Formátování.) Plus co navíc? VFAT pro USB (a jiné diskety), NTFS je potřeba dělat přez FUSE pomocí sys-fs/ntfs3g viz https://wiki.gentoo.org/wiki/NTFS

File systems --->
  < > Second extended fs support
  < > The Extended 3 (ext3) filesystem
  <*> The Extended 4 (ext4) filesystem
    [*]   Use ext4 for ext2 file systems
    [*]   Ext4 POSIX Access Control Lists
    [*]   Ext4 Security Labels
    [ ]   Ext4 debugging support
  < > Reiserfs support
  < > JFS filesystem support
  < > XFS filesystem support
  < > Btrfs filesystem support
  <*> FUSE (Filesystem in Userspace) support
  DOS/FAT/NT Filesystems  --->
    <*> MSDOS fs support
    <*> VFAT (Windows-95) fs support
    < > NTFS file system support
  CD-ROM/DVD Filesystems --->
    <*> UDF file system support

2   AMD microcode

potřebuje sys-kernel/linux-firmware

emerge --ask sys-kernel/linux-firmware
grep -F -m 1 "cpu family" /proc/cpuinfo|uniq
### cpu family : 23 == 0x17 == 17h

        Processor type and features  --->
          [*] CPU microcode loading support
          [ ]   Intel microcode patch loading support
          [*]   AMD microcode patch loading support
        Device Drivers  --->
          Generic Driver Options
            (amd-ucode/microcode_amd_fam17h.bin) External firmware blobs to build into the kernel binary
              (/lib/firmware) Firmware blobs root directory

3   Mounting the boot partition (pro kernel)

mount /dev/nvme0n1p1 /boot/

df -h  /boot
# Filesystem      Size  Used Avail Use% Mounted on
# /dev/nvme0n1p1   99M   512   99M   1% /boot

4   Compiling kernel

make -j 26
make modules_install

mkdir -p /boot/EFI/'Gentoo-NVM-Cobra2024'       # or any other name under /boot/EFI
cp /usr/src/linux/arch/x86/boot/bzImage /boot/EFI/'Gentoo-NVM-Cobra2024'/bzImage.efi
efibootmgr -c -L "NVM-Gentoo-NVM-Cobra2024" -l '\EFI\Gentoo-NVM-Cobra2024\bzImage.efi' -d /dev/nvme0n1p1
# efibootmgr -b 0A -B # smaze polozku 0A (hex)

5   NTFS

emerge --ask sys-fs/ntfs3g
chmod a+x /usr/bin/ntfs-3g

6   vim, mc, gpm

emerge -avq --jobs --load-average --newuse -DuN vim app-misc/mc sys-libs/gpm
rc-update add gpm default

7   get all

emerge --keep-going -avq --noreplace --jobs --load-average app-admin/conky app-admin/logrotate app-admin/sysklogd app-arch/arj app-arch/bzip2 app-arch/gzip app-arch/rar app-arch/tar  app-arch/unrar app-arch/unzip app-arch/zip app-editors/dhex app-editors/hexcurse app-editors/hexedit app-editors/nano app-editors/vim app-editors/vim-core app-emulation/virtualbox-additions app-emulation/wine-desktop-common app-emulation/wine-gecko app-emulation/wine-mono app-emulation/wine-vanilla app-emulation/winetricks app-i18n/uchardet app-misc/banner app-misc/mc app-misc/screen app-office/dia app-portage/cpuid2cpuflags app-portage/mirrorselect app-portage/portage-utils app-shells/bash app-text/cherrytree app-text/dos2unix app-text/pandoc app-text/pelican app-text/poppler app-text/poppler-data app-text/zathura app-text/zathura-pdf-poppler app-vim/gentoo-syntax dev-embedded/arduino dev-embedded/arduino-builder dev-embedded/arduino-ctags dev-embedded/arduino-listserialportsc dev-embedded/avrdude dev-embedded/libftdi dev-embedded/libjaylink dev-embedded/openocd dev-lang/nasm dev-lang/python dev-python/jinja dev-python/pandas dev-python/pygame dev-python/unidecode  dev-util/dialog dev-util/splint   dev-vcs/git games-emulation/dosbox-staging games-rpg/eternal-lands games-util/joystick  media-fonts/dejavu media-fonts/encodings media-fonts/font-alias media-fonts/font-misc-misc media-fonts/font-util media-fonts/liberation-fonts media-fonts/stix-fonts media-fonts/urw-fonts media-gfx/exiv2 media-gfx/feh media-gfx/gimp media-gfx/imagemagick media-gfx/inkscape media-gfx/openscad media-gfx/scrot media-libs/audiofile media-libs/fontconfig media-libs/mesa media-plugins/audacious-plugins media-sound/alsa-utils media-sound/audacious media-sound/aumix media-sound/lame media-sound/mikmod media-sound/mp32ogg media-sound/mpg123 media-sound/ogg2mp3 media-sound/timidity++ media-sound/timidity-freepats media-video/ffmpeg media-video/mplayer media-video/recordmydesktop net-analyzer/iftop net-analyzer/netselect net-analyzer/nmap net-analyzer/tcpdump net-analyzer/traceroute net-dialup/picocom net-firewall/iptables net-im/skypeforlinux net-misc/dhcpcd net-misc/iputils net-misc/netifrc net-misc/ntp net-misc/openssh net-misc/rsync net-misc/telnet-bsd net-misc/wget net-misc/whois net-news/newsboat net-p2p/rtorrent net-print/cups net-print/cups-filters sci-electronics/gerbv sci-electronics/kicad sci-electronics/kicad-footprints sci-electronics/kicad-packages3d sci-electronics/kicad-symbols sci-electronics/kicad-templates sys-apps/diffutils sys-apps/file sys-apps/findutils sys-apps/grep sys-apps/groff sys-apps/hdparm sys-apps/help2man sys-apps/hwinfo sys-apps/kbd sys-apps/kmod sys-apps/less sys-apps/lm-sensors sys-apps/lshw sys-apps/mlocate sys-apps/openrc sys-apps/pciutils sys-apps/sed sys-apps/usbutils sys-apps/which sys-auth/elogind sys-block/parted sys-boot/efibootmgr sys-devel/bc sys-devel/crossdev sys-devel/gcc sys-devel/gcc-config  sys-fs/dosfstools sys-fs/e2fsprogs  sys-fs/fuse sys-fs/ntfs3g sys-kernel/gentoo-sources sys-kernel/linux-firmware sys-kernel/linux-headers sys-libs/efivar sys-libs/gdbm sys-libs/gpm sys-libs/readline sys-libs/slang sys-power/acpi sys-power/acpid sys-power/pmtools sys-process/cronbase sys-process/cronie sys-process/iotop sys-process/lsof sys-process/procps sys-process/psmisc www-apps/nikola www-client/firefox x11-base/xorg-server x11-drivers/xf86-input-evdev x11-drivers/xf86-input-libinput x11-drivers/xf86-input-wacom x11-drivers/xf86-video-amdgpu x11-misc/numlockx x11-misc/xkbset x11-plugins/allin1 x11-plugins/wmclockmon x11-plugins/wmcpuload x11-plugins/wmfire x11-plugins/wmix x11-plugins/wmmemload x11-plugins/wmnd x11-plugins/wmnetload x11-plugins/wmsmixer x11-terms/aterm  x11-terms/rxvt-unicode x11-wm/fluxbox

8   fix it

vim /etc/fstab
cd /usr/src
# fix linux link, fix .config

make -j 26
make modules_install

efibootmgr -v | grep '2024'
# efibootmgr -b 0A -B # smaze polozku 0A (hex)

mount /dev/sda1 /boot
mkdir -p /boot/EFI/'Gentoo-NVM-Cobra2024'       # or any other name under /boot/EFI
cp /usr/src/linux/arch/x86/boot/bzImage /boot/EFI/'Gentoo-NVM-Cobra2024'/bzImage.efi
efibootmgr -c -L "SDA-Gentoo-NVM-Cobra2024" -l '\EFI\Gentoo-NVM-Cobra2024\bzImage.efi' -d /dev/sda1
umount /boot

mount /dev/nvme0n1p1 /boot
mkdir -p /boot/EFI/'Gentoo-NVM-Cobra2024'       # or any other name under /boot/EFI
cp /usr/src/linux/arch/x86/boot/bzImage /boot/EFI/'Gentoo-NVM-Cobra2024'/bzImage.efi
efibootmgr -c -L "NVM-Gentoo-NVM-Cobra2024" -l '\EFI\Gentoo-NVM-Cobra2024\bzImage.efi' -d /dev/nvme0n1p1
umount /boot

exit
cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -R /mnt/gentoo

efibootmgr -v
efibootmgr -n xxxxx(Cobra2024)

reboot