Multiple LEAFs on a single IDE device

How to partition a 256MB CF card and boot LEAF from either one using grub.

Note: All of this was done with VMWare Server on a Windows laptop, but it should work on a standalone PC the same.

The initial install requires another boot media, such as a Knoppix CD, to partition the CF card, format the partitions and install grub.

  1. Boot from the Knoppix CD with the CF card attached as /dev/hda
  2. Partition the disk:
    • fdisk /dev/hda
    • o – create an empty DOS partition table
      n – add a new partition

    • p – to create a new primary partion
    • 1 – for first partition
    • enter – default cylinder
    • +2M – small partition for grub
    • n – add a new partition
    • p – to create a new primary partion
    • 2 – for first partition
    • enter – default cylinder
    • +128M – half the CF card
    • n – add a new partition
    • p – to create a new primary partion
    • 3 – for second partition
    • enter – default cylinder
    • enter – the rest of the CF card
    • a – make it bootable
    • 1 – first partition
    • t – select a partition type
    • 2 – first partition
    • 6 – for FAT
    • t – select a partition type
    • 3 – second partition
    • 6 – for FAT
    • w – write partition table and exit
  3. Format each partition
    • mke2fs /dev/hda1
    • mkfs.msdos /dev/hda2
    • mkfs.msdos /dev/hda3
  4. Set e2fs partition to never check
    • tune2fs -c 0 -i 0 /dev/hda1
  5. Mount /dev/hda1, /dev/hda2 and /dev/hda3
    • mount -t ext2 /dev/hda1 /mnt/hda1
    • mount -t msdos /dev/hda2 /mnt/hda2
    • mount -t msdos /dev/hda3 /mnt/hda3
  6. install grub: grub-install –root-directory=/mnt/hda1/ /dev/hda
  7. /boot/grub/menu.lst
    default 0
    timeout 30
    title LEAF hda2
         root (hd0,1)
         kernel (hd0,1)/linux root=/dev/ram0 rw init=/linuxrc LEAFCFG=/dev/hda2:msdos  
             PKGPATH=/dev/hda2:msdos syst_size=16M log_size=8M LRP=root,config,etc,local
         initrd (hd0,1)/initrd.lrp
    title LEAF hda3
         root (hd0,2)
         kernel (hd0,2)/linux root=/dev/ram0 rw init=/linuxrc LEAFCFG=/dev/hda3:msdos 
             PKGPATH=/dev/hda3:msdos syst_size=16M log_size=8M LRP=root,config,etc,local
         initrd (hd0,3)/initrd.lrp
    
  8. Mount Bering uClibc 2.4.2 CD
    • mount -t iso9660 /dev/hdd /mnt/hdd
  9. Copy over needed files
    • cp /mnt/hdd/*.lrp /mnt/hda2/
    • cp /mnt/hdd/initrd_ide_cd.lrp /mnt/hda2/initrd.lrp
    • cp /mnt/hdd/linux /mnt/hda2/
    • cp /mnt/hdd/leaf.cfg /mnt/hda2/
  10. Repeat for second partition
    • cp /mnt/hdd/*.lrp /mnt/hda3/
    • cp /mnt/hdd/initrd_ide_cd.lrp /mnt/hda3/initrd.lrp
    • cp /mnt/hdd/linux /mnt/hda3/
    • cp /mnt/hdd/leaf.cfg /mnt/hda3/
  11. Optional, not needed unless you used ext2 or ext3 partitions instead of msdos: Add the ext2.o module to initrd_ide_cd.lrp, using the instructions in the LEAF docs.
    mount /mnt/hda1
    mount /mnt/hdc (CDROM drive)
    cp /mnt/hda1/initrd_ide_cd.lrp /tmp/initrd.gz
    gunzip /tmp/initrd.gz
    mkdir /mnt/initrd
    mount -t minix /tmp/initrd /mnt/initrd -o loop
    cp /mnt/hdc/lib/modules/2.4.32/kernel/fs/ext2/ext2.o /mnt/initrd/boot/lib/modules/
    nano -w /mnt/initrd/boot/etc/modules (add ext2 to autoload list)
    umount /mnt/initrd
    gzip /tmp/initrd
    cp /tmp/initrd.gz /mnt/hda1/initrd_ide_cd_ext2.lrp
    nano -w /mnt/hda1/boot/grub/menu.lst (change the initrd.lrp line for that partition)
    umount /mnt/hda1
    

Just another WordPress site