Meaty Skeleton: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
mNo edit summary
m (Bot: Replace deprecated source tag with syntaxhighlight)
Line 132:
mandatory options the project makefile requires:
 
<sourcesyntaxhighlight lang="make">
# Default CFLAGS:
CFLAGS?=-O2 -g
Line 138:
# Add mandatory options to CFLAGS:
CFLAGS:=$(CFLAGS) -Wall -Wextra
</syntaxhighlight>
</source>
 
== Architecture Directories ==
Line 224:
You can easily download the source code using [[Git]] from the [https://gitlab.com/sortie/meaty-skeleton Meaty Skeleton Git repository]. This is preferable to doing a manual error-prone copy, as you may make a mistake or whitespace may get garbled due to bugs in our syntax highlighting. To clone the git repository, do:
 
<sourcesyntaxhighlight lang="bash">
git clone https://gitlab.com/sortie/meaty-skeleton.git
</syntaxhighlight>
</source>
 
Check for differences between the git revision used in this article and what you cloned (empty output means there is no difference):
<sourcesyntaxhighlight lang="bash">
git diff 084d1624bedaa9f9e395f055c6bd99299bd97f58..master
</syntaxhighlight>
</source>
 
Operating systems development is about being an expert. Take the time to read the code carefully through and understand it. Please seek further information and help if you don't understand aspects of it. This code is minimal and almost everything is done deliberately, often to pre-emptively solve future problems.
Line 499:
==== kernel/arch/i386/make.config ====
 
<sourcesyntaxhighlight lang="make">
KERNEL_ARCH_CFLAGS=
KERNEL_ARCH_CPPFLAGS=
Line 508:
$(ARCHDIR)/boot.o \
$(ARCHDIR)/tty.o \
</syntaxhighlight>
</source>
 
==== kernel/arch/i386/crti.S ====
Line 686:
==== libc/include/sys/cdefs.h ====
 
<sourcesyntaxhighlight lang="c">
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H 1
Line 693:
 
#endif
</syntaxhighlight>
</source>
 
==== libc/include/stdlib.h ====
Line 1,030:
==== libc/arch/i386/make.config ====
 
<sourcesyntaxhighlight lang="make">
ARCH_CFLAGS=
ARCH_CPPFLAGS=
Line 1,039:
 
ARCH_HOSTEDOBJS=\
</syntaxhighlight>
</source>
 
==== libc/.gitignore ====
Line 1,055:
==== build.sh ====
 
<sourcesyntaxhighlight lang="bash">
#!/bin/sh
set -e
Line 1,063:
(cd $PROJECT && DESTDIR="$SYSROOT" $MAKE install)
done
</syntaxhighlight>
</source>
 
You should make this executable script executable by running:
<sourcesyntaxhighlight lang="bash">
chmod +x build.sh
</syntaxhighlight>
</source>
 
==== clean.sh ====
 
<sourcesyntaxhighlight lang="bash">
#!/bin/sh
set -e
Line 1,084:
rm -rf isodir
rm -rf myos.iso
</syntaxhighlight>
</source>
 
You should make this executable script executable by running:
<sourcesyntaxhighlight lang="bash">
chmod +x clean.sh
</syntaxhighlight>
</source>
 
==== config.sh ====
 
<sourcesyntaxhighlight lang="bash">
SYSTEM_HEADER_PROJECTS="libc kernel"
PROJECTS="libc kernel"
Line 1,122:
export CC="$CC -isystem=$INCLUDEDIR"
fi
</syntaxhighlight>
</source>
 
==== default-host.sh ====
 
<sourcesyntaxhighlight lang="bash">
#!/bin/sh
echo i686-elf
</syntaxhighlight>
</source>
 
You should make this executable script executable by running:
<sourcesyntaxhighlight lang="bash">
chmod +x default-host.sh
</syntaxhighlight>
</source>
 
==== headers.sh ====
 
<sourcesyntaxhighlight lang="bash">
#!/bin/sh
set -e
Line 1,148:
(cd $PROJECT && DESTDIR="$SYSROOT" $MAKE install-headers)
done
</syntaxhighlight>
</source>
 
You should make this executable script executable by running:
<sourcesyntaxhighlight lang="bash">
chmod +x headers.sh
</syntaxhighlight>
</source>
 
==== iso.sh ====
Line 1,176:
 
You should make this executable script executable by running:
<sourcesyntaxhighlight lang="bash">
chmod +x iso.sh
</syntaxhighlight>
</source>
 
==== qemu.sh ====
 
<sourcesyntaxhighlight lang="bash">
#!/bin/sh
set -e
Line 1,188:
 
qemu-system-$(./target-triplet-to-arch.sh $HOST) -cdrom myos.iso
</syntaxhighlight>
</source>
 
You should make this executable script executable by running:
<sourcesyntaxhighlight lang="bash">
chmod +x qemu.sh
</syntaxhighlight>
</source>
 
==== target-triplet-to-arch.sh ====
 
<sourcesyntaxhighlight lang="bash">
#!/bin/sh
if echo "$1" | grep -Eq 'i[[:digit:]]86-'; then
Line 1,204:
echo "$1" | grep -Eo '^[[:alnum:]_]*'
fi
</syntaxhighlight>
</source>
 
You should make this executable script executable by running:
<sourcesyntaxhighlight lang="bash">
chmod +x target-triplet-to-arch.sh
</syntaxhighlight>
</source>
 
==== .gitignore ====
Line 1,228:
the source tree by invoking:
 
<sourcesyntaxhighlight lang="bash">
./clean.sh
</syntaxhighlight>
</source>
 
You can install all the system headers into the system root without relying on
Line 1,236:
[[Hosted GCC Cross-Compiler]], by invoking:
 
<sourcesyntaxhighlight lang="bash">
./headers.sh
</syntaxhighlight>
</source>
 
You can build a bootable cdrom image of the operating system by invoking:
 
<sourcesyntaxhighlight lang="bash">
./iso.sh
</syntaxhighlight>
</source>
 
It's probably a good idea to create a quick ''build-and-then-launch'' short-cut
like used in this example to run the system in your favorite emulator quickly:
 
<sourcesyntaxhighlight lang="bash">
./qemu.sh
</syntaxhighlight>
</source>
 
== Troubleshooting ==