Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an Atmel SAM9X system running Angstrom. I am trying to make a recovery partition so when a user holds a button during boot up the recovery partition boots up.

I have modified the bootstrap so when a button is held on boot up, an alternate linux kernel is loaded. What I want is the alternate kernel to load linux from the recovery boot partition not the normal main partition.

Is this even possible? Or can I load the recovery partition without using two kernels?

The reason I want this is so if the main bootable partition gets corrupted the recovery partition will copy itself to the main partition (similar to those Dell or HP windows machines with the recovery partition) and the main bootable partition will be restored.

Edit:
Giles suggestion did it. The bootstrap was setting the kernel command line argument, I just added root=/dev/mmcblk0p3 (boot from 3rd sd partition) to that and it booted from the desired partition!

share|improve this question
    
What bootloader are you using? Since you want to change the kernel that's loaded, you need to set this up with the bootloader. By the way, you may be interested in the Embedded Systems site proposal. –  Gilles Apr 25 '13 at 0:00
    
Im using the AT91Bootstarp it loads the kernel directly (no U-Boot). I already can load the alternate kernel from the bootstrap via button press, what I want is for that alternate kernel to load a different linux partition in memory. How do I make the kernel boot a partition of my choice? –  RMDS Apr 25 '13 at 0:36
    
The root partition is usually determined by a command line argument (root=…). It may also be determined by an initramfs. Do you use an initramfs? What are the kernel command line arguments? –  Gilles Apr 25 '13 at 0:49
    
The kernel command line arguments are just "debug" and initranfs is used. Im going to try setting the kernel command line arguments to boot from the desired partition –  RMDS Apr 25 '13 at 16:03
    
The bootstrap was setting the kernel command line argument, I just changed that to the desired partition and it worked! Thank you –  RMDS Apr 25 '13 at 16:41
add comment

1 Answer 1

up vote 2 down vote accepted

The kernel contains a default root partition setting, determined at compile time (you can change it in the binary image with the rdev command). You can pass an argument on the kernel command line to override this default at boot time, e.g. root=/dev/mmcblk9p42 to boot from MMC device 9 partition 42 instead of the default. The command line is passed to the kernel by the bootloader, so you need to change your bootloader configuration.

If there is an initrd or initramfs, it may override the root partition that was compiled in or passed by the bootloader.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.