The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "User:Coffnix/Raspberry Pi 4"
Line 212: | Line 212: | ||
{{file|name=/boot/config.txt|body= | {{file|name=/boot/config.txt|body= | ||
gpu_mem=256 | |||
disable_overscan=1 | disable_overscan=1 | ||
dtparam=audio=on | dtparam=audio=on | ||
Line 225: | Line 226: | ||
{{file|name=/boot/config.txt|body= | {{file|name=/boot/config.txt|body= | ||
gpu_mem= | gpu_mem=256 | ||
dtoverlay=vc4-kms-v3d-pi4 | dtoverlay=vc4-kms-v3d-pi4 | ||
max_framebuffers=2 | max_framebuffers=2 | ||
Line 234: | Line 235: | ||
hdmi_group=2 | hdmi_group=2 | ||
hdmi_mode=85 | hdmi_mode=85 | ||
arm_64bit=1 | |||
}} | }} | ||
Revision as of 10:19, May 29, 2022
What you need
- Raspberry PI 4
- An existing Funtoo Linux install or Livecd (Livecd is a solid choice if you do not have funtoo installed on a hard drive)
- a 32GB or larger SD card
Prepare your SD card
Target your drive as outlined in the official install. Install/Prepare_Disk
Use parted to create partitions:
root # emerge parted dmidecode
root # wipefs -a /dev/funtoo root # parted /dev/funtoo --script mklabel msdos root # parted /dev/funtoo unit MB mkpart primary fat32 1 128 root # parted /dev/funtoo set 1 boot on root # parted -s /dev/funtoo unit mib mkpart primary linux-swap 122 2168 root # parted /dev/funtoo unit MB mkpart primary ext4 2273 100% root # partprobe
Or use fdisk instead:
- delete everything:
root # wipefs -a/dev/funtoo
Make a new MS-DOS disklabel. Add a new partition - this will be 128Mb for /boot
root # fdisk /dev/funtoo
Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-15523839, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-15523839, default 15523839): +128M
Has created a new partition 1 of type 'Linux' and of size 128 MiB.
Add a 2G partition 2 for swap.
Put the remaining space in partition 3 for root.
Check with
Command (m for help): p
Using an 8G microSD card it should show
Device Boot Start End Sectors Size Id Type /dev/funtoo1 2048 264191 262144 128M 83 Linux /dev/funtoo2 264192 4458495 4194304 2G 83 Linux /dev/funtoo3 4458496 15523839 11065344 5.3G 83 Linux
Set flags and partition types Toggle the bootable flag on partition 1
ommand (m for help): a Partition number (1-3, default 3): 1
The bootable flag on partition 1 is enabled now.
Mark partition 1 as FAT
Command (m for help): t Partition number (1-3, default 3): 1 Partition type (type L to list all types): c Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
The Pi checks the type of partition 1 in the partition table and will not boot if its 82
Mark partition 2 as swap
Command (m for help): t Partition number (1-3, default 3): 2 Partition type (type L to list all types): 82 Changed type of partition 'Linux swap / Solaris' to 'Linux swap / Solaris'.
Check again.
Device Boot Start End Sectors Size Id Type /dev/sdk1 * 2048 264191 262144 128M c W95 FAT32 (LBA) /dev/sdk2 264192 4458495 4194304 2G 82 Linux swap / Solaris /dev/sdk3 4458496 15523839 11065344 5.3G 83 Linux
Save the new partition table. Exit fdisk with either w or q
w write table to disk and exit q quit without saving changes
Create File Systems
Next, we need to create file systems on the partitions:
root # mkfs.vfat -F 32 /dev/funtoo1 root # fatlabel /dev/funtoo1 "BOOT" root # mkswap -L SWAP /dev/funtoo2 root # mkfs.ext4 -F /dev/funtoo3 root # e2label /dev/funtoo3 "FUNTOO"
Prepare Your Boot Partition
Make mount points for your boot and root partitions on the SD card:
root # mkdir /mnt/funtoo
Mount your SD card:
root # mount /dev/funtoo3 /mnt/funtoo root # mkdir /mnt/funtoo/boot root # mount /dev/funtoo1 /mnt/funtoo/boot
Get the Funtoo Files Onto the SD Card
Download the Necessary Files
Grab the latest Arm64_generic stage 3 file: Subarches
root # cd /mnt/funtoo root # wget https://area31.host.funtoo.org/stage3-raspi4-1.4-release-std-2022-05-19.tar.xz
Extract the stage 3:
root # tar --numeric-owner --xattrs --xattrs-include='*' -xpf stage3*
Pre-boot Configuration
- Edit your fstab file so everything mounts correctly on boot:
- Raspberry pi only supports partuuid and partlabel loading:
root # nano /mnt/funtoo/etc/fstab
/mnt/funtoo/etc/fstab
LABEL=BOOT /boot vfat defaults 0 2
LABEL=SWAP none swap sw 0 0
LABEL=FUNTOO / ext4 defaults,noatime 0 1
tmpfs /var/tmp/portage tmpfs uid=portage,gid=portage,mode=775,noatime 0 0
Chrooting into your new installation
for a good time install Package:Fchroot
- Fchroot in:
root # cd /mnt/funtoo root # fchroot --cpu cortex-a72 . su --login root # export PS1="FUNTOO $PS1"
set your pass
- Create new user and set password:
root # echo -e "root\nroot" | passwd root root # useradd funtoo && echo -e "funtoo\nfuntoo" | passwd funtoo root # usermod -a -G wheel,audio,video funtoo root # echo "funtoo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
Sync tree
root # ego sync
compile in ram
root # mkdir /var/tmp/portage root # chown portage:portage /var/tmp/portage root # mount /var/tmp/portage
Emerge necessary ebuilds
root # export FEATURES="-pid-sandbox" ; emerge raspberrypi-userland raspberrypi-firmware raspberrypi-image sys-firmware/raspberrypi-wifi-ucode
Configure driver VC4 and screen resolution
root # nano /boot/config.txt
use dtoverlay=vc4-fkms-v3d:
/boot/config.txt
gpu_mem=256
disable_overscan=1
dtparam=audio=on
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
arm_64bit=1
or use dtoverlay=vc4-kms-v3d-pi4:
using dtoverlay vc4-kms-v3d-pi4 can cause blank screen on both FrameBuffer and X server. Try setting CEA or DMT mode if you run into blank screen error on your monitor or TV
/boot/config.txt
gpu_mem=256
dtoverlay=vc4-kms-v3d-pi4
max_framebuffers=2
# CEA
#hdmi_group=1
#hdmi_mode=4
# DMT
hdmi_group=2
hdmi_mode=85
arm_64bit=1
Use this table to find the “hdmi_mode” value for your resolution:
Configure kernel line:
root # nano /boot/cmdline.txt
/boot/cmdline.txt
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p3 rootfstype=ext4 fsck.repair=yes usbhid.mousepoll=0 rootwait consoleblank=0
Set your timezone:
root # ln -sf /usr/share/zoneinfo/America/Detroit /etc/localtime
- Set Services:
root # rc-update add dhcpcd default root # rc-update add busybox-ntpd boot root # rc-update add swclock boot root # rc-update del hwclock boot root # rc-update add swap boot
Regenerate locales:
root # locale-gen
Exit from fchroot and boot your raspberry pi
Make sure all buffers have been flushed and unmount the temp directories:
root # exit root # sync root # cd /mnt ; umount -lR funtoo
you should probably test that your pi boots at this point BEFORE emerging everything.
Update all system
root # emerge -avuND @world
Wifi
Power saving mode was an issue years ago on older versions of the raspberry pi. Some people report wifi stability issues if power saving mode is active, even in newer versions. To permanently disable power saving mode:
root # echo -e '#!/bin/sh\niwconfig wlan0 power off' > /etc/local.d/wifi-power.start root # chmod +x /etc/local.d/wifi-power.start
VC4 and V3D OpenGL drivers for Raspberry Pi
Enable profile:
root # epro mix-ins +gfxcard-raspi4
Boot Raspberry Pi 4 / 400 from USB
Clone source disk (SD card) to a destination USB disk or disk which will be bootable. Ex:
root # rsync --force -rltWDEHXAgoptx /sdcard/ /pendrive/ root # sync
Configure kernel line to replace SD Card to new disk:
/boot/cmdline.txt
dwc_otg.lpm_enable=0 root=/dev/sda3 rootfstype=ext4 fsck.repair=yes usbhid.mousepoll=0 rootwait consoleblank=0
change order of boot on EEPROM:
1 = Check SD card
4 = Check USB drive
f = Start again
Replace 0x1 to 0x4 and save.
root # rpi-eeprom-config --edit
Poweroff, remove SD Card and boot only using USB device.