How to make a bootroot.img in Bochs

来源:互联网 发布:react native 导入js 编辑:程序博客网 时间:2024/06/14 09:53

#How to make a bootroot.img in Bochs

#bochs:/usr/src/linux/Makefile
#RAMDISK=-DRAMDISK=2048
#ROOT_DEV=FLOPPY
#make clean;make

#---------------------Fedora START-----------------------------
#Create rootram.img in Fedora
dd bs=1024 if=/dev/zero of=rootram.img count=1024
#---------------------Fedora END-----------------------------

#---------------------Bochs START-----------------------------
#mount rootram.img to bochs
#change a:->rootram.img
mkfs /dev/fd0 1024
mkdir /mnt1
mount /dev/fd0 /mnt

#b:->rootimage-0.11
mount /dev/fd1 /mnt1

#Make FileSystem->rootram.img
cd /mnt
for i in bin dev etc usr tmp
do
cp +recursive +verbose +force /mnt1/$i $i
done

#Please sync!!

sync

umount /dev/fd0
umount /dev/fd1


#make rootfs img
dd bs=1024 if=/dev/fd0 of=rootram-0.11 count=1024

#Make bootroot.img
dd bs=8192 if=/usr/src/linux/Image of=/dev/fd0
dd bs=1024 if=/rootram-0.11 of=/dev/fd0 seek=256

#---------------------Bochs END-----------------------------

#0.11.bxrc
#floppya: 1_44="san/bootroot.img", status=inserted

 

说明:

1、child ? died with code ?(拷贝时出现:sh  `not owner`)错误的解决办法


主要是/bin目录下的sh的无法执行,可能是cp的时候有问题,重新拷贝,并确认sh可以执行即可!

cp +recursive +verbose +force /mnt1/bin /mnt

[/bin]# ls -l
total 341
-rwx--x--x   1 root     root        25528 Jan 13 19:23 mkswap
-rwx--x--x   1 root     4096       205828 Jan 13 19:23 sh
-rwx--x--x   1 root     4096       116479 Jan 13 19:23 vi
[/bin]# ls -l /usr/bin/
total 580
-rwx--x--x   1 root     root        27180 Jan 13 18:40 basename
-rwx--x--x   1 root     root        29700 Jan 13 18:40 cat
-rwx--x--x   1 root     root        29700 Jan 13 18:40 chmod
-rwx--x--x   1 root     root        33796 Jan 13 18:40 chown
-rwx--x--x   1 root     root        37892 Jan 13 18:40 cp
-rwx--x--x   1 root     root        29700 Jan 13 18:40 dd
-rwx--x--x   1 root     root        36125 Jan 13 18:40 df
-rwx--x--x   1 root     root        36611 Jan 13 18:40 du
-rwx--x--x   1 root     root        33796 Jan 13 18:40 file
-rwx--x--x   1 root     root        33796 Jan 13 18:40 ln
-rwx--x--x   1 root     root        46084 Jan 13 18:40 ls
-rwx--x--x   1 root     root        29700 Jan 13 18:40 mkdir
-rwx--x--x   1 root     root        33796 Jan 13 18:41 mv
-rwx--x--x   1 root     root        29700 Jan 13 18:41 rm
-rwx--x--x   1 root     root        25604 Jan 13 18:41 rmdir
-rwx--x--x   1 root     root         9220 Jan 13 18:40 sync
-rwx--x--x   1 root     root        46010 Jan 13 18:40 touch
-rwx--x--x   1 root     root        29700 Jan 13 18:40 uniq
[/bin]#


2、集成盘启动


megs: 16
romimage: file="/usr/local/share/bochs/BIOS-bochs-latest", address=0x00000
vgaromimage: file="/usr/local/share/bochs/VGABIOS-elpin-2.40"
boot: floppy


floppya: 1_44="san/bootroot.img", status=inserted
##floppyb: image="images/rootimage-0.11", status=inserted


ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="images/hdimage-devel", mode=flat, cylinders=410, heads=16, spt=38

 

3、kernel及fs启动


megs: 16
romimage: file="/usr/local/share/bochs/BIOS-bochs-latest", address=0x00000
vgaromimage: file="/usr/local/share/bochs/VGABIOS-elpin-2.40"
boot: floppy

#进入grub后,使用kernel命令指定Image,挂载的文件系统为rootram.img,注意1_44=,否则说size不对
floppya: image="images/grubdos.img", status=inserted
floppyb: 1_44="san/rootram.img", status=inserted


ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="images/hdimage-devel", mode=flat, cylinders=410, heads=16, spt=38

 

4、本实验使用的是oldlinux.org中的linux-0.11-lab_060618_041042.tar.bz2源码包。

http://www.oldlinux.org/Linux.old/bochs/linux-0.11-lab_060618_041042.tar.bz2

 

Flash教学视频

http://www.oldlinux.org/Linux.old/study/linux-0.11-lab/

原创粉丝点击