Page 1 of 1

makefile help

Posted: Mon Sep 01, 2008 5:06 am
by xDDunce
so i have finally discovered the usefulness of a makefile, but everytime i try to link my objects in the file, it throws an error.

my makefile looks like this:

Code: Select all

PROGNAME = ker.nel
objects = start.o main.o
CC = gcc
CC += -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./Includes -c
ASM = nasm
ASM += -f elf -o start.o
LD = ld-elf
LD += -T link.ld
MKISO = mkisofs
MKISO +=  -R -b grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o 

all: $(PROGNAME) MAKEISO
  
clean:
	del  *.o
	del  $(PROGNAME)

%.o: %.s
	$(ASM) $<

%.o: %.c
	$(CC) $<

$(PROGNAME): $(objects)
	$(LD) -o $(PROGNAME) $(objects)

MAKEISO: $(PROGNAME)
	copy ker.nel C:\osdevc\sources\iso
	$(MKISO) grub.iso iso
and i get this error:

Code: Select all

exiting due to signal SIGSEGV
General Portection Fault at eip=00067ac7
eax=fff50008 ebx=000001ff ecx=000002b7 edx=fff50000 esi=00000008 edi=00000000
ebp=000ba018 esp=000ba008 program=C:\DJGPP\bin\ld-elf.exe
cs: sel=026f base=02b70000 limit=7d47ffff
ds: sel=0277 base=02b70000 limit=7d47ffff
es: sel=0277 base=02b70000 limit=7d47ffff
fs: sel=0247 base=0001a570 limit=0000ffff
gs: sel=0287 base=00000000 limit=7ffeffff
ss: sel=0277 base=02b70000 limit=7d47ffff

Call frame traceback EIPs:
   0x00067ac7
   0x00067a4d
   0x0006bbbb
   0x0006c365
   0x000671ff

if i use the same commands directly on the command line, then it works but otherwise it doesn't. any suggestions on what is going wrong?

James.

Re: makefile help

Posted: Mon Sep 01, 2008 9:06 am
by JamesM
Try using ":=" instead of "=" for a static initialisation.

Re: makefile help

Posted: Mon Sep 01, 2008 11:12 am
by xDDunce
thanks for the suggestion! but no luck. i have discovered a new feature of this problem. i discovered it works, but only if i restart my laptop. any more ideas to fix this problem?

James.

Re: makefile help

Posted: Mon Sep 01, 2008 11:47 am
by Combuster
/me sticks on the sign "Make sure you have the latest (drivers) installed"

Using DOS applications on the latest windows versions is asking for trouble. Time to start using cygwin, rather than ancient DJGPP...

Re: makefile help

Posted: Mon Sep 01, 2008 12:02 pm
by salil_bhagurkar
I guess you should just put that ld-elf (ld) in a batch file as a script... That should save you from trouble temporarily.. But yes i think you should go for cygwin...

Re: makefile help

Posted: Mon Sep 01, 2008 12:05 pm
by xDDunce
ok fair enough, although has DJGPP not been updated recently? i noticed the download system was different since about 2 months ago. although i may be wrong as i always like to be :oops:

ill switch to cygwin now then. Thanks for the help!

James.

Re: makefile help

Posted: Mon Sep 01, 2008 1:10 pm
by xDDunce
ok, so i've switched now. but i have a new error.

it all works fine until i have to boot my kernel. it doesn't want to load my kernel above 1MB.

my linker script looks like this:

Code: Select all

OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
   .text phys : AT(phys)
   {
      code = .;
      *(.text)
      *(.rodata)
      . = ALIGN(4096);
   }
   .data : AT(phys + (data - code))
   {
      data = .;
      start_ctors = .;
         *(.ctor*)
      end_ctors = .;
      start_dtors = .;
         *(.dtor*)
      end_dtors = .;
      *(.data)
      . = ALIGN(4096);
   }
   .bss : AT(phys + (bss - code))
   {
      bss = .;
      *(.bss)
      . = ALIGN(4096);
   }
   end = .;
}
hopefully this will be my last problem [-o< but i do highly doubt it.

James.

Re: makefile help

Posted: Mon Sep 01, 2008 1:33 pm
by Combuster
error messages please.

Re: makefile help

Posted: Mon Sep 01, 2008 1:42 pm
by xDDunce
grub error 7: loading below 1Mb is not supported.

i did say it was a grub error in the above post but i guess i should have said this instead, sorry.

James.

Re: makefile help

Posted: Mon Sep 01, 2008 2:07 pm
by xDDunce
ok i found the problem. i accidently removed my linker script from the LD in my makefile. but now its on, theres a new problem. one i have never seen before.

Code: Select all

4 [main] make 3456! _pinfo::dup_proc_pipe: DuplicateHandle failed, pid 3456, hProcess 0c6F1, wr_proc_pipe 0x754, Win32 error 6
i have googled to find this error but i can find a fix.

James.

Re: makefile help

Posted: Mon Sep 01, 2008 3:15 pm
by Combuster
well you should obviously not include those numbers, they are pretty much random :wink:

http://lists-archives.org/cygwin/35202- ... ailed.html

Re: makefile help

Posted: Mon Sep 01, 2008 4:43 pm
by quok
johnsy2008 wrote:4 [main] make 3456! _pinfo::dup_proc_pipe: DuplicateHandle failed, pid 3456, hProcess 0c6F1, wr_proc_pipe 0x754, Win32 error 6
Oh, nice, one of those generic fork() -like errors. You wouldn't happen to have any Logitech webcam drivers installed would you? I had similar problems back when I used Cygwin all the time, and found this post: http://www.cygwin.com/ml/cygwin/2006-03/msg00173.html

Evidently, there's a conflict between Cygwin and the way the logitech drivers work. When this conflict rears its ugly head, you'll see programs dieing after not being able to allocate heap space, fork() not working at all and all kinds of things. The simple way to fix this is to disable automatic loading of your logitech drivers (set them to manual or disabled instead), and cygwin should start to behave correctly. Of course you won't be able to use your logitech webcam then without reversing the steps. Alternatively, you could rebase your Cygwin .dlls, but that's not guaranteed to fix things either.

Re: makefile help

Posted: Tue Sep 02, 2008 12:12 pm
by xDDunce
well i don't have any logitech peripherals but could the apple built-in isight do the same thing? i suppose it would...

and as for those numbers, they the 3456 stays the same but the 4 has changed as i have just retryed it.

ill take a look at the links now.

thanks,

James.