Meaty Skeleton: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
mNo edit summary |
m Bot: Replace deprecated source tag with syntaxhighlight |
||
Line 132: | Line 132: | ||
mandatory options the project makefile requires: |
mandatory options the project makefile requires: |
||
< |
<syntaxhighlight lang="make"> |
||
# Default CFLAGS: |
# Default CFLAGS: |
||
CFLAGS?=-O2 -g |
CFLAGS?=-O2 -g |
||
Line 138: | Line 138: | ||
# Add mandatory options to CFLAGS: |
# Add mandatory options to CFLAGS: |
||
CFLAGS:=$(CFLAGS) -Wall -Wextra |
CFLAGS:=$(CFLAGS) -Wall -Wextra |
||
</syntaxhighlight> |
|||
</source> |
|||
== Architecture Directories == |
== Architecture Directories == |
||
Line 224: | 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: |
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: |
||
< |
<syntaxhighlight lang="bash"> |
||
git clone https://gitlab.com/sortie/meaty-skeleton.git |
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): |
Check for differences between the git revision used in this article and what you cloned (empty output means there is no difference): |
||
< |
<syntaxhighlight lang="bash"> |
||
git diff 084d1624bedaa9f9e395f055c6bd99299bd97f58..master |
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. |
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: | Line 499: | ||
==== kernel/arch/i386/make.config ==== |
==== kernel/arch/i386/make.config ==== |
||
< |
<syntaxhighlight lang="make"> |
||
KERNEL_ARCH_CFLAGS= |
KERNEL_ARCH_CFLAGS= |
||
KERNEL_ARCH_CPPFLAGS= |
KERNEL_ARCH_CPPFLAGS= |
||
Line 508: | Line 508: | ||
$(ARCHDIR)/boot.o \ |
$(ARCHDIR)/boot.o \ |
||
$(ARCHDIR)/tty.o \ |
$(ARCHDIR)/tty.o \ |
||
</syntaxhighlight> |
|||
</source> |
|||
==== kernel/arch/i386/crti.S ==== |
==== kernel/arch/i386/crti.S ==== |
||
Line 686: | Line 686: | ||
==== libc/include/sys/cdefs.h ==== |
==== libc/include/sys/cdefs.h ==== |
||
< |
<syntaxhighlight lang="c"> |
||
#ifndef _SYS_CDEFS_H |
#ifndef _SYS_CDEFS_H |
||
#define _SYS_CDEFS_H 1 |
#define _SYS_CDEFS_H 1 |
||
Line 693: | Line 693: | ||
#endif |
#endif |
||
</syntaxhighlight> |
|||
</source> |
|||
==== libc/include/stdlib.h ==== |
==== libc/include/stdlib.h ==== |
||
Line 1,030: | Line 1,030: | ||
==== libc/arch/i386/make.config ==== |
==== libc/arch/i386/make.config ==== |
||
< |
<syntaxhighlight lang="make"> |
||
ARCH_CFLAGS= |
ARCH_CFLAGS= |
||
ARCH_CPPFLAGS= |
ARCH_CPPFLAGS= |
||
Line 1,039: | Line 1,039: | ||
ARCH_HOSTEDOBJS=\ |
ARCH_HOSTEDOBJS=\ |
||
</syntaxhighlight> |
|||
</source> |
|||
==== libc/.gitignore ==== |
==== libc/.gitignore ==== |
||
Line 1,055: | Line 1,055: | ||
==== build.sh ==== |
==== build.sh ==== |
||
< |
<syntaxhighlight lang="bash"> |
||
#!/bin/sh |
#!/bin/sh |
||
set -e |
set -e |
||
Line 1,063: | Line 1,063: | ||
(cd $PROJECT && DESTDIR="$SYSROOT" $MAKE install) |
(cd $PROJECT && DESTDIR="$SYSROOT" $MAKE install) |
||
done |
done |
||
</syntaxhighlight> |
|||
</source> |
|||
You should make this executable script executable by running: |
You should make this executable script executable by running: |
||
< |
<syntaxhighlight lang="bash"> |
||
chmod +x build.sh |
chmod +x build.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
==== clean.sh ==== |
==== clean.sh ==== |
||
< |
<syntaxhighlight lang="bash"> |
||
#!/bin/sh |
#!/bin/sh |
||
set -e |
set -e |
||
Line 1,084: | Line 1,084: | ||
rm -rf isodir |
rm -rf isodir |
||
rm -rf myos.iso |
rm -rf myos.iso |
||
</syntaxhighlight> |
|||
</source> |
|||
You should make this executable script executable by running: |
You should make this executable script executable by running: |
||
< |
<syntaxhighlight lang="bash"> |
||
chmod +x clean.sh |
chmod +x clean.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
==== config.sh ==== |
==== config.sh ==== |
||
< |
<syntaxhighlight lang="bash"> |
||
SYSTEM_HEADER_PROJECTS="libc kernel" |
SYSTEM_HEADER_PROJECTS="libc kernel" |
||
PROJECTS="libc kernel" |
PROJECTS="libc kernel" |
||
Line 1,122: | Line 1,122: | ||
export CC="$CC -isystem=$INCLUDEDIR" |
export CC="$CC -isystem=$INCLUDEDIR" |
||
fi |
fi |
||
</syntaxhighlight> |
|||
</source> |
|||
==== default-host.sh ==== |
==== default-host.sh ==== |
||
< |
<syntaxhighlight lang="bash"> |
||
#!/bin/sh |
#!/bin/sh |
||
echo i686-elf |
echo i686-elf |
||
</syntaxhighlight> |
|||
</source> |
|||
You should make this executable script executable by running: |
You should make this executable script executable by running: |
||
< |
<syntaxhighlight lang="bash"> |
||
chmod +x default-host.sh |
chmod +x default-host.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
==== headers.sh ==== |
==== headers.sh ==== |
||
< |
<syntaxhighlight lang="bash"> |
||
#!/bin/sh |
#!/bin/sh |
||
set -e |
set -e |
||
Line 1,148: | Line 1,148: | ||
(cd $PROJECT && DESTDIR="$SYSROOT" $MAKE install-headers) |
(cd $PROJECT && DESTDIR="$SYSROOT" $MAKE install-headers) |
||
done |
done |
||
</syntaxhighlight> |
|||
</source> |
|||
You should make this executable script executable by running: |
You should make this executable script executable by running: |
||
< |
<syntaxhighlight lang="bash"> |
||
chmod +x headers.sh |
chmod +x headers.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
==== iso.sh ==== |
==== iso.sh ==== |
||
Line 1,176: | Line 1,176: | ||
You should make this executable script executable by running: |
You should make this executable script executable by running: |
||
< |
<syntaxhighlight lang="bash"> |
||
chmod +x iso.sh |
chmod +x iso.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
==== qemu.sh ==== |
==== qemu.sh ==== |
||
< |
<syntaxhighlight lang="bash"> |
||
#!/bin/sh |
#!/bin/sh |
||
set -e |
set -e |
||
Line 1,188: | Line 1,188: | ||
qemu-system-$(./target-triplet-to-arch.sh $HOST) -cdrom myos.iso |
qemu-system-$(./target-triplet-to-arch.sh $HOST) -cdrom myos.iso |
||
</syntaxhighlight> |
|||
</source> |
|||
You should make this executable script executable by running: |
You should make this executable script executable by running: |
||
< |
<syntaxhighlight lang="bash"> |
||
chmod +x qemu.sh |
chmod +x qemu.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
==== target-triplet-to-arch.sh ==== |
==== target-triplet-to-arch.sh ==== |
||
< |
<syntaxhighlight lang="bash"> |
||
#!/bin/sh |
#!/bin/sh |
||
if echo "$1" | grep -Eq 'i[[:digit:]]86-'; then |
if echo "$1" | grep -Eq 'i[[:digit:]]86-'; then |
||
Line 1,204: | Line 1,204: | ||
echo "$1" | grep -Eo '^[[:alnum:]_]*' |
echo "$1" | grep -Eo '^[[:alnum:]_]*' |
||
fi |
fi |
||
</syntaxhighlight> |
|||
</source> |
|||
You should make this executable script executable by running: |
You should make this executable script executable by running: |
||
< |
<syntaxhighlight lang="bash"> |
||
chmod +x target-triplet-to-arch.sh |
chmod +x target-triplet-to-arch.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
==== .gitignore ==== |
==== .gitignore ==== |
||
Line 1,228: | Line 1,228: | ||
the source tree by invoking: |
the source tree by invoking: |
||
< |
<syntaxhighlight lang="bash"> |
||
./clean.sh |
./clean.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
You can install all the system headers into the system root without relying on |
You can install all the system headers into the system root without relying on |
||
Line 1,236: | Line 1,236: | ||
[[Hosted GCC Cross-Compiler]], by invoking: |
[[Hosted GCC Cross-Compiler]], by invoking: |
||
< |
<syntaxhighlight lang="bash"> |
||
./headers.sh |
./headers.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
You can build a bootable cdrom image of the operating system by invoking: |
You can build a bootable cdrom image of the operating system by invoking: |
||
< |
<syntaxhighlight lang="bash"> |
||
./iso.sh |
./iso.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
It's probably a good idea to create a quick ''build-and-then-launch'' short-cut |
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: |
like used in this example to run the system in your favorite emulator quickly: |
||
< |
<syntaxhighlight lang="bash"> |
||
./qemu.sh |
./qemu.sh |
||
</syntaxhighlight> |
|||
</source> |
|||
== Troubleshooting == |
== Troubleshooting == |