4

I have been following A Minimal Linux System from Scratch in order to build a Linux with a small footprint (10MB or less).

I'm fairly certain that there were no errors up until the last point, where I'm actually testing the image, using the command qemu-system-i386 -L . -hda minux.img

Instead of actually booting to the # prompt as the tutorial showed, I'm greeted by the Grub Rescue Prompt. In order to attempt booting, I used kernel /boot/kernel_name then boot, which ultimately fails with: Grub 2 Output

My grub.conf is below, identical to the one in the tutorial:

default 0
timeout 30
title Minux
root (hd0,0)
kernel /boot/vmlinux-2.6.21-1 root=/dev/hda1 rw

So far the only difference I've managed to find was in fdisk, where my starting sector is 2048, since it's the minimum I can set using fdisk and as a consequence the offset is bigger. Another difference is that I'm using x86_64-pc grub and some of my busybox libs are named differently, but this should not interfere with boot.

How could I fix the procedure to make my linux work? Or is there a better way to make a linux distribution under 10MB?

7
  • Perhaps the disk has a different name? The GRUB configuration shows hda1, maybe it is sda1 or vda1? Or GRUB calls it something different, so that root (hd0,0) doesn't work?
    – muru
    Jan 7, 2015 at 14:56
  • isn't the -hda part supposed to attach it at hda? and since there's only one partition, shouldn't it be hda1? Jan 7, 2015 at 14:59
  • Hmm, yes. I didn't see the qemu command.
    – muru
    Jan 7, 2015 at 15:00
  • 1
    grub and minimal are fairly at odds here, don't you think? Why are you using such a bloated bootloader at all?
    – mikeserv
    Jan 7, 2015 at 23:43
  • @mikeserv grub was used in the tutorial I was folowing, so I guessed it was the way to go Jan 8, 2015 at 14:24

1 Answer 1

1

let me try answer the second question about make a small system . since we are building on x86 i guess what is intended is to make a system to boot of a flash drive , rather than burn into embedded chips for which is a very different story .

consider drop disk images and use a cpio initramfs . then boot like this .

qemu-system-i386 -kernel vmlinuz -initrd root.cpio.gz

i love this because we have more flexibilites and don't have to be confused with disk locations .

i also suggest grub4dos the bootloader . despite "dos" in the name , it can be installed from linux and boot linux kernels . the installation is as simple as write an mbr and copy one 213k file to any partition . and grub4dos recognises many filesystems .


besides , in your configuration it seems you didn't set up grub right , for there is a rescue console showed . even though you should type kernel /boot/kernel_name with a "root=" before boot .

and on my machine the qemu guest kernel recognises the disk image as "/dev/sda" instead of "/dev/hda" .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .