It wasn't as simple as changing /etc/fstab as the root file system is already loaded. It actually turned out to be relatively simple though. Interesting journey to get there.
The journey to get here started with looking at initrd. I ended up extracting that and finding the script that loads the root file system and starting the boot process from there. I realized passing parameters to that would change the root fs, but couldn't work that out. I thought I could change the default, however I believe the script is always called with parameters so that doesn't help.
I then learnt some about u-boot. In the end one useful resource was this document. I had tried changing the uEnv.txt originally, but some of the online documents I found led me astray. After digging into longsleep's repository a little I came upon boot.scr. I first thought this was a simple text file for custom commands. Not quite. It is a compiled file from mkimage. However, within that I could add commands to override the root parameter used for setting the root file system. After getting that working, I realized that I could do the same thing more simply in uEnv.txt! A final note: it seemed that if I used the reboot command, it would hang with a hard lock on the cpu. Generally removing the power and doing a cold reboot worked. Adding the 'bootdelay' seems to have fixed both cases.
- So, I formatted my usb drive and copied the file system over using rsync.
- Then, to tell the boot process where the root file system is, you can edit uEnv.txt (in the FAT partition on the SD Card. I added the two lines below:
Code:
root=/dev/sda2
bootdelay=20
The journey to get here started with looking at initrd. I ended up extracting that and finding the script that loads the root file system and starting the boot process from there. I realized passing parameters to that would change the root fs, but couldn't work that out. I thought I could change the default, however I believe the script is always called with parameters so that doesn't help.
I then learnt some about u-boot. In the end one useful resource was this document. I had tried changing the uEnv.txt originally, but some of the online documents I found led me astray. After digging into longsleep's repository a little I came upon boot.scr. I first thought this was a simple text file for custom commands. Not quite. It is a compiled file from mkimage. However, within that I could add commands to override the root parameter used for setting the root file system. After getting that working, I realized that I could do the same thing more simply in uEnv.txt! A final note: it seemed that if I used the reboot command, it would hang with a hard lock on the cpu. Generally removing the power and doing a cold reboot worked. Adding the 'bootdelay' seems to have fixed both cases.