我最近在学习orange's一个操作系统的实现这本书,但是因为代码久远的原因一些代码一直无法正常运行(当然主要是我猜)。
其中第十章之前的代码基本已经实现了运行,但是第十章的代码(chapter10/e)中的代码一直跑不起来,求各位进行指导
以下是我为了能够运行make和bochs所进行的文件修改,其余文件未动
这是Makefile文件:
# commands/Makefile
#ENTRYPOINT = 0x1000
HD = ../80m.img
ASM = nasm
DASM = objdump
CC = gcc-4.8 ;修改1,我指定了gcc版本
LD = ld
ASMFLAGS = -I ../include/ -f elf
CFLAGS = -I ../include/ -c -fno-builtin -fno-stack-protector -Wall -m32 ;修改2,我指定了32位操作系统
LDFLAGS = -Ttext 0x1000 -m elf_i386 ;修改三,加入elf_i386
DASMFLAGS = -D
LIB = ../lib/orangescrt.a
BIN = echo
# All Phony Targets
.PHONY : everything final clean realclean disasm all install
# Default starting position
everything : $(BIN)
install : all clean
cp ../kernel.bin ./ -v
tar vcf inst.tar kernel.bin $(BIN)
dd if=inst.tar of=$(HD) seek=`echo "obase=10;ibase=16;(\`egrep -e '^ROOT_BASE' ../boot/include/load.inc | sed -e 's/.*0x//g'\`+\`egrep -e '#define[[:space:]]*INSTALL_START_SECT' ../include/sys/config.h | sed -e 's/.*0x//g'\`)*200" | bc` bs=1 count=`ls -l inst.tar | awk -F " " '{print $$5}'` conv=notrunc
all : realclean everything
final : all clean
clean :
rm -f *.o
realclean :
rm -f $(BIN) *.o
kernel.bin :
cp ../kernel.bin ./
start.o : start.asm
$(ASM) $(ASMFLAGS) -o $@ $<
echo.o: echo.c ../include/type.h ../include/stdio.h
$(CC) $(CFLAGS) -o $@ $<
echo : echo.o start.o $(LIB)
$(LD) $(LDFLAGS) -o $@ $?
pwd.o: pwd.c ../include/type.h ../include/stdio.h
$(CC) $(CFLAGS) -o $@ $<
pwd : pwd.o start.o $(LIB)
$(LD) $(LDFLAGS) -o $@ $?
这是bochsrc文件
###############################################################
# Configuration file for Bochs
###############################################################
# how much memory the emulated machine will have
megs: 32
# filename of ROM images
romimage: file=/usr/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/share/vgabios/vgabios.bin
# what disk images will be used
floppya: 1_44=a.img, status=inserted
# hard disk
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
# !! Remember to change these if the hd img is changed:
# 1. include/sys/config.h::MINOR_BOOT
# 2. boot/include/load.inc::ROOT_BASE
# 3. Makefile::HD
# 4. commands/Makefile::HD
ata0-master: type=disk, path="80m.img", mode=flat, cylinders=162, heads=16, spt=63
# choose the boot disk.
boot: a
# where do we send log messages?
# log: bochsout.txt
# disable the mouse
mouse: enabled=0
# enable key mapping, using US layout as default.
keyboard: keymap=/usr/share/bochs/keymaps/x11-pc-us.map
其余文件未动,但是当我使用make image和bochs -f bochsrc命令后却无法得到书本中的运行效果:

无法跳转到TTY中进行命令输入。为什么?