共享文件夹:
挂载文件夹:
mount -t vboxsf Share /mnt/myShare
# 自动挂载 /etc/fstab文件中添加一行代码
Share /mnt/myShare vboxsf rw,gid=100,uid=1000,auto 0 0
./configure \
--prefix=/usr/local/bochs \
--enable-debugger \
--enable-disasm \
--enable-iodebug \
--enable-x86-debugger \
--with-x \
--with-x11\
LDFLAGS='-pthread' LIBS='-lX11'
sudo apt install fluxbox xinit xterm
sudo apt install vim
sudo apt install build-essential
sudo apt install xorg-dev
sudo apt install libgtk2.0-dev
sudo apt install g++
修改配置:allowed_users = anybody
sudo vi /etc/X11/Xwrapper.config
bochsrc.disk内容:
megs : 32
romimage: file=/usr/local/bochs/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/local/bochs/share/bochs/VGABIOS-lgpl-latest
boot: disk
log: bochs.out
mouse:enabled=0
keyboard:keymap=/usr/local/bochs/share/bochs/keymaps/x11-pc-us.map
ata0:enabled=1,ioaddr1=0x1f0,ioaddr2=0x3f0,irq=14
ata0-master: type=disk, path="/usr/local/bochs/bin/hd60M.img", mode=flat,cylinders=121,heads=16,spt=63
#gdbstub:enabled=1,port=1234,text_base=0,data_base=0,bss_base=0
nasm -o boot.bin boot.asm
dd if=boot.bin of=hd60M.img bs=512 count=1 conv=notrunc
测试代码:
org 07c00h ; 告诉编译器程序加载到 7c00 处
mov ax, cs
mov ds, ax
mov es, ax
call DispStr ; 调用显示字符串例程
jmp $ ; 无限循环
DispStr:
mov ax, BootMessage
mov bp, ax ; ES:BP = 串地址
mov cx, 16 ; CX = 串长度
mov ax, 01301h ; AH = 13, AL = 01h
mov bx, 000ch ; 页号为 0(BH = 0) 黑底红字(BL = 0Ch, 高亮)
mov dl, 0
int 10h ; 10h 号中断
ret
BootMessage: db "Hello, OS world!"
times 510-($-$$) db 0 ; 填充剩下的空间, 使生成的二进制代码恰好为 512 字节
dw 0xaa55 ; 结束标志