如何编译新的MBR Image

2019-11-02  本文已影响0人  v1gor

修改head.s或boot.s之后如何编译出新的Image来调试运行

https://stackoverflow.com/questions/35952853/relocation-truncated-to-fit-r-386-16-against-text

https://stackoverflow.com/questions/34995239/nasm-ld-relocation-truncated-to-fit-r-386-16

https://stackoverflow.com/questions/14436184/how-to-install-as86-in-debian-6-0

# Makefile for the simple example kernel.
AS86    =as86 -0 -a
LD86    =ld86 -0
AS  =as
LD  =ld
LDFLAGS =-m elf_i386 -Ttext 0 -e startup_32 -s -x -M

all:    Image

Image: boot system
    dd bs=32 if=boot of=Image skip=1
    objcopy -O binary system head
    cat head >> Image

disk: Image
    dd bs=8192 if=Image of=/dev/fd0
    sync;sync;sync

head.o: head.s
    gcc -m32 -c head.s

system: head.o
    $(LD) $(LDFLAGS) head.o  -o system > System.map

boot:   boot.s
    $(AS86) -o boot.o boot.s
    $(LD86) -s -o boot boot.o

clean:
    rm -f Image System.map core boot head *.o system
上一篇 下一篇

猜你喜欢

热点阅读