This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Help with extremely basic ld linker script


I'm writing an (extremely) simple boot sector. Right now my input assembly file is

boot.s
---------------------------
.section .kernel
.here:
    jmp .here

.skip 512 - 2 - (. - .here)

.byte 0x55
.byte 0xaa
---------------------------

I produce my boot sector by running the following commands:

> as boot.s -o boot.o
> objcopy -O binary --set-section-flags .kernel=alloc --only-section=.kernel boot.o boot.img

My use of objcopy is a little bizarre (imo), but essentially what it does is simply extract the literal .kernel section in the object file and write it to another file. This results in a 512 byte file which is a valid bootsector.

Now what I would like is to do this with a linker script. I've read different manuals and tried quite a few things, but kept running into issues. Is there an easy way to produce something equivalent to what my first method does? Thanks so much for any help!

Cheers,
Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]