Linux 0.01 云々

とりあえず chroot な環境を用意してみよ。見てみたら vmware 用なパーティションがあったので削除。

/dev/sda7              6726864   5902236    482920  93% /home/rms/vmware

で、ここに chroot なソレを作るんですが、どーやるんだったか。debootstrap か。
以下で良いのかな。

# debootstrap lenny /home/rms/vmware http://ftp.jp.debian.org/debian/

やってみた。

$ su -
password:
# cd ~rms/vmware
# debootstrap . lenny http://ftp.jp.debian.org/debian/
# ls
lenny
# cat lenny/debootstrap/debootstrap.log 
/usr/sbin/debootstrap: line 418: .: /usr/share/debootstrap/scripts/.: is a directory
#

ち。こうだった。

# debootstrap lenny . http://ftp.jp.debian.org/debian/

とりあえず続きはコマンド終了後ですな。

debootstrap 終了

を参考にしつつ。とりあえず chroot な環境を作りましょう。

# echo "proc /home/xxx/jail/proc proc none 0 0" >> etc/fstab
# mount proc /home/xxx/jail/proc -t proc
# cp /etc/hosts /home/xxx/jail/etc/hosts
# chroot /home/xxx/jail /bin/bash
/# cd /dev
/dev# /sbin/MAKEDEV generic
/dev# wget http://ftp-master.debian.org/archive-key-4.0.asc -O - | apt-key add -
/dev# apt-get update
/dev# aptitude install locales mtools -fy
/dev# cd /
/# useradd -m guest
/# passwd guest

で、su - guest すりゃ良いのかな。あ、違うや。とりあえず bashgcc のバージョン確認。

# bash --version
bash --version
GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
# apt-cache search gcc-4.1
gcc-4.1-base - The GNU Compiler Collection (base package)
gcc-4.1-locales - The GNU C compiler (native language support files)
gcc-4.1-multilib - The GNU C compiler (multilib files)
gcc-4.1-source - Source of the GNU Compiler Collection
gcc-4.1 - The GNU C compiler
#

とりあえず gcc-4.1 と bin86 と qemu 入れれば良いのかなぁ。なんとなくこれだけだと駄目な気がするな。とりあえず

って事らしいんですがどうだろ。

# dpkg --get-selections|grep utils
dpkg --get-selections|grep utils
apt-utils                                       install
bsdmainutils                                    install
bsdutils                                        install
coreutils                                       install
debianutils                                     install
findutils                                       install
iputils-ping                                    install
sysvinit-utils                                  install
# apt-cache show binutils-dev  
apt-cache show binutils-dev 
Package: binutils-dev
Priority: extra
Section: devel
Installed-Size: 7300
Maintainer: Matthias Klose <doko@debian.org>
Architecture: i386
Source: binutils
Version: 2.18.1~cvs20080103-7

あるいは coreutils はって 6.10 だなぁ。

# apt-cache show coreutils
apt-cache show coreutils
Package: coreutils
Essential: yes
Priority: required
Section: utils
Installed-Size: 10032
Maintainer: Michael Stone <mstone@debian.org>
Architecture: i386
Version: 6.10-6

あるいは ncurses は 5.7 らしい。微妙だけどそのまま続行。とりあえず make と binutils を入れときます。

# apt-get install -fy make binutils

うーん、とりあえずバージョンとか遵守した方が良さげ。

とりあえず続行

ええと、linux-0.01-rm-3.5.tgz と hd_oldlinux.img.zip を download して linux-0.01 を make しようとしたら gcc が導入されとらんorz

# apt-get install -fy gcc-4.1

ええとどうすりゃ良いのだっけ。とりあえず gcc 導入して update-alternatives する模様。

# apt-get install -fy gcc
# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.3 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-4.3
# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.1 41 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.1 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-4.1
# update-alternatives --config gcc
update-alternatives --config gcc

There are 2 alternatives which provide `gcc'.

  Selection    Alternative
-----------------------------------------------
*+        1    /usr/bin/gcc-4.3
          2    /usr/bin/gcc-4.1

Press enter to keep the default[*], or type selection number: 2
Using '/usr/bin/gcc-4.1' to provide 'gcc'.
# gcc --version
gcc --version
gcc (GCC) 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

#

むむ。ちなみに上記のソレは debianでgccのバージョンを切り替える からパクってます。
これでリトライしたら以下なエラー。

ar rcs lib.a ctype.o _exit.o open.o close.o errno.o write.o dup.o setsid.o execve.o wait.o string.o
sync
make[1]: Leaving directory `/root/linux-0.01-rm-3.5/lib'
ld -s -x -M -Ttext 0 -e startup_32 boot/head.o init/main.o \
        kernel/kernel.o mm/mm.o fs/fs.o \
        lib/lib.a \
        -o tools/system > System.map
(echo -n "SYSSIZE = (";stat -c%s tools/system \
                | tr '\012' ' '; echo "+ 15 ) / 16") > tmp.s    
cat boot/boot.s >> tmp.s
as86 -0  -o boot/boot.o tmp.s
make: as86: Command not found
make: *** [boot/boot] Error 127
#

む。as86 って何だば。

# apt-cache search as86
apt-cache search as86
bin86 - 16-bit x86 assembler and loader
#

入れてみるか。

# dpkg --get-selections|grep bin86

で、リトライ。

# make
make
(echo -n "SYSSIZE = (";stat -c%s tools/system \
                | tr '\012' ' '; echo "+ 15 ) / 16") > tmp.s    
cat boot/boot.s >> tmp.s
as86 -0  -o boot/boot.o tmp.s
00286                                           /*
00287                                            * This procedure turns off the floppy drive motor, so
00288                                            * that we enter the kernel in a known state, and
00289                                            * don't have to worry about it later.
00290                                            */
00286                                           /*
00287                                            * This procedure turns off the floppy drive motor, so
00288                                            * that we enter the kernel in a known state, and
00289                                            * don't have to worry about it later.
00290                                            */
rm -f tmp.s
ld86 -0 -s -o boot/boot boot/boot.o
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -fno-stack-protector  \
        -o tools/build tools/build.c
#chmem +65000 tools/build
objcopy  -O binary -R .note -R .comment tools/system tools/system.bin
tools/build boot/boot tools/system.bin > Image
Boot sector 452 bytes.
System 89732 bytes.
#

を、なんかできたクサい。とりあえずここでエントリ投入します。

続き

ええと unzip を導入。

# apt-get install -fy unzip

で、解凍。

# unzip hd_oldlinux.img.zip 
unzip hd_oldlinux.img.zip 
Archive:  hd_oldlinux.img.zip
  inflating: hd_oldlinux.img         
#

で、起動してみたんですが X にカブサって qemu が起動。一応正常起動はしてましたがキーマップが滅茶苦茶状態ですたorz
しかしこれ、面白いオモチャができたなwwww