Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

[SOLVED] Customize initramfs SD fallback
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Solved: Customize initramfs SD fallback
31st Jul, 2014, 05:58 PM
Post: #1
rlogiacco Offline
Registered
Posts: 22
Joined: Jul 2014
Reputation: 0
Customize initramfs SD fallback
Hi everybody, I'm here to ask help in doing something I've never had to do before in my past Linux experience: customize the initramfs.

Problem: I want to run XBian on my RPi model B from USB hard drive, but I want to be able to power off my RPi and disconnect the USB disk while still being able to boot my RPi.

To achieve such goal I was initially thinking to just use the recovery shell and have two lines in my cmdline.txt file, one commented out so just a quick edit could do. Sadly my USB Cherry G320 keyboard is not recognized by the kernel modules and I'm back to square one.

I was thinking I can put a simple shell script in the recovery console init sequence: check if the USB disk is connected and if it is not try to switch the cmdline arguments and continue booting.

The problem is I don't know where I can put such script so to see it executed when entering the rescue console. I know I have to alter the initramfs.gz content and I can use the /etc/initramfs-tools folder, but by putting a simple

echo "Testing now!!!!"

inside a test.sh file in the scripts/premount-init and/or scripts/premount-local folder didn't produce any output change in my boot sequence (and yes, I did run the xbian-update-initramfs and I did uncomment the initramfs directive in the config.txt file).

Now I'm questioning myself regarding my comprehension of initramfs...

Should the scripts located in those folders get executed before the root filesystem gets mounted?
What is the difference between those prefixed with init and those with local?
Where those scripts should end up in the newly created initramfs?
Should them be visible from within the rescue console?


My plan for the sd-fallback.sh script is:
1. check for usb disk by LABEL/UUID (blkid)
2. check for /rootfs content (ls)
3. in case one of the above fails and cmdline.txt.usb does not exist
3.1. copy current cmdline.txt onto cmdline.txt.usb
3.2 copy cmdline.txt.sd onto cmdline.txt (force)
3.3 exit rescue mode

I believe this could be useful in many situations....

Any help is appreciated
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Messages In This Thread
Customize initramfs SD fallback - rlogiacco - 31st Jul, 2014 05:58 PM
RE: Customize initramfs - CurlyMo - 31st Jul, 2014, 06:20 PM
RE: Customize initramfs - rlogiacco - 31st Jul, 2014, 07:41 PM
RE: Customize initramfs for SD fallback - rlogiacco - 3rd Aug, 2014, 01:26 AM
RE: Customize initramfs SD fallback - rlogiacco - 4th Aug, 2014, 08:21 PM
RE: Customize initramfs SD fallback - mk01 - 6th Aug, 2014, 09:02 PM
RE: Customize initramfs SD fallback - rlogiacco - 6th Aug, 2014, 10:02 PM
RE: Customize initramfs SD fallback - mk01 - 6th Aug, 2014, 10:08 PM

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 3rd Jun, 2025, 04:39 PM Powered By MyBB, © 2002-2025 MyBB Group.