summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2009-12-03 14:46:06 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2009-12-03 14:46:06 +0000
commitd1ef137358c2530450a21315829512d2f1876212 (patch)
tree9f20432eb59aa6190aafe0a0520fc2edf1463109
parentc77ac1f27122da92e026f21446a2679695007e3d (diff)
Modified the boot wrapper to use initramfs (cpio file) and also pass a
kernel command line.
-rw-r--r--Makefile15
-rw-r--r--boot-t2.S34
-rw-r--r--boot.S45
-rw-r--r--model.lds40
4 files changed, 75 insertions, 59 deletions
diff --git a/Makefile b/Makefile
index 3e40b27..1606f6a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,29 +1,24 @@
# Build an ELF linux+filesystem image
-BOOTLOADER = boot.bin
+BOOTLOADER = boot.S
KERNEL = uImage
-FILESYSTEM = base.cramfs
+FILESYSTEM = filesystem.cpio.gz
IMAGE = linux-system.axf
LD_SCRIPT = model.lds
CROSS_COMPILE = arm-none-linux-gnueabi-
-CC = $(CROSS_COMPILE)gcc
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
-OBJCOPY = $(CROSS_COMPILE)objcopy
all: $(IMAGE)
clean:
- rm -f $(IMAGE)
+ rm -f $(IMAGE) boot.o
-$(IMAGE): $(BOOTLOADER) $(KERNEL) $(FILESYSTEM) $(LD_SCRIPT)
+$(IMAGE): boot.o $(LD_SCRIPT) $(KERNEL) $(FILESYSTEM)
$(LD) -o $@ --script=$(LD_SCRIPT)
-boot.bin: boot.o
- $(OBJCOPY) -O binary -S $< $@
-
-boot.o: boot.S
+boot.o: $(BOOTLOADER)
$(AS) -o $@ $<
diff --git a/boot-t2.S b/boot-t2.S
deleted file mode 100644
index ed3d232..0000000
--- a/boot-t2.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * boot.S - simple register setup code for stand-alone Linux booting
- *
- * Copyright (C) 2006 ARM Limited
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- mov r0, #0x16000000 @ UART base (Integrator/CP)
- mov r1, #0x10 @ ibrd
- str r1, [r0, #0x24]
- mov r1, #0xc300
- orr r1, #0x0001 @ cr
- str r1, [r0, #0x30]
-
- mov r0, #0
- mov r1, #0x13
- orr r1, r1, #0x100 @ Integrator/CP
- mov r2, #0
- mov r3, #0
- mov lr, #0x8000
- orr lr, lr, #1 @ Thumb mode
- bx lr @ jump to the kernel
diff --git a/boot.S b/boot.S
index ec8e282..4aedd35 100644
--- a/boot.S
+++ b/boot.S
@@ -1,7 +1,7 @@
/*
* boot.S - simple register setup code for stand-alone Linux booting
*
- * Copyright (C) 2006 ARM Limited
+ * Copyright (C) 2009 ARM Limited
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -17,17 +17,50 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
- mov r0, #0x16000000 @ UART base (Integrator/CP)
+ .text
+
+ .globl _start
+_start:
+ @
+ @ UART initialisation (38400 8N1)
+ @
+ ldr r0, =0x10009000 @ UART base (RealView/EB)
mov r1, #0x10 @ ibrd
str r1, [r0, #0x24]
mov r1, #0xc300
orr r1, #0x0001 @ cr
str r1, [r0, #0x30]
+ @
+ @ Kernel parameters
+ @
mov r0, #0
- mov r1, #0x13
- orr r1, r1, #0x100 @ Integrator/CP
- mov r2, #0
+ ldr r1, =827 @ RealView/EB
+ adr r2, atags
mov r3, #0
- mov lr, #0x8000
+ ldr lr, =kernel
+@ orr lr, lr, #1 @ Thumb-2 kernel
mov pc, lr @ jump to the kernel
+
+ .org 0x100
+atags:
+ @ ATAG_CORE
+ .long 2
+ .long 0x54410001
+
+ @ ATAG_CMDLINE
+ .long (1f - .) >> 2
+ .long 0x54410009
+ .asciz "console=ttyAMA0 mem=256M earlyprintk"
+ .align 2
+1:
+
+ @ ATAG_INITRD2
+ .long 4
+ .long 0x54420005
+ .long filesystem
+ .long fs_size
+
+ @ ATAG_NONE
+ .long 0
+ .long 0x00000000
diff --git a/model.lds b/model.lds
index 7b68d0b..187ba9f 100644
--- a/model.lds
+++ b/model.lds
@@ -1,23 +1,45 @@
-start = 0x00400000;
+/*
+ * boot.S - simple register setup code for stand-alone Linux booting
+ *
+ * Copyright (C) 2009 ARM Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
OUTPUT_FORMAT("elf32-littlearm")
OUTPUT_ARCH(arm)
TARGET(binary)
INPUT(./uImage)
-INPUT(./boot.bin)
-INPUT(./base.cramfs)
+INPUT(./filesystem.cpio.gz)
+INPUT(./boot.o)
+
+PHYS = 0x70000000;
SECTIONS
{
- . = 0x00007fc0;
- .text.kernel : { ./uImage *(.text) }
+ . = PHYS;
+ .text : { boot.o }
- . = 0x00400000;
- .text.boot : { ./boot.bin *(.text) }
+ . = PHYS + 0x8000 - 0x40;
+ kernel = . + 0x40;
+ .kernel : { ./uImage }
- . = 0x00800000;
- .text.filesystem : { ./base.cramfs *(.text) }
+ . = PHYS + 0x00800000;
+ filesystem = .;
+ .filesystem : { ./filesystem.cpio.gz }
+ fs_size = . - filesystem;
.data : { *(.data) }
.bss : { *(.bss) }