
我抄了 nongnu.askapache.com/grub/phcoder/multiboot.pdf 里面的 kernel ,然后:
i686-elf-gcc -c boot.S -march=i386 i686-elf-gcc -c kernel.c -march=i386 i686-elf-gcc boot.o kernel.o -o kernel -march=i386 -nostartfiles -nodefaultlibs qemu-system-i386 kernel 结果报错说:
WARNING: Image format was not specified for 'kernel' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. 是 pdf 里面的代码有什么问题吗,链接顺序错了,还是 qemu 不能当 bootloader ?
1 reus Nov 18, 2016 警告信息已经说得很明白了,解决方法都给出了。 |
3 reus Nov 18, 2016 @linux40 你那个只是内核文件吧?要处理成镜像文件。 qemu 不包括 bootloader ,只是模拟硬件而已。参考这个: http://wiki.osdev.org/Bare_Bones |
7 linux40 OP Trying to execute code outside RAM or ROM at 0x000a0000 |
8 linux40 OP 呃, grub-file --is-x86-multiboot 返回错误,明天再看吧。。。 |
9 linux40 OP -Wl,-N -Wl,-Ttext -Wl,80100000 -Wl,--build-id=none 上面这个链接器的选项是什么意思啊,不加的话 qemu 认为无效。 我新的编译选项是-fno-builtin -nostdinc -O -g -Wall 链接选项是-nostdlib -Wl,-N -Wl,-Ttext -Wl,80100000 -Wl,--build-id=none 而且,就算 qemu 识别成功了,但运行起来有问题, qemu 卡在 Booting for ROM 不动,而且一直运行中,可能无限循环了。。。 |