Jump to content

What Makes A Linux Cd Bootable? Is It Grub?


Recommended Posts

Posted

I need to create a bootable disk (CD-R) containing a compressed linux kernel. Will Grub make this happen?

If you can answer that question, then would you know how do I setup the "/boot/grub/menu.lst" file? What device do I use... /dev/cdrom? What if I do not have this device? How do I create it?

I should mention that I have looked into "isolinux", but I didn't quite understand it all. Is it similar to Grub, or is comparing the two like comparing apples to oranges?

Posted

Yes there's a difference. Grub is installed on a hard drive and the Bios reads the MBR that directs it to load Grub. From there, Grub takes over. Bootable CDs used to use "El Torito" which tricks the bios ito thinking that the CD is actually a floppy disk. Once the small boot programme is loaded, it read used built i cd-rom drivers to access the rest of the disk. ISOLINUX is the newest way to provide bootable disks, and it's actually very similar to the old way except you don't need a special floppy image for it to work.

During a hard drive install boot up, Grub keeps track of where the various kernels are and loads them. You can pass commands to the kernel from Grub, otherwise the kernel knows what to do based on the way it was configured and compiled.

If you create a bootable cdrom, it wouldn't know where anything was simply because of all the different hardware configurations out there. Say for instance i put it in my laptop. Well, my cdrom is hdc. But my workstation's cdrom is hda. So if you tried to hardcode the root filesystem in your bootable cdrom, it wouldn't be able to find it except on machines IDENTICAL to yours.

To work around this, isolinux actually scans attached devices looking for the /isolinux partition. Once found, the kernel is loaded. Isolinux than grabs the initrd.gz file and lets the kernel know where it is and expand it. Assuming you have initrd and ram disk built into your kernel, it than takes the linuxrc from the expanded initrd file. This linuxrc than loads whatever real root filesystem included on the disk to your ram disk.

There are isolinux.bin files out there, but if you want a custom kernel, you're going to have to build it yourself. Just out of curiousity, what's the need for that can't be satisfied by a Slax or DSL CD?

Posted

I have not heard of SLAX or DSL (in the context you are using)?

As for my needs, well actually, it is for the company where I work. In the past they had built a cross-compiler on an x86 to build necessary tools (i.e. packages) and GRUB, and conveniently placed these into a Linux-style directory structure. GRUB was used to load the kernel, etc. I have the binaries for the cross-compiler, but I cannot get it to compile Linux 2.4.27 (which is what my company is using) on an x86_64 architecture. The original x86 that the tools were built on has long been decommissioned.

Creating a new cross-compiler, then compiling various packages... and hoping nothing goes wrong along the way... is a time-consuming chore. Then GRUB comes into play. Once all of the binaries are installed into their appropriate areas within the linux directory structure, including GRUB binaries, then an ISO image can be built. When I get to the stage where I can produce an ISO, then I can write it to a CD-R and hence create, in theory, a bootable Linux installation. If the disk does not boot, then it could be a simple or a complicated issue causing the problem... the latter which would make me have to repeat the exercise described above again. Each iteration takes 16-24 man-hours.

Unlike other Linux distros (for example, LiveCD or Knoppix), I need something where after the kernel is uncompressed in a RAM disk, a "home-made" script can be run that prompts the operator if they want to install or upgrade their the software on their HDD. After the choice is made and the action is complete, the operator is prompted to remove the CD-R, and reboot the system. After rebooting, the system behaves as a turn-key system where a specialized application (that is Qt and X-Windows dependent) is run. There is no need for the operator to log into the system, for this is done automatically. There is also no need for operator to input partition information for the HDD, user account information, or any of the other settings normally presented to an operator that is installing Linux from the common distros like Ubuntu, Fedora, Red Hat, etc.

If you understand the above, then you have accomplished a great feat. For me, it is easy to lose sight of what I need. For instance, the whole purpose for the exercise above is simply because I cannot recompile the Linux kernel (version 2.4.27) that my company uses, so that I can install USB support. Without the cross compiler, there is not much I can do. My company currently uses GCC 3.2.3 (?) which was built incorrectly, and which I cannot rebuild on the x86_64. If I try GCC 4.1.1 or 4.1.2, then Linux 2.4.27 is not compatible... thus a later kernel (i.e. 2.6.x) is required. Then throw in the appropriate versions of binutils, glibc, kernel header, and other packages and then you can start to imagine the complexities. Take a look at this site to get an idea of what it takes to build linux: Cross-Compiled Linux From Scratch

I am not a GCC (or GNU) expert and frankly I would love to have a distro where I can easily remove unnecessary packages such as evolution, firefox, etc and install my company's scripts/applications. From that, I would like to create an ISO image from the resulting product. This entire product has to fit on a 700 MB CD-R but preferably not take up more than 450 MB (its always nice to have extra space for future needs). Pulling stuff off the WWW after post-install is not an option because the system may not have a network connection.

I just hope by the end of business tomorrow I will have something built. I have been working on this nonsense for over a week and a half. There is nothing less satisfying than compiling various source packages over the course of a day or two just to find out that it doesn't work and then having to start all over again.

Well, I thought this was going to be a short description of the issues I have been dealing with, but apparently it is not. The query I had concerning GRUB was merely because I'd hate to spend a couple of days only to find that it is not GRUB that is needed, but instead IsoLinux, or something else. Both GRUB and IsoLinux require the 'initrd' file, which I am not even sure what is the proper way to create it. If I proceed into researching info on GRUB, I want to make sure it will work for my needs.

Anyhow, it is bed time... I'm tired of thinking of this cr*p. I'm sure glad my company is paying me for all this work though.

Posted

If I'm understanding, you're attempting to do this on your home computer which is a x86-64? And the intended computers are vanilla x86 installs?

You really shouldn't have a problem compiling it. I think what the issue may be is that you're insisting on using the 2.4 kernel on the cd. You don't have to. Sticking with a 2.6 kernel on the cd will solve that problem.

Without creating an upgrade disk using the actual distro that's installed, I can't see you being able to accomplish what you're attempting to do. You'd be best off backing up the client's /home directories and installing an image. That than requires a bit of work on the admin's part to create the user again and than loading their home directories back, but I think it would be less work than you pulling your hair out trying to get an upgrade going using a disk with various libraries that were built improperly.

Another thing you may consider doing is ssh'ing in and simply reconfiguring and recompiling the kernels from another box. You say that the machines may not have a network connection....I'm not understanding whether you meant no LAN at all or no Internet. Obviously, this is going to be a problem if you can not move the boxes to a network cable, but otherwise it's something you could do. In fact, you could log onto several boxes at once and complete the process much more quickly.

I may be evil for saying this, but not only is it easier for you, but it will ensure that you have a job in the future. If they have an easy scripted way to do this, they really don't need you do they. :o

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.



×
×
  • Create New...