Git Product home page Git Product logo

tinix's Introduction

Tinix

  • Tinix on ubunut 14.04

This is a series of course that teach you how to step by step writing an Operation System, Here I give the usefull comand line that how to build,run and debug on ubuntu machine, also some updates of the build scripts as the original does't works now as too old.

chapter1 build and debug cmdline

  • sudo apt-get install nasm
  cd chapter1/x # x is either a or b
  nasm -o boot.bin boot.asm

  # generated a bootable floppy image
  dd if=/dev/zero of=TINIX.IMG bs=512 count=2880
  sudo mkfs.vfat TINIX.IMG
  dd conv=notrunc if=boot.bin of=TINIX.IMG bs=512 count=1

  # use qemu to run
  qemu-system-i386 -fda TINIX.IMG -boot a -m 64M

  # if want to debug
  qemu-system-i386 -fda TINIX.IMG -boot a -m 64M -s -S &
  echo "target remote:1234" > ~/.gdbinit
  echo "layout asm" >> ~/.gdbinit
  echo "b *0x7c00" >> ~/.gdbinit
  echo "c" >> ~/.gdbinit
  gdb
  # then input si to step asm code

chapter 3 build and debug cmdline

  • sudo apt-get install dosemu # this doesn't works

  • install qemu freeDos # this also not works

  mkdir ~/freedos
  cd ~/freedos
  wget http://www.freedos.org/freedos/files/download/fd11src.iso
  dd if=/dev/zero of=fdos11.img bs=1M count=1023
  qemu-system-i386 -cdrom fd11src.iso fdos11.img -boot d
  # and then in the pop up window, select install it step by step according to page [freeDos](http://joelinoff.com/blog/?p=431)
  • install MS-DOS # this works, for chapter3/a, a RED "P" charactor will be displayed.
  mkdir ~/msdos
  cd ~/msdos
  # cpoy the the download "MS-DOS 6.22 VHD.vhd"  here as msdos.vhd
  • debug
  nasm -o pmtest.com pmtest*.asm # * means 1/2/3/4/5/6... according to each chapter
  # cp pmtest.com  ~/.dosemu/drive_c/
  # dosemu
  mkdir -p tmp
  dd if=/dev/zero of=TINIX.IMG bs=512 count=2880
  sudo mkfs.vfat TINIX.IMG
  sudo mount -t vfat TINIX.IMG tmp
  sudo cp pmtest.com tmp
  sudo umount tmp
  # qemu-system-i386  -hdc ~/freedos/fdos11.img -boot c -fda TINIX.IMG
  qemu-system-i386 -hdc ~/msdos/msdos.vhd -boot c -fda TINIX.IMG
  # then in the pop up window input A:\pmtest.com
  C:\> cls
  C:\> A:\pmtest.com

chapter 4 build and debug cmdline

  • for chapter4 a, the same chapter1

  • for chapter4 b&c

  nasm -o boot.bin boot.asm
  nasm -o loader.bin loader.asm
  # generated a bootable floppy image
  dd if=/dev/zero of=TINIX.IMG bs=512 count=2880
  sudo mkfs.vfat TINIX.IMG
  dd conv=notrunc if=boot.bin of=TINIX.IMG bs=512 count=1
  mkdir -p tmp
  sudo mount -t vfat TINIX.IMG tmp
  sudo cp loader.bin tmp
  sudo umount tmp

  # use qemu to run
  qemu-system-i386 -fda TINIX.IMG -boot a -m 64M

chapter 5 build and debug cmdline

  • for a
  nasm -f elf hello.asm -o hello.o
  ld -melf_i386 -s hello.o -o hello.exe
  ./hello.exe
  • for b
  nasm -f elf foo.asm -o foo.o
  gcc -m32 -fno-stack-protector -fno-builtin -c bar.c -o bar.o
  ld -melf_i386 -s foo.o bar.o -o foobar.exe
  ./foobar.exe
  • for c & d & e
  nasm -o boot.bin boot.asm
  nasm -o loader.bin loader.asm
  nasm -f elf kernel.asm -o kernel.o
  ld -melf_i386 -s -Ttext 0x30400 kernel.o -o kernel.bin
  # generated a bootable floppy image
  dd if=/dev/zero of=TINIX.IMG bs=512 count=2880
  sudo mkfs.vfat TINIX.IMG
  dd conv=notrunc if=boot.bin of=TINIX.IMG bs=512 count=1
  mkdir -p tmp
  sudo mount -t vfat TINIX.IMG tmp
  sudo cp loader.bin kernel.bin tmp
  sudo umount tmp

  # use qemu to run
  qemu-system-i386 -fda TINIX.IMG -boot a -m 64M
  • for g
  nasm -o boot.bin boot.asm
  nasm -o loader.bin loader.asm
  nasm -f elf kernel.asm -o kernel.o
  nasm -f elf klib.asm -o klib.o
  nasm -f elf string.asm -o string.o
  gcc -m32 -fno-stack-protector -fno-builtin -c start.c -o start.o
  ld -melf_i386 -s -Ttext 0x30400 kernel.o klib.o string.o start.o -o kernel.bin
  # generated a bootable floppy image
  dd if=/dev/zero of=TINIX.IMG bs=512 count=2880
  sudo mkfs.vfat TINIX.IMG
  dd conv=notrunc if=boot.bin of=TINIX.IMG bs=512 count=1
  mkdir -p tmp
  sudo mount -t vfat TINIX.IMG tmp
  sudo cp loader.bin kernel.bin tmp
  sudo umount tmp

  # use qemu to run
  qemu-system-i386 -fda TINIX.IMG -boot a -m 64M
  • for h & i
make all
sudo mkdir -p /mnt/floppy
sudo make buildimg
sudo make run

tinix's People

Contributors

parai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.