Giter Club home page Giter Club logo

linux-0.11's Introduction

Linux-0.11

The old Linux kernel source ver 0.11 which has been tested under modern Linux, macOS, Windows and Android.

modern Linux Setup

  • Install gcc, gdb, binutils, qemu, bochs and VSCode
  • Install VSCode C/C++ extension

Windows 10 WSL Setup

  • Upgrade Windows 10 to version 1903(19H1) or latter.
  • Enable WSL (Windows subsystem of Linux), download a Linux distro from Microsoft store or Github. install it.
  • Install VSCode and install Remote Development extension.
  • Install make, gcc, gdb and binutils in wsl
  • Install qemu, bochs in windows
  • Open new wsl window in vscode (see docs for Remote-wsl), install C/C++ extension on wsl
  • Add all tools to PATH, so you can excute them directly from wsl shell.
  • Run all command in wsl shell.(eg. make)

Access file in wsl

  • You can access wsl's Linux files in Explorer(or any win32 app) at \\wsl$\Ubuntu (or you distro name)
  • You can access Windows's files in wsl at /mnt/c (or other drive letter)

Known issue

  • You can't mount minix image file in wsl1. wsl2 can work.

Windows Setup

  • Install git
  • download prebuilt GNU make for Windows. Extract bin/make.exe to somewhere.(eg. C:\Program Files\Git\bin)
  • download prebuilt GNU i686-elf toolchain for Windows. Extract to somewhere.(eg. C:\i686-elf\)
  • Install qemu, bochs
  • Install VSCode
  • Install VSCode C/C++ extension
  • Add all tools to PATH, so you can excute them directly from Git Bash shell.
  • Modify VSCode C/C++ configuration in .vscode,set proper path for gcc and gdb.
  • Run all command in Git Bash shell.(eg. make)

macOS Setup

  • Install Xcode command line tools: xcode-select --install
  • Install Homebrew
  • Install i386-elf cross compiler and toolchain: gcc, gdb and binutils
  • Install qemu, bochs
  • Install VSCode
  • Install VSCode C/C++ extension
  • Configure C/C++ extension
brew install qemu bochs i386-elf-binutils i386-elf-gcc i386-elf-gdb
# i386-elf-gdb have conflict file with i386-elf-binutils : /usr/local/share/info/bfd.info
brew link --overwrite i386-elf-gdb

Apply this diff.

--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -11,7 +11,8 @@
             "cwd": "${workspaceFolder}",
             "environment": [],
             "MIMode": "gdb",
-            "miDebuggerPath": "gdb",
+            "miDebuggerPath": "i386-elf-gdb",
             "targetArchitecture": "x86",
             "setupCommands": [
                 {
                     "description": "Enable pretty-printing for gdb",
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -6,7 +6,7 @@
                 "${workspaceFolder}/**"
             ],
             "defines": [],
-            "compilerPath": "/usr/bin/gcc",
+            "compilerPath": "/usr/local/bin/i386-elf-gcc",
             "cStandard": "c89",
             "cppStandard": "c++98",
             "intelliSenseMode": "gcc-x64"

Mount minixfs in macOS

DON'T WORK NOW.

You need addition program to mount minix image

  • Install osxfuse
  • Compile minixfs
  • You can use minixfs to mount a minix filesystem. Unfortunately, it don't work with hdc-0.11.img.

Android Setup

You need install Termux App.

# Install Clang and LLVM toolchain to compile kernel
pkg install git clang llvm lldb

If you want to run Linux 0.11 on your Android device, see instructions at Termux wiki to set up graphical environment.

pkg install qemu-system-i386

Alternatively, you can install qemu-system-i386-headless to run in the terminal.

A PR for Bochs is available in termux/x11-packages new package: bochs #143

setup for Clang and LLVM

You can use Clang and LLVM to compile Linux 0.11 kernel.(Android users only have this option)

Just replace variables in Makefile.header with

AS = clang --target=i386-pc-none-elf -c
LD = ld.lld
LDFLAGS = -m elf_i386
CC = clang --target=i386-pc-none-elf
CFLAGS = -gdwarf-2 -g3 -m32 -fno-builtin -fno-stack-protector -fomit-frame-pointer
CPP = clang-cpp -nostdinc
AR = llvm-ar
STRIP = llvm-strip
OBJCOPY = llvm-objcopy
NM = llvm-nm

macOS users should install llvm package from brew, as Apple Clang does not have some llvm tools(llvm-objcopy and llvm-ar).

Windows perbuild LLVM package don't have some llvm tools.

Build and run

# build
make
# run in qemu
make run
# debug in bochs
make bochs
# open debug server from qemu
make debug
# run gdb command and connect to qemu
make gdb
# run lldb command and connect to qemu
make lldb
# clean files
make clean
# mount hdc-0.11.img to hdc (only on linux and WSL2)
make mount
# umount hdc
make umount

debug kernel in vscode

First run qemu in debug mode

make debug

Press F5 to launch vscode debug

linux-0.11's People

Contributors

12101111 avatar calee0219 avatar huddy1985 avatar icecity96 avatar

Watchers

James Cloos 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.