The old Linux kernel source ver 0.11 runnable on MacOS, codes were modified to be compiled by modern i386 elf toolkit.
Tested on MacOS Sonoma 14.2.
Clone instruction:
git lfs clone https://github.com/ETOgaosion/Linux-0.11-MacOS.gitOr, if you have cloned already, use:
git lfs pull origin mainTo download some important large files.
- Install cross compiler gcc, gdb and binutils
brew tap nativeos/i386-elf-toolchain
brew install i386-elf-binutils i386-elf-gcc
brew install i386-elf-gdb- Install qemu
brew install qemu- [optional] A linux-0.11 hardware image file(we have offered one): hdc-0.11.img, you can download it from http://www.oldlinux.org, or http://mirror.lzu.edu.cn/os/oldlinux.org/, and put it in the root directory.
- [optional] Download inkscape, and to use command-line tool:
ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape \
/usr/local/bin/inkscape- [optional] Download imagemagick, but don't follow their command line instructions(without X11 support), use below commands:
brew tap tlk/imagemagick-x11
brew install tlk/imagemagick-x11/imagemagickset DISPLAY env variable:
echo 'export DISPLAY=:0' > ~/.[shell]rc
source ~/.[shell]rcRemember to Download XQuartz, and open it in background.
Then verify installation, as offically documented:
magick logo: logo.gif
identify logo.gif
display logo.gifmake help // get help
make // compile
make start // boot it on qemuIf you hope to dive deeper into linux, rather than just run and use, check below instructions. Notice that all scripts shall be executed in root directory.
In one terminal:
make debug // debug it via qemu & gdb, you'd start gdb to connect it.In the other:
gdb tools/system
(gdb) add-symbol-file boot/bootsect.o
(gdb) b start
(gdb) c
(gdb) remove-symbol-file boot/bootsect.o
(gdb) b main
(gdb) cUse make cg to generate main function's call graph like below:
./scripts/callgraph.sh -f [func_name] \
-d [directory] \
-F [filterstr] \
-D [depth] \
-o [directory] \
-t [output_format_type]
# Output: out/func.dir_file_name.svgIf you want to directly convert picture to other format, we recommand you try inkscape
inkscape -w [width] -h [height] \
out/[src_image].[src_type] \
-o out/[dest_image].[dest_type]Or if you only installed imagemagick
convert -density [density] \
-background none \
-resize [width]x[height] \
out/[src_image].[src_type] \
out/[dest_image].[dest_type]And if you want to display image:
display out/[image].[type]If you encounter errors, please make sure your installation correct. Open issues freely.
