Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "User:Pnoecker/Raspberry Pi 4"

From Funtoo
Jump to navigation Jump to search
 
(30 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This guide draws heavily on [[Raspberry_Pi_2]]
This guide draws heavily on [[Raspberry_Pi_2]], [[Undead_USB_Install]], and [[Install]]


== What you need ==
== What you need ==
Line 5: Line 5:
# Raspberry PI 4
# Raspberry PI 4
# An existing Linux install [[Undead_USB_Install]] built with fchroot is a solid choice if you do not have funtoo installed on a hard drive.
# An existing Linux install [[Undead_USB_Install]] built with fchroot is a solid choice if you do not have funtoo installed on a hard drive.
# A [https://www.raspberrypi.org/help/faqs/#sdCards suitable SD card] for your PI.
# a 32GB or larger SD card, or [https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb USB if you have updated the firmware.]


==Prepare your SD card==
==Prepare your SD card==
List the device to be partitioned, mine is on /dev/sdc
Target your drive as outlined in the official install. [[Install/Prepare_Disk]]


{{console|body=
{{console|body=
###i## lsblk -o name,size,label,partlabel
###i## cgdisk /dev/funtoo}}
}}


{{console|body=
*delete everything:
###i## gdisk /dev/sdc}}


{{console|body=
{{console|body=
Command: ##i##o
Command: ##i##new
This option deletes all partitions and creates a new protective MBR.
First sector: ##i## ↵
Proceed? (Y/N): ##i##y
Size: ##i## +1M ↵
Hex Code: ##i##EF02 ↵
Name: ##i##BIOS Boot
}}
}}


{{console|body=
*scroll down to the large chunk of free space:
Command: ##i##n ↵
Partition Number: ##i##1 ↵
First sector: ##i##↵
Last sector: ##i##+1M ↵
Hex Code: ##i##EF02 ↵
Command: ##i##c ↵
Partition number: ##i##1
Enter name: ##i##BIOS Boot
}}


{{console|body=
{{console|body=
Command: ##i##n ↵
Command: ##i##new
Partition Number: ##i##2
First sector: ##i##↵
First sector: ##i##↵
Last sector: ##i##+384M
Last sector: ##i##+256M
Hex Code: ##i##EF00 ↵
Hex Code: ##i##EF00 ↵
Command: ##i##c
Name: ##i##BOOT
Partition number: ##i##2
Enter name: ##i##BOOT
}}
}}
*scroll down to the large chunk of free space:


{{console|body=
{{console|body=
Command: ##i##n ↵
Command: ##i##new
Partition Number: ##i##3
First sector: ##i##↵
First sector: ##i##↵
Last sector: ##i##↵
Last sector: ##i##↵
Hex Code: ##i## 8305 ↵
Hex Code: ##i## 8305 ↵
Command: ##i##c
Name: ##i##FUNTOO
Partition number: ##i##3
Enter name: ##i##FUNTOO
}}
}}


{{console|body=
{{console|body=
Command: ##i##w ↵
                              Disk Drive: /dev/funtoo
Do you want to proceed? (Y/N): ##i##Y ↵
                            Size: 62333952, 29.7 GiB
}}


Part. #    Size        Partition Type            Partition Name
----------------------------------------------------------------
             1007.0 KiB  free space
             1007.0 KiB  free space
   1        1024.0 KiB  BIOS boot partition   BIOS Boot
   1        1024.0 KiB  BIOS boot partition   BIOS Boot
   2        256.0 MiB  EFI System                BOOT
   2        256.0 MiB  EFI System                BOOT
   3        29.5 GiB    Linux ARM64 root (/)      FUNTOO
   3        29.5 GiB    Linux ARM64 root (/)      FUNTOO
write
}}
quit
 
{{console|body=
Command: ##i##write
Do you want to proceed? (Y/N): ##i##yes ↵
Command: ##i##quit
}}


===Create File Systems===
===Create File Systems===
Line 72: Line 65:


{{console|body=
{{console|body=
###i## mkfs.vfat -F 32 /dev/sdc2
###i## mkfs.vfat -F 32 /dev/funtoo2
###i## fatlabel /dev/sdc2 "BOOT"
###i## fatlabel /dev/funtoo2 "BOOT"
###i## mkfs.ext4 /dev/sdc3
###i## mkfs.ext4 /dev/funtoo3
###i## e2label /dev/sdc3 "FUNTOO"
###i## e2label /dev/funtoo3 "FUNTOO"
}}
}}


Line 86: Line 79:
Mount your SD card:
Mount your SD card:
{{console|body=
{{console|body=
###i## mount /dev/sdc3 /mnt/funtoo  
###i## mount /dev/funtoo3 /mnt/funtoo  
###i## mkdir /mnt/funtoo/boot
###i## mkdir /mnt/funtoo/boot
###i## mount /dev/sdc2 /mnt/funtoo/boot
###i## mount /dev/funtoo2 /mnt/funtoo/boot
}}
}}


Line 95: Line 88:
Grab the latest [[Arm64_generic]] stage 3 file:
Grab the latest [[Arm64_generic]] stage 3 file:
[[Subarches]]
[[Subarches]]
*or use a ffs stage 3 https://area31.host.funtoo.org/ffs/stages/arm-64bit/
{{console|body=
{{console|body=
###i## cd /mnt/funtoo
###i## cd /mnt/funtoo
Line 106: Line 100:


===Pre-boot Configuration===
===Pre-boot Configuration===
Edit your make.conf file to enable fchroot to compile:
*Edit your make.conf file to enable fchroot to compile:
 
{{console|body=
###i## nano /mnt/funtoo/etc/portage/make.conf
}}


{{file|name=/mnt/funtoo/etc/portage/make.conf|desk make.conf file|body=
{{file|name=/mnt/funtoo/etc/portage/make.conf|desk make.conf file|body=
FEATURES="-pid-sandbox"
FEATURES="-pid-sandbox"
PORTAGE_TMPDIR="/run"
GRUB_PLATFORMS="uboot"
}}
}}


Edit your fstab file so everything mounts correctly on boot:
*Edit your fstab file so everything mounts correctly on boot:
*Raspberry pi only supports partuuid and partlabel loading:
{{console|body=
{{console|body=
###i## nano /mnt/funtoo/etc/fstab
###i## nano /mnt/funtoo/etc/fstab
Line 121: Line 118:
{{file|name=/mnt/funtoo/etc/fstab|body=
{{file|name=/mnt/funtoo/etc/fstab|body=
proc /proc proc defaults 0 0
proc /proc proc defaults 0 0
LABEL=BOOT /boot vfat noauto,noatime 1 2
PARTLABEL=BOOT /boot vfat noauto,noatime 1 2
LABEL=FUNTOO / ext4 noatime 0 1
PARTLABEL=FUNTOO / ext4 noatime 0 1
tmpfs /var/tmp/portage tmpfs uid=portage,gid=portage,mode=775,noatime 0 0
}}
}}


Line 128: Line 126:
===for a good time install [[Package:Fchroot]]===
===for a good time install [[Package:Fchroot]]===


'''as root''', start the binfmt service:
*Fchroot in:
 
{{console|body=
{{console|body=
###i## /etc/init.d/binfmt restart
###i## cd /mnt/funtoo
###i## fchroot .
###i## export PS1="FUNTOO $PS1"
}}
}}


Finally perform the usually chroot routine (as described in detail in the Funtoo Linux Installation Guide):
====set your pass====
 
*Set yo password
{{console|body=
{{console|body=
###i## cd /mnt/funtoo
###i## useradd -o -u 0 -g 0 funtoo && passwd funtoo && ego sync
###i## mount --rbind /run run
###i## fchroot .
}}
}}


*Set yo password
*compile in ram
{{console|body=
{{console|body=
###i## passwd && ego sync
###i## mkdir /var/tmp/portage
###i## chown portage:portage /var/tmp/portage
###i## mount /var/tmp/portage
}}
}}


{{console|body=
{{console|body=
Line 152: Line 152:
###i## echo "sys-kernel/raspberrypi-image **" >> /etc/portage/package.accept_keywords
###i## echo "sys-kernel/raspberrypi-image **" >> /etc/portage/package.accept_keywords
###i## emerge raspberrypi-userland-bin raspberrypi-firmware raspberrypi-image
###i## emerge raspberrypi-userland-bin raspberrypi-firmware raspberrypi-image
}}
{{console|body=
###i## emerge -avuND @world
}}
}}


Line 163: Line 159:


{{file|name=/boot/config.txt|body=
{{file|name=/boot/config.txt|body=
disable_overscan=1
dtparam=audio=on
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
arm_64bit=1
arm_64bit=1
kernel=kernel8.img
disable_overscan=0
}}
{{file|name=/boot/cmdline.txt|desc=Stifler's Mom|body=
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=LABEL=FUNTOO rootfstype=ext4 elevator=deadline rootwait
}}
}}


==Clean unmount==
Make sure all buffers have been flushed and unmount the temp directories:
{{console|body=
{{console|body=
###i## exit
###i## nano /boot/cmdline.txt
###i## cd .. && sync
###i## umount -lR funtoo
}}
}}


==Booting the Raspberry Pi 4==
{{file|name=/boot/cmdline.txt|desc=Stifler's Mom|body=
 
console=tty1 root=PARTLABEL=FUNTOO rootfstype=ext4 elevator=noop fsck.repair=yes quiet rootwait
Log in using the password you created earlier. The first thing you'll want to do is fix the clock, set your time zone and sync your portage tree.
 
Because the Raspberry Pi does not have a hardware clock, you'll need to set the date and time right away.  Later on we'll make sure we can get the correct time at boot via NTP, but for now we need to do it manually
{{console|body=
###i## /etc/init.d/busybox-ntpd restart
or
###i## date MMDDHHMMCCYY
}}
}}


Next, set your timezone:
Set your timezone:
{{console|body=
{{console|body=
###i## ln -sf /usr/share/zoneinfo/YOURTIMEZONE /etc/localtime
###i## ln -sf /usr/share/zoneinfo/America/Detroit /etc/localtime
}}
}}


Now we need make sure we can connect to the internet:
*Set Services:
{{console|body=
{{console|body=
###i## rc-update add dhcpcd default
###i## rc-update add dhcpcd default
###i## rc-update add busybox-ntpd boot
###i## rc-update add swclock boot
###i## rc-update del hwclock boot
###i## rc-update del swap boot
###i## echo "funtoo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
}}
}}


kitchen SINK:
{{note|you should probably test that your pi boots at this point BEFORE emerging everything.}}
 
===Reboot and merge,or just merge===
*Set your profile:
 
{{console|body=
{{console|body=
###i## ego sync
###i## epro list
###i## epro flavor desktop
###i## epro mix-in lxde
###i## echo "media-plugins/alsa-plugins pulseaudio" >> /etc/portage/package.use
###i## echo "net-print/cups -zeroconf" >> /etc/portage/package.use
###i## echo "gnome-base/gvfs -http" >> /etc/portage/package.use
###i## emerge xorg-x11 elogind pulseaudio networkmanager lightdm lxde-meta dillo
}}
}}
Set your profile with epro:


{{console|body=
{{console|body=
###i## epro list
###i## emerge -avuND @world
###i## epro flavor server
}}
}}


[[Install/Stage3_Desktop]]
==Clean unmount==


Make sure all buffers have been flushed and unmount the temp directories:
{{console|body=
{{console|body=
###i## rc-update add busybox-ntpd sysinit
###i## exit
###i## rc-update add swclock boot
###i## cd .. && sync
###i## rc-update del hwclock boot
###i## umount -lR funtoo
}}
}}


Now you can follow the [[Funtoo Linux Installation|Funtoo Install documentation]] to continue configuring your system.  You'll definitely want to look into {{Package|sys-devel/distcc}} if you are going to be adding lots of software to your system.
Now you can follow the [[Funtoo Linux Installation|Funtoo Install documentation]] to continue configuring your system.  You'll definitely want to look into {{Package|sys-devel/distcc}} if you are going to be adding lots of software to your system.

Latest revision as of 21:52, January 9, 2023

This guide draws heavily on Raspberry_Pi_2, Undead_USB_Install, and Install

What you need

  1. Raspberry PI 4
  2. An existing Linux install Undead_USB_Install built with fchroot is a solid choice if you do not have funtoo installed on a hard drive.
  3. a 32GB or larger SD card, or USB if you have updated the firmware.

Prepare your SD card

Target your drive as outlined in the official install. Install/Prepare_Disk

root # cgdisk /dev/funtoo
  • delete everything:
Command: new ↵
First sector: 
Size:  +1M ↵
Hex Code: EF02 ↵
Name: BIOS Boot ↵
  • scroll down to the large chunk of free space:
Command: new ↵
First sector: 
Last sector: +256M ↵
Hex Code: EF00 ↵
Name: BOOT ↵
  • scroll down to the large chunk of free space:
Command: new ↵
First sector: 
Last sector: 
Hex Code:  8305 ↵
Name: FUNTOO ↵
Disk Drive: /dev/funtoo
                            Size: 62333952, 29.7 GiB

Part. #     Size        Partition Type            Partition Name
----------------------------------------------------------------
            1007.0 KiB  free space
   1        1024.0 KiB  BIOS boot partition	  BIOS Boot
   2        256.0 MiB   EFI System                BOOT
   3        29.5 GiB    Linux ARM64 root (/)      FUNTOO
Command: write ↵
Do you want to proceed? (Y/N): yes ↵
Command: quit ↵

Create File Systems

Next, we need to create file systems on the partitions:

root # mkfs.vfat -F 32 /dev/funtoo2
root # fatlabel /dev/funtoo2 "BOOT"
root # mkfs.ext4 /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/funtoo2 /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://build.funtoo.org/1.4-release-std/arm-64bit/arm64_generic/2020-09-07/stage3-arm64_generic-1.4-release-std-2020-09-07.tar.xz

Extract the stage 3:

root # tar --numeric-owner --xattrs --xattrs-include='*' -xpf stage3*

Pre-boot Configuration

  • Edit your make.conf file to enable fchroot to compile:
root # nano /mnt/funtoo/etc/portage/make.conf
   /mnt/funtoo/etc/portage/make.conf
FEATURES="-pid-sandbox"
  • 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
proc /proc proc defaults 0 0
PARTLABEL=BOOT /boot vfat noauto,noatime 1 2
PARTLABEL=FUNTOO / ext4 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 .
root # export PS1="FUNTOO $PS1"

set your pass

  • Set yo password
root # useradd -o -u 0 -g 0 funtoo && passwd funtoo && ego sync
  • compile in ram
root # mkdir /var/tmp/portage
root # chown portage:portage /var/tmp/portage
root # mount /var/tmp/portage


root # echo "media-libs/raspberrypi-userland-bin **" >> /etc/portage/package.accept_keywords
root # echo "sys-boot/raspberrypi-firmware **" >> /etc/portage/package.accept_keywords
root # echo "sys-kernel/raspberrypi-image **" >> /etc/portage/package.accept_keywords
root # emerge raspberrypi-userland-bin raspberrypi-firmware raspberrypi-image
root # nano /boot/config.txt
   /boot/config.txt
disable_overscan=1
dtparam=audio=on
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
arm_64bit=1
root # nano /boot/cmdline.txt
   /boot/cmdline.txt - Stifler's Mom
console=tty1 root=PARTLABEL=FUNTOO rootfstype=ext4 elevator=noop fsck.repair=yes quiet rootwait

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 del swap boot
root # echo "funtoo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
   Note

you should probably test that your pi boots at this point BEFORE emerging everything.

Reboot and merge,or just merge

  • Set your profile:
root # epro list 
root # epro flavor desktop
root # epro mix-in lxde
root # echo "media-plugins/alsa-plugins pulseaudio" >> /etc/portage/package.use
root # echo "net-print/cups -zeroconf" >> /etc/portage/package.use
root # echo "gnome-base/gvfs -http" >> /etc/portage/package.use
root # emerge xorg-x11 elogind pulseaudio networkmanager lightdm lxde-meta dillo
root # emerge -avuND @world

Install/Stage3_Desktop

Clean unmount

Make sure all buffers have been flushed and unmount the temp directories:

root # exit
root # cd .. && sync 
root # umount -lR funtoo

Now you can follow the Funtoo Install documentation to continue configuring your system. You'll definitely want to look into No results if you are going to be adding lots of software to your system.