Warning: Parameter 1 to Language::getMagic() expected to be a reference, value given in /opt/local/apache2/htdocs/wiki/includes/StubObject.php on line 58
Compute Linux - OSR

Compute Linux

From OSR

Jump to: navigation, search

Compute Linux

Minimal runtime environment built on the xt3-compute Linux environment for Redstorm. Check out the CVS tree from rsc-c2:/cvshome/cvsroot/xt3-compute.

Current target is Linux-2.6.19 and support for x86_64 is not 100% there for builds on non-x86_64 hosts.

Building a root filesystem for Bochs

Since Bochs wants a real disk image with a bootloader, not just an ext3 filesystem, it is necessary to build it and install grub or something else onto it. Complicating things is that the first partition occurs at offset 32256 from the start of the disk image.

You can do it by hand as described here, or use the make-root-image script.

  • Make the disk image extent of 32 MB and map it to /dev/loop3:
   dd if=/dev/zero of=/tmp/disk.img count=32 bs=1024K
   losetup /dev/loop3 /tmp/disk.img
  • Build the partition table:
   fdisk /dev/loop3 <<EOF
   n
   p
   1
   
   w
   EOF
  • Undo the loopback, then recreate it with the offset and create the filesystem
   losetup -d /dev/loop3
   losetup -o 32256 /dev/loop3 /tmp/disk.img
   mkfs.ext3 /dev/loop3
  • Undo the loopback and recreate it with no offset and mount the ext3 fs
   losetup -d /dev/loop3
   losetup /dev/loop3 /tmp/disk.img
   mkdir /tmp/loop
   mount -o loop,offset=32256 /tmp/disk.img /tmp/loop
  • Copy all of the grub files into the new filesystem and remove the extraneous menu.lst file.
   mkdir /tmp/loop/grub
   cp /boot/grub/* /tmp/loop/grub
   rm /tmp/loop/grub/menu.lst
  • Install the boot loader
   grub --no-curses --no-floppy <<EOF
   device (hd0) /tmp/disk.img
   root (hd0,0)
   setup (hd0)
   EOF
  • Update the grub.conf to name our kernel, ignoring the rest of the stuff that might have been there.
   cat <<EOF > /tmp/loop/grub/grub.conf
   title nway-Linux
       kernel /vmlinuz-2.6.19.bzImage
   EOF
  • Grub 0.97 appears to like menu.lst better than grub.conf
   ln -s /tmp/loop/grub/grub.conf /tmp/loop/grub/menu.lst
  • Copy your kernel and any other files that you might want into the root fileystem.
  • Unmount the file system and tear down the loopback
   umount /tmp/loop
   losetup -d /dev/loop3
  • Configure your Bochs setup to use the disk.img for your root filesystem.
  • Give it a try!