Wednesday 26 June 2019

Raspberry Pi 3 multiboot E2B USB drive (untested!)

I notice that the Raspberry Pi 3 can be made to boot from a USB storage device by setting a one-time programmable bit (see video here and blog article here).

The Raspberry Pi 4 does not yet have this capability, but it should be possible in the future.

I don't own a Pi 3, but looking at the Raspbian download .img file, it contains two MBR-partitions, a FAT32 boot partition and a ext partition. This means it should be possible to boot a Raspberry Pi 3 (and later on, a Pi 4) from any .imgPTN file on an Easy2Boot drive. So you could have multiple Pi .imgPTN files all on one E2B USB drive.

I am unsure if it also makes a swap partition and if it does, how it makes the swap partition, so this process may totally corrupt your E2B drive. For this reason I suggest that you test it on a spare E2B USB drive first. Please let me know if you feel like experimenting but don't use your E2B drive if it contains any wanted files! It would be cool to have multiple Pi images on one E2B USB drive.



First you must follow the video to enable USB booting on your Pi 3.


Experimental procedure 1 (untested)

We will take an image of a Raspbian SD card (using an SD card reader under Windows to access it). It should contain two partitions only. If it contains three partitions, this procedure may or may not work!

Note: If the SD card was made using NOOBS then it will probably contain many partitions and so it cannot be copied - the SD card should be made using the Raspbian.img file.

You must have booted from the Raspbian Pi SD card at least twice before you start this procedure. If you use a 4GB SD card then the image file size will be 4GB. If you use a 16GB SD card, the image is going to be 16GB!

1. Use RMPrepUSB - Drive Info - 0 to examine the SD card partition table - check it has two partitions.

2. Click on RMPrepUSB - Drive>File and set the output file name as Raspbian and the start as P2 and length as P2. This will make an image of the ext partition and the resultant file will be as large as the ext partition.

3. To copy the FAT32 files, drag-and-drop the SD card volume letter\icon (e.g. G: drive) onto the MPI_FAT32 Desktop icon to make a Raspbian.imgPTN file.

4. Now copy both files to the E2B drive \_ISO\MAINMENU, make them contiguous and use SWITCH_E2B.exe to switch them in by double-clicking on the Raspbian.imgPTN file.

You should now be able to boot from the E2B drive to Raspbian on your Pi 3.

Experimental procedure 2 (untested)


1. Download the Raspbian .zip file and use 7Zip to unpack  the two images so you have two new files

0.fat
1.img




2. Drag-and-drop the 0.fat file onto the MPI_FAT32 Desktop shortcut to make a Raspbian.imgPTN file.

3. Copy the Raspbian.imgPTN and 1.img file to the \_ISO\MAINMENU folder of you E2B drive.

4. Rename the 1.img file to Raspbian    (with no file extension).

5. Run \MAKE_THIS_DRIVE_CONTIGUOUS.cmd from the E2B drive.

6. You should now be able to run \_ISO\SWITCH_E2B.exe and select the Raspbian.imgPTN file and 'switch it in'.

7. When Raspbian first boots, it expands the ext partition. This MUST be prevented by editing the \cmdlines.txt file and removing the init parameter (see red below):

cmdlines.txt

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=0634f60c-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh

WARNING: I have not tested this and there is a possibility that Raspbian could completely corrupt your E2B drive!!!  For more info see here.

8. Now connect your E2B USB drive to the Pi 3 and boot.

The Pi 3 boot process is:


The kernel should look for the ext partitions UUID, and so the fact that it is on partition 3 on the E2B drive instead of partition 2 should not matter.

The boot files are nicely documented here.

If you want to boot your Pi 4 from USB and don't want to wait for the Pi 4 update, you can bootstrap from an SD card to a USB drive by following the instructions here (but this is not for an E2B USB drive).

No comments:

Post a Comment