Assign fix boot device node at boot time

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Assign fix boot device node at boot time

944 Views
Farrukh
Contributor II

Greetings All,

I have a custom hardware based on SaberLite. I have following hardware on the board

SD Card on SD3 <-- Device 0 in U-Boot

eMMC on SD4    <-- Device 1 in U-Boot

Now ofcourse I always want to boot from eMMC which is on SD4. My kernel + root filesystem reside on eMMC. I can fix Device 1 in U-Boot and I can load my kernel always from eMMC but the problem comes when accessing root filesystem. My boot arguments are

root=/dev/mmcblk0p1

With this root device where I do not have any SD Card inserted (at boot time), I can get the good device pointing to rootfs. But when booting with SD Card inserted, /dev/mmcblk0p1 points to the SD Card first partition and /dev/mmcblk1p1 points to eMMC first partition, so that is not a good rootfs for the system hence the system is unable to boot when booted with SD Card inserted. My device users can not change the boot parameters, neither I can make sure my users does not boot the system with SD Card inserted and also that is not a good solution.

I want to fix the device node for the eMMC at the kernel boot time. Anyone can suggest how can I do it or is there any other solution to this problem

Regards,

Farrukh Arshad.

Labels (1)
0 Kudos
Reply
1 Reply

793 Views
Farrukh
Contributor II

Ok. Here is the solution which I have implemented.

Uboot script is

ls mmc 1 # eMMC is at device 0 and SD Card is at device

if test $? -eq 0; then # If sd card is inserted ls will list the partition contents otherwise it will report error.

        echo " === SD Card is inserted === " # When SD Card is inserted I know my eMMC will be at node /dev/mmcblk1p1

        setenv bootargs root=/dev/mmcblk1p1 init=/sbin/mmcblk1 rootwait rw ip=off fixrtc console=ttymxc3,115200 vmalloc=192M imx2_wdt.nowayout=0;

else

        echo " === SD Card is not inserted === " # When SD Card is not inserted I know my eMMC will be at node /dev/mmcblk0p1

        setenv bootargs root=/dev/mmcblk0p1 init=/sbin/mmcblk0 rootwait rw ip=off fixrtc console=ttymxc3,115200 vmalloc=192M imx2_wdt.nowayout=0;

fi

This is working good for me. My question is, Is this solution good for a product grade embedded device or not ?

0 Kudos
Reply