Signed-off-by: Paul Butler <paul.but...@windriver.com> --- arch/arm/boot/fmboot/Makefile | 25 +++++++++++++ arch/arm/boot/fmboot/fmboot.S | 80 +++++++++++++++++++++++++++++++++++++++++ arch/arm/boot/fmboot/fmboot.lds | 30 ++++++++++++++++ arch/arm/boot/fmboot/pack.py | 10 ++++++ 4 files changed, 145 insertions(+) create mode 100644 arch/arm/boot/fmboot/Makefile create mode 100644 arch/arm/boot/fmboot/fmboot.S create mode 100644 arch/arm/boot/fmboot/fmboot.lds create mode 100644 arch/arm/boot/fmboot/pack.py
diff --git a/arch/arm/boot/fmboot/Makefile b/arch/arm/boot/fmboot/Makefile new file mode 100644 index 0000000..9b2b42e --- /dev/null +++ b/arch/arm/boot/fmboot/Makefile @@ -0,0 +1,25 @@ +# Build an image for Fast Models + +AS = $(CROSS_COMPILE)gcc -c +LD = $(CROSS_COMPILE)ld + +DTC = ../../../../scripts/dtc/dtc +DTS = ../dts/axm-sim.dts +ZIMAGE = ../zImage + +all: clean linux.fm + +clean: + rm -f linux.fm fmboot.o zImage.fm axm-sim.dtb + +linux.fm: fmboot.o fmboot.lds zImage.fm + $(LD) -o $@ --script=fmboot.lds + +zImage.fm: $(ZIMAGE) axm-sim.dtb + python pack.py $(ZIMAGE) axm-sim.dtb > $@ + +axm-sim.dtb: $(DTS) + $(DTC) -O dtb -o $@ $< + +fmboot.o: fmboot.S + $(AS) -o $@ $< diff --git a/arch/arm/boot/fmboot/fmboot.S b/arch/arm/boot/fmboot/fmboot.S new file mode 100644 index 0000000..cd52371 --- /dev/null +++ b/arch/arm/boot/fmboot/fmboot.S @@ -0,0 +1,80 @@ +/* + * boot.S - simple register setup code for stand-alone Linux booting + * + * Copyright (C) 2011 ARM Limited. All rights reserved. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE.txt file. + */ + +#define SPIN_TABLE_BASE 0x10000000 + + .syntax unified + .text + + .globl _start +_start: + @ + @ Program architected timer frequency + @ + mrc p15, 0, r0, c0, c1, 1 @ CPUID_EXT_PFR1 + lsr r0, r0, #16 + ands r0, r0, #1 @ Check generic timer support + beq 1f + ldr r0, =100000000 @ 100MHz timer frequency + mcr p15, 0, r0, c14, c0, 0 @ CNTFRQ +1: + @ + @ CPU initialisation + @ + mrc p15, 0, r0, c0, c0, 5 @ MPIDR (ARMv7 only) + and r0, r0, #15 @ CPU number + cmp r0, #0 @ primary CPU? + beq 2f + + @ + @ Secondary CPUs + @ + ldr r1, =SPIN_TABLE_BASE + adr r2, 1f + ldmia r2, {r3 - r7} @ move the code to a location + stmia r1, {r3 - r7} @ less likely to be overridden + add r0, r1, #0x20 @ Entry point for secondary + @ CPUs @ SPIN_TABLE_BASE+0x20 + mov r2, #0 + str r2, [r0, #0] @ ensure initially zero + mov pc, r1 @ branch to the relocated code +1: + wfe + ldr r1, [r0] + cmp r1, #0 + beq 1b + mov pc, r1 @ branch to the given address + + @ + @ Kernel parameters + @ +2: mov r0, #0 @ Must be zero + mov r1, #0 @ Machine type (not needed) + adr r2, atags @ ATAGS pointer + mov r3, #0 + ldr lr, =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 "root=/dev/mmcblk0 rootwait ip=none mem=1024M console=ttyAMA0" + + .align 2 +1: + + @ ATAG_NONE + .long 0 + .long 0x00000000 diff --git a/arch/arm/boot/fmboot/fmboot.lds b/arch/arm/boot/fmboot/fmboot.lds new file mode 100644 index 0000000..8cde9f8 --- /dev/null +++ b/arch/arm/boot/fmboot/fmboot.lds @@ -0,0 +1,30 @@ +/* + * fmboot.lds + * + * Copyright (C) 2011 ARM Limited. All rights reserved. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE.txt file. + */ + +OUTPUT_FORMAT("elf32-littlearm") +OUTPUT_ARCH(arm) +TARGET(binary) + +INPUT(./fmboot.o) +INPUT(./zImage.fm) + +PHYS_OFFSET = 0x00000000; + +SECTIONS +{ + . = PHYS_OFFSET; + .text : { fmboot.o } + . = PHYS_OFFSET + 0x8000 - 0x0; + kernel = . + 0x0; + .kernel : { ./zImage.fm } + . = PHYS_OFFSET + 0x00800000; + filesystem = .; + .data : { *(.data) } + .bss : { *(.bss) } +} diff --git a/arch/arm/boot/fmboot/pack.py b/arch/arm/boot/fmboot/pack.py new file mode 100644 index 0000000..fe2ce70 --- /dev/null +++ b/arch/arm/boot/fmboot/pack.py @@ -0,0 +1,10 @@ +import sys + +while len(sys.argv) > 1: + f = open(sys.argv.pop(1), "rb") + f.seek(0, 2) + sz = f.tell() + f.seek(0,0) + pad = ((sz + 3) & ~3) - sz + sys.stdout.write(f.read() + '\0'*pad) + f.close() -- 1.8.3 _______________________________________________ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto