Help with GRUB --EDIT: Stupid Mistake

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Help with GRUB --EDIT: Stupid Mistake

Post by t0xic »

Hey everyone,

EDIT:

Apparently I mis-crafted my makefile, and it was compiling source from my backup directory... don't you just hate it when you make stupid mistakes?


I'm just switching over from a custom bootloader to grub. (using windows) Grub was working fine the first couple of times, but now when I replace the kernel.bin file, I have to reconfigure the entire bootdisk every time. Also, grub doesn't want to boot the correct version of my kernel. What's wrong, and is there any way to permanently config grub?

Thanks,

--Michael
Last edited by t0xic on Fri Jun 29, 2007 1:19 pm, edited 1 time in total.
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Post by Kevin McGuire »

I think it could help if you tell us more about:
  • How you reconfigure the boot disk?
  • The error message, or description of problem, when GRUB boots?
  • More specific information about not booting the version you want?
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

I have to use the "install (fd0)/boot/stage1 (fd0) (fd0)/boot/stage2 (fd0)/boot/menu.cfg", on my aux disk each time to configure the boot disk.

When I want to put an updated kernel on the disk, grub doesn't start and I get the "non-system disk" fat12 error.

What I mean about an old version is: For instance: if I add a new line saying: "printk("Testing Grub");" It's like it never happens. The kernel is compiling right (im using gcc cross i586-elf), so I think it's a Fat error (not really overwriting or something)

Hope this helps,
Thanks,
--Michael
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

what program are you using to edit the disk with.
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

I'm using the grub auxiliary disk to get the boot disk with my kernel on it running. Each time I copy my kernel over to the boot disk in a:\boot\, I have to use the aux disk to reconfigure my boot disk :evil: Grub is evil...

--Michael
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Post by Kevin McGuire »

I have never heard of or had GRUB delete or modify the contents of my floppy disk before..

We need more information:
  • What are the contents of the disk after GRUB supposedly screws it up? Are the GRUB stage files including the grub.conf still there and not corrupted?
  • Have you verified that you actually placed the newly compiled kernel image onto the disk by reading back the file to double check?
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

Grub just started this yesterday :?

I wouldn't call it corrupted, but something else. Everything is still on the image, and even after I fully format and try again, still same error.
Here is an example of what I'm doing:

mount image
copy kernel to a:\boot\kernel.bin
dismount image
copy image to bochs folder
run bochs

I can tell there is an error because I made my entry function only do a loop, took out all text and everything, recompiled it and did the steps above after formating the image, and bochs will load an old kernel that still starts up. It's confusing. If I switch back to my custom bootloader, everything works fine... may just have to screw grub

Thanks for listening to me rant,

--Michael
User avatar
Bughunter
Member
Member
Posts: 94
Joined: Mon Dec 18, 2006 5:49 am
Location: Netherlands
Contact:

Post by Bughunter »

Here's an example GRUB 0.97 image (check the attachment), it immediately boots your 'kernel.bin' without waiting.

Put 'kernel.bin' in the root of the floppy disk.
Attachments
grub-0.97.zip
GRUB 0.97 image
(61.17 KiB) Downloaded 53 times
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

Thanks for the grub disk... But now grub assures me that my kernel is below the 1 MB mark... here is my linker script:

Code: Select all

OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)

ENTRY(start)
SECTIONS
{
	. = 0xC0000000;
	.text :	
	{
		code = .; _code = .;
		*(.text)
		. = ALIGN(4096);
	}

	.data :
	{
		data = .; _data = .;
		*(.data)
		. = ALIGN(4096);
	}
	
	.bss :
	{
		bss = .; _bss = .;
		*(.bss)
		. = ALIGN(4096);
	}

	.rodata : 
	{
		rodata = .; _rodata = .;
		*(.rodata)
		. = ALIGN(4096);
	}
	. = ALIGN(4096);
	end = .; _end = .;
}
Is there anything obviously wrong here that I'm missing?

Thanks,

--Michael
User avatar
Bughunter
Member
Member
Posts: 94
Joined: Mon Dec 18, 2006 5:49 am
Location: Netherlands
Contact:

Post by Bughunter »

What is going wrong then?
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

Thats what I don't know :)
My kernel should be loading at the 3 GB mark, but grub says it's not. I'll try again I guess...

--Michael
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

It doesn't get loaded at the 3gb mark (I doubt most people have RAM there anyways) grub loads it at the 1mb mark (I believe) and you have to map it to the 3gb mark using paging yourself.
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

Meh, it's working now.

Thanks to everyone who helped,
--Michael
Post Reply