(19) Bootloader

On a Raspberry we do not have GRUB or LILO, it is completely different, but easy to configure because of NOOBS.

What we need to do is edit one line to point towards /dev/sda1 our / on the USB drive - instead of the SD Card.

First we exit Gentoo chroot jail by simply typing


(chroot) raspberrypi / #    exit

We are now back inside the Raspbian. We need to find a one line text file that NOOBS writes on the SD Card.

First let us list the SD Card partitions so we can find it..


root@raspberrypi:/home/pi# fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000729e0

Device         Boot    Start      End  Sectors  Size Id Type
/dev/mmcblk0p1          8192  2527343  2519152  1.2G  e W95 FAT16 (LBA)
/dev/mmcblk0p2       2527344 15523839 12996496  6.2G 85 Linux extended
/dev/mmcblk0p5       2531328  2596861    65534   32M 83 Linux
/dev/mmcblk0p6       2596864  2725887   129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p7       2727936 14467069 11739134  5.6G 83 Linux
/dev/mmcblk0p8      14467072 15515647  1048576  512M 83 Linux


We are only interested in one Partition, the small 63M FAT32 Partition

We make a mount point directory, and then mount it it. If it is busy, we will need to un-mount it...


root@raspberrypi:/home/pi#   mkdir /mnt/noobs
root@raspberrypi:/home/pi#   umount /dev/mmcblk0p6
root@raspberrypi:/home/pi#   mount -t vfat /dev/mmcblk0p6 /mnt/noobs/

Now we look inside this partition for one file called cmdline.txt


root@raspberrypi:/home/pi# ls -l /mnt/noobs/

total 19794
-rwxr-xr-x 1 root root   10841 Feb 25 23:22 bcm2708-rpi-b.dtb
-rwxr-xr-x 1 root root   11120 Feb 25 23:22 bcm2708-rpi-b-plus.dtb
-rwxr-xr-x 1 root root   10871 Feb 25 23:22 bcm2708-rpi-cm.dtb
-rwxr-xr-x 1 root root   12108 Feb 25 23:22 bcm2709-rpi-2-b.dtb
-rwxr-xr-x 1 root root   12575 Feb 25 23:22 bcm2710-rpi-3-b.dtb
-rwxr-xr-x 1 root root   17920 Feb  9 13:32 bootcode.bin
-rwxr-xr-x 1 root root     136 Mar  7 12:10 cmdline.txt
-rwxr-xr-x 1 root root    1808 Mar  7 12:10 config.txt
-rwxr-xr-x 1 root root   18693 Aug 21  2015 COPYING.linux
-rwxr-xr-x 1 root root    2505 Feb 25 23:22 fixup_cd.dat
-rwxr-xr-x 1 root root    6481 Feb 25 23:22 fixup.dat
-rwxr-xr-x 1 root root    9722 Feb 25 23:22 fixup_db.dat
-rwxr-xr-x 1 root root    9724 Feb 25 23:22 fixup_x.dat
-rwxr-xr-x 1 root root     103 Feb 26 02:20 issue.txt
-rwxr-xr-x 1 root root 4046732 Feb 25 23:22 kernel7.img
-rwxr-xr-x 1 root root 3963140 Feb 25 23:22 kernel.img
-rwxr-xr-x 1 root root    1494 Nov 18 16:01 LICENCE.broadcom
-rwxr-xr-x 1 root root   18974 Feb 26 02:20 LICENSE.oracle
-rwxr-xr-x 1 root root     299 Mar  7 12:10 os_config.json
drwxr-xr-x 2 root root    6144 Mar  7 11:58 overlays
-rwxr-xr-x 1 root root  612472 Feb 25 23:22 start_cd.elf
-rwxr-xr-x 1 root root 4888200 Feb 25 23:22 start_db.elf
-rwxr-xr-x 1 root root 2739672 Feb 25 23:22 start.elf
-rwxr-xr-x 1 root root 3840328 Feb 25 23:22 start_x.elf

cmdline.txt is the one line text file we need to edit, to switch the Raspberry from booting Raspbian on the SD card, to Gentoo on the USB Drive

Before you do anything, make a backup copy...


root@raspberrypi:/home/pi#   cp /mnt/noobs/cmdline.txt  /mnt/noobs/cmdline.txt.backup
root@raspberrypi:/home/pi#   nano /mnt/noobs/cmdline.txt

You should see some thing like this :


dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

All we need to do, is edit in your USB Drive, in my particular case it is /dev/sda2 for the ROOT PARTITION.

If you need to check, do a quick fdisk -l, to list all the partitions.

 

Here is my edited version :


dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

And make sure the file system matches, if you chose something different to ext4 ... of course...

Reboot, and enjoy

PREVIOUS INDEX THE END