美文网首页
如何编译新的MBR Image

如何编译新的MBR Image

作者: v1gor | 来源:发表于2019-11-02 14:09 被阅读0次

    修改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
    

    相关文章

      网友评论

          本文标题:如何编译新的MBR Image

          本文链接:https://www.haomeiwen.com/subject/pancbctx.html