Jump to content











Photo
- - - - -

MEMDISK Driver for Linux


  • Please log in to reply
10 replies to this topic

#1 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 13 June 2010 - 09:34 PM

There currently isn't a Linux driver to provide MEMDISK RAM disks nor GRUB4DOS RAM disks. That means that you can't simply take an .ISO of your favourite Linux distribution, load it into memory, boot it, and expect it to work. Why? Unless everything the distro needs is in the kernel and "initrd," the system will need to probe for another source of files. It won't find the RAM disk, because there's no driver.

It would be good to fix this. What I want from you, the users who are interested in such a feature, is the following:
  • Distribution name
  • Distribution download link
  • The results of the following command, when you boot the distro normally:
    $ uname -r
We might as well start gathering this data now.

#2 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1063 posts
  •  
    Belgium

Posted 13 June 2010 - 10:06 PM

Small distro's would be the best.

Parted Magic 4.10
$ uname -r

2.6.32.11-pmagic
http://partedmagic.com/download.html

It normally has the last kernel available.
Patrick Verner wants to get rid of the iso booting stuff (search the iso on a partition, mount it, read sqfs), so he might be interested in this approach.

#3 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 14 June 2010 - 03:12 AM

Uhh... Before getting too far with development, H. Peter Anvin (maintainer of the Syslinux boot-loader suite) informed me of the existence of the Linux MTD phram.ko kernel module. It appears to date back to 2005 (or earlier), with kernel version 2.6.12-rc2. While it doesn't automatically pick up MEMDISK nor GRUB4DOS memory-mapped disks, it can provide the disks if it's told where they are.

For example, in GRUB4DOS:
grub> map --mem /linux_distro.iso (hd32)

...

grub> map --hook



grub> map --status

...

Fr To Hm Sm To_C _H _S Start_lo Start_hi Count_lo Count_hi DHR

-- -- -- -- ---- -- -- -------- -------- -------- -------- ---

A0 FF .. .. .... .. .. XXXXXXXX 00000000 YYYYYYYY ........ ...



grub> root (hd32)

...

grub> chainloader (hd32)

...

grub> boot
Note the XXXXXXXX which, when multiplied by 512, is the 32-bit physical address for the RAM disk. Also note the YYYYYYYY YYYYYYYY, which is the length of the RAM disk, in 512-byte "sectors".

Or with Syslinux and MEMDISK, simply:
LABEL linux_distro

  KERNEL memdisk

  INITRD linux_distro.iso

  APPEND iso pause
The MEMDISK output will include:
Ramdisk at 0xXXXXXXXX, length 0xYYYYYYYY
Where again, you must note the XXXXXXXX, which is the 32-bit physical address for the RAM disk (do not multiply by 512) and YYYYYYYY, which is the 32-bit length of the RAM disk, in bytes.

With this information, you can then invoke the phram module in your Linux distribution early on when the distribution has only got its limited initramfs contents populated into the Linux rootfs (which is mounted at the / "root" directory). You'd unfortunately need to drop to a prompt or modify the "initrd" (which is actually the initramfs archive for >= 2.6 kernel versions) to load the phram module. Invoke it with something like:
$ modprobe phram phram=linux_distro,XXXX,YYYY
Where XXXX is the decimal start address in physical RAM that you obtained earlier, and YYYY is the decimal length of the RAM disk image, in bytes. Follow that up with:
$ modprobe mtdblock
and you should wind up with a /dev/mtdblock0 device, which should be the .ISO image, and should be mountable.

#4 brain0

brain0
  • Members
  • 2 posts
  •  
    Germany

Posted 21 June 2010 - 11:47 PM

[*]Distribution name


Arch Linux

[*]Distribution download link


http://www.archlinux.org/download/

[*]The results of the following command, when you boot the distro normally:

$ uname -r


2.6.34-ARCH

If such a driver existed and would be able to detect the memdisk automatically, our ISO could be easily adjusted to boot with memdisk.

#5 H. Peter Anvin

H. Peter Anvin
  • Members
  • 7 posts
  •  
    Sweden

Posted 22 June 2010 - 12:31 AM

I just added a very trivial program to the Syslinux master tree which searches for a MEMDISK installation and outputs its base and length in a format which should be possible to feed to the insmod command line.

#6 supaJ

supaJ

    Member

  • Members
  • 51 posts
  •  
    Canada

Posted 22 June 2010 - 06:38 AM

I just added a very trivial program to the Syslinux master tree which searches for a MEMDISK installation and outputs its base and length in a format which should be possible to feed to the insmod command line.

@ Pete, could you please give the location of this program and an example of how it works?

#7 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 22 June 2010 - 07:02 AM

Just in case H. Peter doesn't see your question any time soon, supaJ:
  • Click here[1]
  • On the line with the master tag, click on the tree link to the right of it
  • Click on the utils directory
  • Find memdiskfind.c and click on the raw link to the right of it
That is the source code. I would expect it to be available in the next release of Syslinux. I would expect the usage could be something like:
$ modprobe phram phram=memdisk,$(./memdiskfind)
Which you could follow up with the mtdblock module afterwards.

[1] Syslinux top-of-git

#8 brain0

brain0
  • Members
  • 2 posts
  •  
    Germany

Posted 22 June 2010 - 11:17 PM

This hook for Arch Linux's mkinitcpio detects the memdisk on boot:
http://projects.arch...d5af39930e315ea

This udev rules creates a /dev/memdisk symlink and the usual /dev/disk/by-{uuid,label} symlinks, as udev's default rules ignore mtd*:
http://projects.arch...1-memdisk.rules

#9 xpt

xpt

    Frequent Member

  • Advanced user
  • 138 posts
  •  
    Canada

Posted 23 June 2010 - 04:14 PM

What I want from you, the users who are interested in such a feature, is the following:


> Distribution name

Debian, best try with grml-medium, from http://grml.org/
http://grml.org/chan...medium-2010.04/

> Distribution download link

http://grml.org/download/

> uname -r

2.6.32-grml/2.6.32-grml64

#10 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1063 posts
  •  
    Belgium

Posted 05 December 2010 - 09:46 PM

Parted Magic 5.8 (from build December 5th 2010) can be fully booted with MEMDISK.
LABEL memdisk_PM

MENU LABEL Boot Parted Magic with MEMDISK

LINUX memdisk

INITRD /pmagic-5.8.iso

APPEND iso
Now it doesn't need to find the ISO on a filesystem anymore, so you can boot the full ISO over PXE.

#11 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 06 December 2010 - 04:29 AM

Parted Magic 5.8 (from build December 5th 2010) can be fully booted with MEMDISK.

LABEL memdisk_PM

MENU LABEL Boot Parted Magic with MEMDISK

LINUX memdisk

INITRD /pmagic-5.8.iso

APPEND iso
Now it doesn't need to find the ISO on a filesystem anymore, so you can boot the full ISO over PXE.

Excellent. :worship:

And if using gpxelinux.0 and wishing to use HTTP as the (faster than TFTP) transfer protocol, you could include:
LABEL memdisk_PM

  MENU LABEL Boot Parted Magic with MEMDISK

  LINUX http://webserver/memdisk

  INITRD http://webserver/pmagic-5.8.iso

  APPEND iso





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users