Giter VIP home page Giter VIP logo

linux-0.12's Introduction

Linux 0.12 meets modern build system

Introduction

This is a highly modified Linux system (v0.12) used for educational purposes only. Currently, it supports both "Unix Makefiles" and "Ninja" build systems. Other build systems are not tested, but they have a high possibility of not working. Currently, this build is only tested on Linux and other UNIX-Like systems, whether it's working on Windows is not tested.

Build the kernel

To build the kernel, you have to have the following tools (or similar compatible tools)

dd cp as ld strip objcopy nm grep sort rm

The build system will search for the tools listed above automatically, but you can also override the location of the tools by appending CMake flags. e.g. You can override dd executable with unix_dd by using the following command

cmake -DDD_EXEC=unix_dd

tool dd can be overridden by Marco DD_EXEC

tool cp can be overridden by Marco CP_EXEC

tool as can be overridden by Marco GAS_EXEC

tool ld can be overridden by Marco GLD_EXEC

tool strip can be overridden by Marco STRIP_EXEC

tool objcopy can be overridden by Marco OBJCPY_EXEC

tool nm can be overridden by Marco NM_EXEC

tool grep can be overridden by Marco GREP_EXEC

tool sort can be overridden by Marco SORT_EXEC

tool rm can be overridden by Marco RM_EXEC

Now make a directory under the source root, say it's cmake-build-debug Then, execute the following command

cmake .. -D Ninja && ninja

CMake Ninja CMake After Compile or

cmake .. && make

CMake Make CMake Make After Compile

This process will generate an ELF32 kernel file(${KERNEL_NAME}.kernel.elf32, default is linux.kernel.elf32) with debug info and a floppy disk image(${FLOPPY_IMG_NAME}, default is floppy.img) that can be used for booting the system under the ${CMAKE_BINARY_DIR}

You can boot the system using the following command

ninja qemu_boot

or

make qemu_boot

QEMU should behave like the following image

QEMU BOOT

Debug with QEMU

Say we have built the system using ninja. We can enable remote debug using the following command

ninja qemu_debug

This will create gdb debug server at the address of localhost:9000 The symbol file for the kernel is under the ${CMAKE_BINARY_DIR}, which is the folder firstly created under the source root for building the kernel.

Debug with CLion using remote gdbserver

After this, all you have to do is connect the gdb to the server. You can also have some advanced debugging tools like CLion up and running.

Create a configuration of remote gdb debugging. Click on CMake configurations and choose ```Edit Configurations ``

Add Configuration

Then, proceed to click the '+' on the top left, choose Remote Debug

Add Remote Debug

Then, fill the section 'target remote' args: with tcp:localhost:9000, which is the address gdbserver will be listening on.

Add Tcp Args

Then, choose the kernel symbol file. By default, it's ${CMAKE_BINARY_DIR}/linux.kernel.elf32

Add Symbol File

After that, you can create breakpoints and debug in CLion, which is extremely convenient.

linux-0.12's People

Contributors

anivice avatar

Watchers

 avatar

Forkers

torred

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.