Page 1 of 1
Yet another grub 13 error
Posted: Sat Sep 08, 2012 2:42 pm
by evoex
Hi all,
Today I had to re-start coding from scratch as my laptop died (and I'm too lazy to make backups). I've set up a cross compiler for x86_64 on my Mac. Now I'm getting grub error 13 and, yes, I did try what it says on the Wiki...
My code is extremely simple so far. First, I took the RDOS grub disk image. My "entry.s" file is simply:
Code: Select all
[section .__mbHeader]
MODULEALIGN equ 1 << 0
MEMINFO equ 1 << 1
FLAGS equ MODULEALIGN | MEMINFO
MAGIC equ 0x1BADB002
CHECKSUM equ ~(MAGIC | FLAGS)
align 0x4
dd MAGIC
dd FLAGS
dd CHECKSUM
[section .setup]
[global _start]
_start:
jmp $
My Link.ld:
Code: Select all
OUTPUT_FORMAT(elf32-i386)
ENTRY(_start)
SECTIONS {
. = 0x00100000;
.__mbHeader : {
*(.__mbHeader)
}
.text ALIGN(0x1000) : {
*(.setup)
}
/DISCARD/ :
{
*(.comment)
*(.eh_frame)
}
}
And it gets compiled as:
/opt/local/bin/yasm -f elf32 -o entry.o entry.s
/usr/local/cross/bin/x86_64-elf-ld -melf_i386 -T Link.ld -o kernel ./entry.o
Yes, I do link it with a 64 bit linker, as my cross compiler is 64 bits, but I believe that should work fine for compiling 32 bit applications... right?
All looks fine, except that I get a grub error 13: Invalid or unsupported executable format.
Some information about the kernel binary:
$ /usr/local/cross/bin/x86_64-elf-objdump -s kernel/kernel
kernel/kernel: file format elf32-i386
Contents of section .__mbHeader:
100000 02b0ad1b 03000000 fc4f52e4 .........OR.
Contents of section .text:
101000 ebfe0000 00000000 00000000 00000000 ................
$ /usr/local/cross/bin/x86_64-elf-objdump -f kernel/kernel
kernel/kernel: file format elf32-i386
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00101000
What's the issue? Is there something wrong with my multiboot header?
Thanks in advance
Re: Yet another grub 13 error
Posted: Sat Sep 08, 2012 7:29 pm
by evoex
Ok, I solved it...
The line
should have been
That is, no bitwise not, but the negative value... Those two symbols can look quite similar in some fonts
.
Re: Yet another grub 13 error
Posted: Sat Sep 08, 2012 11:50 pm
by CocaCola
evoex wrote:Today I had to re-start coding from scratch as my laptop died (and I'm too lazy to make backups).
I don't know about the toolchain you use on your Mac, but on Linux you can certainly use the
Makefile to automate backups. I myself have a
Backup section which cleans, then creates a nice archive of the current source.
Re: Yet another grub 13 error
Posted: Sun Sep 09, 2012 2:31 am
by bluemoon
You can always do code backup by doing nothing. That's what computer for - it do things so you don't need to get involved.
Try svn post-commit hook.
Re: Yet another grub 13 error
Posted: Sun Sep 09, 2012 2:08 pm
by JamesM
CocaCola wrote:evoex wrote:Today I had to re-start coding from scratch as my laptop died (and I'm too lazy to make backups).
I don't know about the toolchain you use on your Mac, but on Linux you can certainly use the
Makefile to automate backups. I myself have a
Backup section which cleans, then creates a nice archive of the current source.
It's almost like you haven't heard of version control...
Re: Yet another grub 13 error
Posted: Sun Sep 09, 2012 2:26 pm
by Kevin
evoex wrote:should have been
This fixes only one of the two wrong operators...
Re: Yet another grub 13 error
Posted: Mon Sep 10, 2012 10:46 am
by evoex
Kevin wrote:evoex wrote:should have been
This fixes only one of the two wrong operators...
Good point, I fixed that somewhere along the way
. Final version:
And I know backing up can be quite easy, I was just too lazy to set up a back up system. Terrible, I know...
Re: Yet another grub 13 error
Posted: Mon Sep 10, 2012 12:48 pm
by Kevin
evoex wrote:And I know backing up can be quite easy, I was just too lazy to set up a back up system. Terrible, I know...
You want a version control system, not just some backup. And this is essential for anything larger than Hello World.
Re: Yet another grub 13 error
Posted: Mon Sep 10, 2012 1:05 pm
by bluemoon
OS development involves years of work, I cannot imagine doing it without version control & multiple site remote backup; and I also do wiki, bug tracker, and scan backup of physical papers - it only take a day or two to setup but it will be useful for the next ten years of development.
Re: Yet another grub 13 error
Posted: Tue Sep 11, 2012 6:34 am
by Antti
Kevin wrote:You want a version control system, not just some backup. And this is essential for anything larger than Hello World.
I do not use any version control system in my OS project but proper backups are made regularly. This is interesting because I do not have any reasonable explanation for not having it. I somehow do not like the
revisions, commits, comments for commits, and things like that. Rather convincing arguments, right? Is there anyone here how has not used any version control system and still has a "larger than Hello World project" going well?
I have used version control systems in projects with other developers involved in and it worked very well there. It may be that I will start using it also with my OS project after the system is "stable" and "ready for it."
Re: Yet another grub 13 error
Posted: Tue Sep 11, 2012 7:33 am
by Jezze
A version control system is awesome even if you are the only person working on something. I start programming on something and then notice this was a stupid idea and I just go "git checkout -f" and then I'm back where I was before. No need to keep track of backups or any sort of crap. If I want to do a backup I just write "git push". I want to know what files I've done changes it is "git status". I would not be able to live without these shortcuts. It just makes life so much easier.
Re: Yet another grub 13 error
Posted: Tue Sep 11, 2012 8:24 am
by Kevin
Antti wrote:I do not use any version control system in my OS project but proper backups are made regularly.
I think in part I have to take back what I implied. With such backups, you do have some version control, just a very bad one. At least it allows you to roll back when you've really messed up.
This is interesting because I do not have any reasonable explanation for not having it. I somehow do not like the revisions, commits, comments for commits, and things like that. Rather convincing arguments, right?
Yes, almost.
Does it never occur to you that you want to check some things in the history of your project? Like "hm, in what context did I introduce this code"? Or maybe you don't even think about things like this, because you can't get the information anyway.
Re: Yet another grub 13 error
Posted: Tue Sep 11, 2012 8:30 am
by evoex
I agree, version control is brilliant. And would've set it up for my OS, but I was at too early stage, and couldn't be bothered to set it up yet (to be fair, I only lost 2 weeks of work
). Yes, "apt-get install git", "git init", is WAY too much work
.
Now I've got XCode set up for osdev, and I do use source control
.
No wiki as of yet. Doxygen style comments, though... Wiki maybe in the future.
Re: Yet another grub 13 error
Posted: Tue Sep 11, 2012 10:39 am
by Antti
Kevin wrote:With such backups, you do have some version control, just a very bad one.
Yes, it is not very elegant. However, it works well.
Kevin wrote:Does it never occur to you that you want to check some things in the history of your project?
The current status is the one that counts. Of course all the releases are archived.
To be serious, there are no plausible arguments against the version control system. It is better in every reasonable aspect. However, I think that it is not absolutely necessary or even very "brilliant."
Re: Yet another grub 13 error
Posted: Tue Sep 11, 2012 11:40 am
by rdos
Backups only allow you to revert back to a few points, and provides no simple tools to locate changes. It happens from time to time that I discover bugs in something I rarely test, or instability. Then I just check out all relevant versions and build them and can then pretty easy locate the point that breaks the system.