LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   creating grub iso image (https://www.linuxquestions.org/questions/linux-newbie-8/creating-grub-iso-image-4175425269/)

sunilbn 09-02-2012 11:18 AM

creating grub iso image
 
Hi:

I basically have two question about grub. I'm running linux mint maya 13 on my system.

1) how to compile grub (version 0.95) source code got from ftp://alpha.gnu.org/gnu/grub/ ?

Here's what i tried to do:

bash# cd /usr/src/grub-0.95
bash# export CC="gcc -mcpu=i386"
bash# ./configure --host=i386-pc-linux-gnu --without-curses
bash# make

but sadly i got some error,

configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for i386-pc-linux-gnu-strip... no
checking for strip... strip
checking build system type... i686-pc-linux-gnu
checking host system type... i386-pc-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for i386-pc-linux-gnu-gcc... gcc -mcpu=i386
checking for i386-pc-linux-gnu-gcc... (cached) gcc -mcpu=i386
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -mcpu=i386 accepts -g... yes
checking for gcc -mcpu=i386 option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc -mcpu=i386... gcc3
checking dependency style of gcc -mcpu=i386... (cached) gcc3
checking for i386-pc-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking whether optimization for size works... yes
checking whether gcc has -fno-stack-protector... yes
checking whether -Wundef works... yes
checking whether -falign-loops works... yes
checking for i386-pc-linux-gnu-objcopy... no
checking for objcopy... objcopy
checking if C symbols get an underscore after compilation... no
checking whether objcopy works for absolute addresses... no
configure: error: GRUB requires a working absolute objcopy; upgrade your binutils

how to fix this line? Does it mean i have to install someother version of objcopy?

2) How do i create an iso image from grub binaries (stage1 and stage2) ? Only grub UI with dummy entries no real kernel to load.

Thanks,
-Sunil

Snark1994 09-02-2012 11:42 AM

It tells you what to do - upgrade binutils, not objcopy. However, a more pertinent question is perhaps "Why? What are you trying to achieve?". I can see no reason for a live CD that doesn't load anything...

sunilbn 09-02-2012 12:16 PM

Well, to understand how grub works I thought creating a dummy grub that loads nothing would be sufficient ( including building grub and creating an ISO image). But I'm stuck at the initial step itself. I would appreciate if could comment on my second question.

Snark1994 09-02-2012 12:36 PM

I don't know much about liveCDs, but I get the impression that it's different to how the MBR works. You would be better off with something like bochs, which allows you to emulate a computer booting normally. Take a look at this thread (and I'm sure countless other ones, and pages on the web) for a high-level view of what the code does, and then you could look at the source code itself, and then compile and install grub in a bochs image.

If you do want to continue with a live CD, I know that it treats the first sector of the CD as a floppy disk, so you can read http://www.vnutz.com/content/program_a_bootstrap_loader for an example of writing a bootable floppy, then you'd have to work out how to load the rest of the CD from that - any way you do it, it's gonna be a lot of assembly code.

yancek 09-02-2012 12:48 PM

It would seem the best source for information of this kind would be the Grub site. See the link below for an explanation of creating a Grub boot CD. Basically, all you need is the stage2_eltorito file and if you want to boot anything, you will need a menu.lst. You could probably just use the chainloader method.

http://www.gnu.org/software/grub/man...ble-CD_002dROM


All times are GMT -5. The time now is 12:34 AM.