aboutsummaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorMatthew Leach <Matthew.Leach@arm.com>2014-01-23 17:29:26 +0000
committerMark Rutland <mark.rutland@arm.com>2014-03-12 11:15:25 +0000
commitbae4ae6a834cd15bf50f0ddc9a7331d8b0ac7168 (patch)
treeede44c057db9d447028725f6a8e1ba08abe3ca60 /Makefile.am
parent20db29f89a11c023634ccaab152941a6afdf2d52 (diff)
Add autotools configuration.
This patch adds a basic auto-tools configuration environment for the bootwrapper consisting of the configure.ac file and the Makefile.am file. The configure.ac file includes several options and checks: - Ensure that an AArch64 compiler is used. - Add the mandatory --with-kernel-dir option that sets KERN_DIR. - Check that the correct base dtb file exists in KERN_DIR. - Add an option, --with-initrd, that allows a user to specify an initrd file to embed in the image. - Check for a working dtc and set DTC to the full-path to the executable. - Create the necessary symbolic links to the relevant kernel files. The Makefile.am file includes several changes: - Use a prebuilt dtb rather than a dts, which is decompiled to inject the chosen node. - Use the configured compiler tool names. - Use the configured SED program rather than assuming it is in PATH. Signed-off-by: Matthew Leach <matthew.leach@arm.com> [Mark: use dtb, add options, fix style issues, remove src/] Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am73
1 files changed, 73 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..fd66c8c
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,73 @@
+#
+# Makefile.am - build a kernel+filesystem image for stand-alone Linux
+# booting
+#
+# Copyright (C) 2012 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.
+
+# VE
+PHYS_OFFSET := 0x80000000
+UART_BASE := 0x1c090000
+SYSREGS_BASE := 0x1c010000
+GIC_DIST_BASE := 0x2c001000
+GIC_CPU_BASE := 0x2c002000
+CNTFRQ := 0x01800000 # 24Mhz
+CPU_IDS ?= 0x0,0x1,0x2,0x3
+
+DEFINES = -DCNTFRQ=$(CNTFRQ)
+DEFINES += -DCPU_IDS=$(CPU_IDS)
+DEFINES += -DGIC_CPU_BASE=$(GIC_CPU_BASE)
+DEFINES += -DGIC_DIST_BASE=$(GIC_DIST_BASE)
+DEFINES += -DSYSREGS_BASE=$(SYSREGS_BASE)
+DEFINES += -DUART_BASE=$(UART_BASE)
+
+BOOTLOADER := boot.S
+BOOTMETHOD := psci.o
+MBOX_OFFSET := 0xfff8
+KERNEL_OFFSET := 0x80000
+LD_SCRIPT := model.lds.S
+IMAGE := linux-system.axf
+
+FS_OFFSET := 0x10000000
+FILESYSTEM_START:= $(shell echo $$(($(PHYS_OFFSET) + $(FS_OFFSET))))
+FILESYSTEM_SIZE := $(shell stat -Lc %s $(FILESYSTEM) 2>/dev/null || echo 0)
+FILESYSTEM_END := $(shell echo $$(($(FILESYSTEM_START) + $(FILESYSTEM_SIZE))))
+
+FDT_OFFSET := 0x08000000
+
+if INITRD
+INITRD_FLAGS := -DUSE_INITRD
+CHOSEN_NODE := chosen { \
+ bootargs = \"$(CMDLINE)\"; \
+ linux,initrd-start = <$(FILESYSTEM_START)>; \
+ linux,initrd-end = <$(FILESYSTEM_END)>; \
+ };
+else
+INITRD_FLAGS :=
+CHOSEN_NODE := chosen { \
+ bootargs = \"$(CMDLINE)\"; \
+ };
+endif
+
+CPPFLAGS += $(INITRD_FLAGS)
+
+all: $(IMAGE)
+
+CLEANFILES = $(IMAGE) boot.o cache.o gic.o mmu.o ns.o $(BOOTMETHOD) model.lds fdt.dtb
+
+$(IMAGE): boot.o cache.o gic.o mmu.o ns.o $(BOOTMETHOD) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM)
+ $(LD) -o $@ --script=model.lds
+
+%.o: %.S Makefile
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $<
+
+model.lds: $(LD_SCRIPT) Makefile
+ $(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DBOOTMETHOD=$(BOOTMETHOD) -P -C -o $@ $<
+
+fdt.dtb: $(KERNEL_DTB) Makefile
+ ( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) };" ) | $(DTC) -O dtb -o $@ -
+
+# The filesystem archive might not exist if INITRD is not being used
+.PHONY: all clean $(FILESYSTEM)