User:JWylde/Gentoo Raspberry Pi 3 Model B 64-bit Installation

Preparing The Disks
Prior to installing Gentoo on a Raspberry Pi 3 Model B, the SD card must be prepared first. We can use either fdisk or Parted to accomplish this. But before we go into that, we must first figure out what the SD card identifies as on your Gentoo system. We can do this using lsblk -

If your SD card still has NOOBS installed on it, the output from lsblk should look something like this -

In this example, this Gentoo system uses /dev/sda as the Gentoo system block device. /dev/sdb is the NOOBS SD card. We'll use that for our example throughout this article.

If you're using a brand new pre-formatted SD card, the output from lsblk would look like this -

For our partition table, our boot partition must be a primary partition and it must be a FAT32 partition for the Raspberry Pi to boot. For the swap and root partitions, we can use standard Linux formats. Optionally, we can create an extended partition and make the swap and root partitions as logical partitions if we wish. For this installation example, all partitions will be primary partitions.

fdisk
The -w always switch will wipe all signatures as we create partitions. Once fdisk starts, pass the 'p' option to see the partitions currently present on the SD card.

First we will pass the o command to create a new MS-DOS disk label. This will delete all partitions currently in the table.

As you can see, the o command created our new DOS disklabel and deleted all partitions.

Next, we're going to make the boot partition. First, we'll use the 'n' command to make a new partition. Then, press enter for the following three prompts. This gives you the default options of -

p - Primary Partition Partition number 1 First sector at 2048

For the last sector, we'll set it at +128M. This gives us a boot partition size of 128MiB.

Then, we'll use the 't' command to change the partition type. Select hex code 'c' to change it to a 'W95 FAT32 (LBA)' partition type. Finally, use the 'a' command to toggle on the bootable flag on partition 1.

Using the 'P' command, print the partition table to verify that the boot partition has been made correctly -

As we can see, we have created a bootable partition starting at sector 2048 that is 128MiB in size and is a FAT32 partition type.

Next, we'll create the swap partition. Pass the 'n' command again to create a new partition. Again, we'll press enter for the next 3 prompts to get the following default options -

p - Primary Partition

Partition number 2

First sector at sector 264192

Then we will set a swap size of 2GiB by passing +2G for the last sector/size. Finally, once the second partition is created, we'll use the 't' command to change the partition type, and select hex code 82 to change our partition type to 'Linux swap / Solaris'.

Now print your partition table using the 'p' command and it should look like this -