aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/boot/bootp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/boot/bootp')
-rw-r--r--arch/arm/boot/bootp/Makefile24
-rw-r--r--arch/arm/boot/bootp/bootp.lds30
-rw-r--r--arch/arm/boot/bootp/init.S86
-rw-r--r--arch/arm/boot/bootp/initrd.S6
-rw-r--r--arch/arm/boot/bootp/kernel.S6
5 files changed, 152 insertions, 0 deletions
diff --git a/arch/arm/boot/bootp/Makefile b/arch/arm/boot/bootp/Makefile
new file mode 100644
index 000000000000..8e8879b6b3d7
--- /dev/null
+++ b/arch/arm/boot/bootp/Makefile
@@ -0,0 +1,24 @@
1#
2# linux/arch/arm/boot/bootp/Makefile
3#
4
5LDFLAGS_bootp :=-p --no-undefined -X \
6 --defsym initrd_phys=$(INITRD_PHYS) \
7 --defsym params_phys=$(PARAMS_PHYS) -T
8AFLAGS_initrd.o :=-DINITRD=\"$(INITRD)\"
9
10targets := bootp init.o kernel.o initrd.o
11
12# Note that bootp.lds picks up kernel.o and initrd.o
13$(obj)/bootp: $(src)/bootp.lds $(addprefix $(obj)/,init.o kernel.o initrd.o) FORCE
14 $(call if_changed,ld)
15 @:
16
17# kernel.o and initrd.o includes a binary image using
18# .incbin, a dependency which is not tracked automatically
19
20$(obj)/kernel.o: arch/arm/boot/zImage FORCE
21
22$(obj)/initrd.o: $(INITRD) FORCE
23
24.PHONY: $(INITRD) FORCE
diff --git a/arch/arm/boot/bootp/bootp.lds b/arch/arm/boot/bootp/bootp.lds
new file mode 100644
index 000000000000..8e3d81ce695e
--- /dev/null
+++ b/arch/arm/boot/bootp/bootp.lds
@@ -0,0 +1,30 @@
1/*
2 * linux/arch/arm/boot/bootp/bootp.lds
3 *
4 * Copyright (C) 2000-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10OUTPUT_ARCH(arm)
11ENTRY(_start)
12SECTIONS
13{
14 . = 0;
15 .text : {
16 _stext = .;
17 *(.start)
18 *(.text)
19 initrd_size = initrd_end - initrd_start;
20 _etext = .;
21 }
22
23 .stab 0 : { *(.stab) }
24 .stabstr 0 : { *(.stabstr) }
25 .stab.excl 0 : { *(.stab.excl) }
26 .stab.exclstr 0 : { *(.stab.exclstr) }
27 .stab.index 0 : { *(.stab.index) }
28 .stab.indexstr 0 : { *(.stab.indexstr) }
29 .comment 0 : { *(.comment) }
30}
diff --git a/arch/arm/boot/bootp/init.S b/arch/arm/boot/bootp/init.S
new file mode 100644
index 000000000000..df7bc7068d0f
--- /dev/null
+++ b/arch/arm/boot/bootp/init.S
@@ -0,0 +1,86 @@
1/*
2 * linux/arch/arm/boot/bootp/init.S
3 *
4 * Copyright (C) 2000-2003 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * "Header" file for splitting kernel + initrd. Note that we pass
11 * r0 through to r3 straight through.
12 *
13 * This demonstrates how to append code to the start of the kernel
14 * zImage, and boot the kernel without copying it around. This
15 * example would be simpler; if we didn't have an object of unknown
16 * size immediately following the kernel, we could build this into
17 * a binary blob, and concatenate the zImage using the cat command.
18 */
19 .section .start,#alloc,#execinstr
20 .type _start, #function
21 .globl _start
22
23_start: add lr, pc, #-0x8 @ lr = current load addr
24 adr r13, data
25 ldmia r13!, {r4-r6} @ r5 = dest, r6 = length
26 add r4, r4, lr @ r4 = initrd_start + load addr
27 bl move @ move the initrd
28
29/*
30 * Setup the initrd parameters to pass to the kernel. This can only be
31 * passed in via the tagged list.
32 */
33 ldmia r13, {r5-r9} @ get size and addr of initrd
34 @ r5 = ATAG_CORE
35 @ r6 = ATAG_INITRD2
36 @ r7 = initrd start
37 @ r8 = initrd end
38 @ r9 = param_struct address
39
40 ldr r10, [r9, #4] @ get first tag
41 teq r10, r5 @ is it ATAG_CORE?
42/*
43 * If we didn't find a valid tag list, create a dummy ATAG_CORE entry.
44 */
45 movne r10, #0 @ terminator
46 movne r4, #2 @ Size of this entry (2 words)
47 stmneia r9, {r4, r5, r10} @ Size, ATAG_CORE, terminator
48
49/*
50 * find the end of the tag list, and then add an INITRD tag on the end.
51 * If there is already an INITRD tag, then we ignore it; the last INITRD
52 * tag takes precidence.
53 */
54taglist: ldr r10, [r9, #0] @ tag length
55 teq r10, #0 @ last tag (zero length)?
56 addne r9, r9, r10, lsl #2
57 bne taglist
58
59 mov r5, #4 @ Size of initrd tag (4 words)
60 stmia r9, {r5, r6, r7, r8, r10}
61 b kernel_start @ call kernel
62
63/*
64 * Move the block of memory length r6 from address r4 to address r5
65 */
66move: ldmia r4!, {r7 - r10} @ move 32-bytes at a time
67 stmia r5!, {r7 - r10}
68 ldmia r4!, {r7 - r10}
69 stmia r5!, {r7 - r10}
70 subs r6, r6, #8 * 4
71 bcs move
72 mov pc, lr
73
74 .size _start, . - _start
75
76 .type data,#object
77data: .word initrd_start @ source initrd address
78 .word initrd_phys @ destination initrd address
79 .word initrd_size @ initrd size
80
81 .word 0x54410001 @ r5 = ATAG_CORE
82 .word 0x54420005 @ r6 = ATAG_INITRD2
83 .word initrd_phys @ r7
84 .word initrd_size @ r8
85 .word params_phys @ r9
86 .size data, . - data
diff --git a/arch/arm/boot/bootp/initrd.S b/arch/arm/boot/bootp/initrd.S
new file mode 100644
index 000000000000..d81ea183785c
--- /dev/null
+++ b/arch/arm/boot/bootp/initrd.S
@@ -0,0 +1,6 @@
1 .type initrd_start,#object
2 .globl initrd_start
3initrd_start:
4 .incbin INITRD
5 .globl initrd_end
6initrd_end:
diff --git a/arch/arm/boot/bootp/kernel.S b/arch/arm/boot/bootp/kernel.S
new file mode 100644
index 000000000000..b87a25c7ef88
--- /dev/null
+++ b/arch/arm/boot/bootp/kernel.S
@@ -0,0 +1,6 @@
1 .globl kernel_start
2kernel_start:
3 .incbin "arch/arm/boot/zImage"
4 .globl kernel_end
5kernel_end:
6 .align 2