User:Coffnix/Raspberry Pi 4

From Funtoo
Jump to navigation Jump to search

What you need

  1. Raspberry PI 4
  2. An existing Funtoo Linux install or Livecd (Livecd is a solid choice if you do not have funtoo installed on a hard drive)
  3. a 32GB or larger SD card

Prepare your SD card

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

root # cgdisk /dev/funtoo
  • delete everything:
  • scroll down to the large chunk of free space:
Command: new ↵
First sector: 
Last sector: +256M ↵
Hex Code: EF02 ↵
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        256.0 MiB   BIOS boot partition	      BOOT
   2        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/funtoo1
root # fatlabel /dev/funtoo1 "BOOT"
root # mkfs.ext4 /dev/funtoo2
root # e2label /dev/funtoo2 "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/funtoo2 /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

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
  • Edit your fstab file so everything mounts correctly on boot:
  • Raspberry pi only supports partuuid and partlabel loading:
root # nano /mnt/funtoo/etc/fstab
LABEL=BOOT    /boot           vfat    defaults          0       2
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 # 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 # emerge raspberrypi-userland raspberrypi-firmware raspberrypi-image sys-firmware/raspberrypi-wifi-ucode

root # nano /boot/config.txt
root # nano /boot/cmdline.txt
   /boot/cmdline.txt - Stifler's Mom
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 usbhid.mousepoll=0 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

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


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.