Saturday, June 23, 2012

Linux-0.01 kernel building on ubuntu hardy

linux-0.01-rm-3.5 now builds ok on hardy but only on 32 bit version
The best way to try is to install hardy , or debian lenny in kvm-linux or virtualbox and then try the instructions bellow 

Official 0.0.1 project news and downloads are located here

You might need some packages first
$sudo apt-get install bin86 kvm qemu gcc build-essential


$wget http://ftp.be.debian.org/pub/linux/kernel/people/abdel/linux_0.01/sources/linux-0.01-rm-3.5.tar.gz

$tar -zxvf linux-0.01-rm-3.5.tar.gz
$cd linux-0.01-rm-3.5
$make

or time make

make[1]: Leaving directory `/home/mariuz/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
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.

real 0m4.512s
user 0m3.696s
sys 0m0.768s

then rename Image to linux0.01-3.5.img
qemu -hdb hd_oldlinux.img -fda linux0.01-3.5.img -boot a

you must use the hd image from here if you don't have it yet
wget http://draconux.free.fr/download/os-dev/linux0.01/Image/hd_oldlinux.img.zip
unzip hd_oldlinux.img.zip


8 comments:

Anonymous said...

Excellent! Thank you for working hack.

Gurpreet Singh said...

hi, thanks for the excellent blog.
I was following your steps but upon running running linux image with qemu, linux hangs after showing message "Loading System..."
I am running the same command as yours:
qemu -hdb hd_oldlinux.img -fda linux0.01-3.5.img -boot a

I am suspecting hd image problem but don't know what to do about it.

I am running updated Debian Squeeze with GCC 4.4.4

I will be thankful to you if you could help.

Gurpreet

Popa Adrian Marius said...

i think you don't have the Linux Image created

how did you managed to compile it on debian with gcc 4.4.4 because on my machine i have this error


../include/asm/segment.h: Assembler messages:
../include/asm/segment.h:27: Error: bad register name `%sil'


I will try to solve it and update the guide

Popa Adrian Marius said...

you can download the image from here if you can't build it

http://www.kernel.org/pub/linux/kernel/people/abdel/linux_0.01/images/linux0.01-3.5.img

PREMKUMAR TAGARE said...

Awesome..

I have modified a little bit and now it compiles and boots on ubuntu 64-bit machine.

Thank you Mariuz.

PREMKUMAR TAGARE said...

https://gist.github.com/oraccha/775943

This link helped me to fix few errors. Including the one you mentioned.

../include/asm/segment.h: Assembler messages:
../include/asm/segment.h:27: Error: bad register name `%sil'

Popa Adrian Marius said...

I have applied the patches but i get an Unnexpected HD interrupt if i compile on a 64bit os

https://github.com/mariuz/linux-0.01

PREMKUMAR TAGARE said...

Even I got same "Unexpected HD interrupt" recently. I think it is compiler problem. However it works fine on 64 bit Ubuntu 12.04.4

gcc 4.6.3
as86 2.22
qemu-system-i386 1.0
Linux 3.11.0-15