Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
lowlevel
tutorial
Commits
e42a4a3f
Commit
e42a4a3f
authored
15 years ago
by
Kevin Wolf
Browse files
Options
Download
Email Patches
Plain Diff
Multiboot-Header in eine eigene Sektion
parent
d4cb2bbd
master
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-1
Makefile
kernel.ld
+33
-0
kernel.ld
start.S
+6
-5
start.S
with
40 additions
and
6 deletions
+40
-6
Makefile
View file @
e42a4a3f
...
...
@@ -6,7 +6,7 @@ LD = ld
ASFLAGS
=
-m32
CFLAGS
=
-m32
-Wall
-g
-fno-stack-protector
LDFLAGS
=
-melf_i386
-T
text
=
0x100000
LDFLAGS
=
-melf_i386
-T
kernel
.ld
kernel
:
$(OBJS)
$(LD)
$(LDFLAGS)
-o
$@
$^
...
...
This diff is collapsed.
Click to expand it.
kernel.ld
0 → 100644
View file @
e42a4a3f
/* Bei _start soll die Ausfuehrung losgehen */
ENTRY(_start)
/*
* Hier wird festgelegt, in welcher Reihenfolge welche Sektionen in die Binary
* geschrieben werden sollen
*/
SECTIONS
{
/*
* . ist die aktuelle Position in der Datei. Wir wollen den Kernel wie gehabt
* an 1 MB laden, also muessen wir dort die erste Sektion hinlegen
*/
. = 0x100000;
/*
* Der Multiboot-Header muss zuerst kommen (in den ersten 8 kB).
* Die Standardsektionen einfach hintereinander weg einbinden.
*/
.text : {
*(multiboot)
*(.text)
}
.data ALIGN(4096) : {
*(.data)
}
.rodata ALIGN(4096) : {
*(.rodata)
}
.bss ALIGN(4096) : {
*(.bss)
}
}
This diff is collapsed.
Click to expand it.
start.S
View file @
e42a4a3f
.
section
.
text
//
Init
ist
eine
Funktion
aus
init
.
c
.
extern
init
.
section
multiboot
#define MB_MAGIC 0x1badb002
#define MB_FLAGS 0x0
#define MB_CHECKSUM -(MB_MAGIC + MB_FLAGS)
...
...
@@ -13,6 +9,11 @@
.
int
MB_FLAGS
.
int
MB_CHECKSUM
.
section
.
text
//
Init
ist
eine
Funktion
aus
init
.
c
.
extern
init
//
_start
muss
global
sein
,
damit
der
Linker
es
findet
und
als
Einsprungspunkt
//
benutzen
kann
(
alle
Labels
,
die
nicht
global
sind
,
sind
nur
in
dieser
Datei
//
sichtbar
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help