You are not logged in.

#1 2010-05-16 07:33:43

crotonic
Member
Registered: 2010-05-16
Posts: 2

[SOLVED] Booting to SD card (mmcblk0) with Grub2

I have a laptop with win7/Ubuntu on the hard drive; this laptop also has an SDHC slot.
For my own reasons I decided to install Arch on an SD card.
I installed arch according to this very helpful post: http://bbs.archlinux.org/viewtopic.php?pid=398679
Since the system already boots with Grub2 from the Ubuntu install I skipped the grub install steps.
My BIOS cannot boot to SD cards (even with the bootable flag set on the mmcblk0p1 partition)
I booted into Ubuntu and ran update-grub, this added the following entry to the Grub2 boot menu: "Arch (on /dev/mmcblk0p1)"
Booting to this gives three errors:
no such device (error lists correct UUID of SD card)
hd2,1 cannot get C/H/S values
you need to load the kernel first

the entry in grub.cfg is:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Arch (on /dev/mmcblk0p1)" {
    insmod ext2
    set root='(hd2,1)'
    search --no-floppy --fs-uuid --set 7b8f752b-2d7e-46f9-9989-77ff1e481b97
    linux /boot/vmlinuz26 root=/dev/mmcblk0p1
    initrd /boot/kernel26.img
}

Last edited by crotonic (2010-05-22 05:23:01)

Offline

#2 2010-05-17 03:06:37

Odysseus
Member
Registered: 2009-02-15
Posts: 141

Re: [SOLVED] Booting to SD card (mmcblk0) with Grub2

I think it would work if you could put /boot on your hard drive.

I'm not familiar with grub2 or else I would try editing your grub.cfg entry as if you had /boot on, for example, /dev/sda3.
Maybe someone else knows how to, or maybe you can figure it out.

Last edited by Odysseus (2010-05-17 03:09:22)


I'm the type to fling myself headlong through the magical wardrobe, and then incinerate the ornate mahogany portal behind me with a Molotov cocktail.

Offline

#3 2010-05-18 06:43:38

crotonic
Member
Registered: 2010-05-16
Posts: 2

Re: [SOLVED] Booting to SD card (mmcblk0) with Grub2

I have got the system to boot the way I want and will try to detail it for others

1) Make a kernel that can boot an SDHC card
I found this list of needed kernel modules for doing this with ubuntu: http://www.linuxformat.com/forums/viewtopic.php?t=11709
First I chroot-ed from ubuntu into my sd card according to: http://wiki.archlinux.org/index.php/Ins … ting_Linux
then using the wiki as my guide: http://wiki.archlinux.org/index.php/Mkinitcpio
I copied /etc/mkinitcpio.conf to a new file /etc/mkinitcpio-custom.conf
and edited the modules line to look like so

MODULES="mmc_core mmc_block sdhci sdhci-pci"

then ran (still while chroot-ed of course) note that the -k option should match the version that you are using (mine is 2.6.33)

# mkinitcpio -c /etc/mkinitcpio-custom.conf -g /boot/kernel26-custom.img -k 2.6.33-ARCH

exit the chroot back to ubuntu

2) Move the files to the boot partition
I am using ubuntu's partition as the boot since that is where grub2 is installed
First I made a copy and renamed vmlinuz26 to vmlinuz26-custom
and another copy/rename to make System.map26-custom
NOTE: I am not sure if renaming these helps/hurts/or doesnt matter (feed back appreciated)
then I moved those 2 files and kernel26-custom.img to the /boot of the ubuntu /

3) Setup a working grub.cfg
Since it is recommended to not edit grub.cfg directly in Grub2 I just added the following entry to /etc/grub.d/40_custom

menuentry "Arch (on /dev/mmcblk0p1) custom" {
        set root='(hd0,5)'
        linux /boot/vmlinuz26-custom root=/dev/mmcblk0p1
        initrd /boot/kernel26-custom.img
}

and run this

update-grub

hd0,5 is grub2 notation for my ubuntu partition (where /boot is of course)

This is all I did to get it running that I can remember
Arch's /etc/fstab is:

# <file system>        <dir>         <type>    <options>          <dump> <pass>

/dev/mmcblk0p1         /             ext2      defaults,noatime    0      1

devpts                 /dev/pts      devpts    defaults            0      0
shm                    /dev/shm      tmpfs     nodev,nosuid        0      0

/dev/cdrom             /media/cd   auto    ro,user,noauto,unhide   0      0
/dev/dvd               /media/dvd  auto    ro,user,noauto,unhide   0      0
/dev/fd0               /media/fl   auto    user,noauto             0      0

notice that there is no /boot mount point
I can boot into Arch using the setup I described above with a totally empty /boot on the Arch partition
Should I care that it is not mounted?

I hope this helps other people trying to boot from SD cards

Offline

#4 2010-05-18 10:22:42

Odysseus
Member
Registered: 2009-02-15
Posts: 141

Re: [SOLVED] Booting to SD card (mmcblk0) with Grub2

Nice.  I can't imagine the filenames of your custom kernel and initrd makes much a difference, as long as they are unique.

It'll be annoying every time the kernel gets upgraded, though. You could make a dedicated boot partition that gets used for both Arch and Ubuntu, and then just modify /etc/mkinitcpio.d/kernel26.preset so that you won't have to create a new ramdisk and copy it to the Ubuntu partition.

Although that may be more of a pain than it's worth.


I'm the type to fling myself headlong through the magical wardrobe, and then incinerate the ornate mahogany portal behind me with a Molotov cocktail.

Offline

#5 2010-05-18 17:29:51

parintachin
Member
Registered: 2009-05-25
Posts: 72

Re: [SOLVED] Booting to SD card (mmcblk0) with Grub2

have you tried appending rootwait to the kernel line ?

Offline

Board footer

Powered by FluxBB