From patchwork Fri Dec 9 15:59:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 5561 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 72D4C23E10 for ; Fri, 9 Dec 2011 15:59:50 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 5B69CA18058 for ; Fri, 9 Dec 2011 15:59:50 +0000 (UTC) Received: by mail-bw0-f52.google.com with SMTP id 17so4230242bke.11 for ; Fri, 09 Dec 2011 07:59:50 -0800 (PST) Received: by 10.204.156.208 with SMTP id y16mr4188068bkw.72.1323446389921; Fri, 09 Dec 2011 07:59:49 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.129.2 with SMTP id hg2cs116736bkc; Fri, 9 Dec 2011 07:59:49 -0800 (PST) Received: by 10.220.141.4 with SMTP id k4mr426759vcu.130.1323446387735; Fri, 09 Dec 2011 07:59:47 -0800 (PST) Received: from mail-vw0-f50.google.com (mail-vw0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id iz9si5550591vdb.151.2011.12.09.07.59.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Dec 2011 07:59:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of c.dall@virtualopensystems.com) client-ip=209.85.212.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of c.dall@virtualopensystems.com) smtp.mail=c.dall@virtualopensystems.com Received: by mail-vw0-f50.google.com with SMTP id ey12so3167269vbb.37 for ; Fri, 09 Dec 2011 07:59:47 -0800 (PST) Received: by 10.52.94.97 with SMTP id db1mr5008600vdb.16.1323446387143; Fri, 09 Dec 2011 07:59:47 -0800 (PST) Received: from [127.0.1.1] (chazy.cs.columbia.edu. [128.59.22.176]) by mx.google.com with ESMTPS id c10sm7292317vdj.20.2011.12.09.07.59.45 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Dec 2011 07:59:46 -0800 (PST) Subject: [PATCH v2 1/2] Makefile: Introduced super-simple config file To: android-virt@lists.cs.columbia.edu From: Christoffer Dall Cc: Marc Zyngier , Peter Maydell , tech@virtualopensystems.com, patches@linaro.org Date: Fri, 09 Dec 2011 10:59:45 -0500 Message-ID: <20111209155945.23395.33341.stgit@ubuntu> In-Reply-To: <20111209155925.23395.35593.stgit@ubuntu> References: <20111209155925.23395.35593.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 Config files are named config.mk. This file is added to .gitignore, but a default config file is supplied in config-default.mk. The default config file creates kernel command boot lines for NFS boots based on a script obtaining the host IP addres. Naturally users can change this to a static IP or another script if they wish. The config file lets users select a system and other config options depend on this overall setting. I am no expert on Makefiles, so there could be better ways to accomplish these things, but I think this suffices for now. Signed-off-by: Christoffer Dall --- .gitignore | 1 + Makefile | 38 ++++------------------- config-default.mk | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++ get_ip.sh | 7 ++++ 4 files changed, 103 insertions(+), 32 deletions(-) create mode 100644 config-default.mk create mode 100755 get_ip.sh diff --git a/.gitignore b/.gitignore index 05aa345..07eefe1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ filesystem.cpio.gz linux-system.axf uImage model.lds +config.mk *.o *.swp diff --git a/Makefile b/Makefile index e1635ea..54cdbf5 100644 --- a/Makefile +++ b/Makefile @@ -5,47 +5,21 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE.txt file. -CPPFLAGS += -DSMP -#CPPFLAGS += -DTHUMB2_KERNEL -CPPFLAGS += -march=armv7-a -CPPFLAGS += -DVEXPRESS - -# Turn this on to use an initrd whose contents are in filesystem.cpio.gz -USE_INITRD = no -ifeq ($(USE_INITRD),yes) -CPPFLAGS += -DUSE_INITRD -FILESYSTEM = filesystem.cpio.gz + +# Include config file (prefer config.mk, fall back to config-default.mk) +ifneq ($(wildcard config.mk),) +include config.mk else -FILESYSTEM = +include config-default.mk endif -# MPS (Cortex-M3) definitions -#CPPFLAGS += -DMACH_MPS -DTHUMB2_KERNEL -#CPPFLAGS += -march=armv7-m -#CPPFLAGS += -mthumb -Wa,-mthumb -Wa,-mimplicit-it=always - -# Kernel command line -# MPS: -# KCMD = "rdinit=/bin/sh console=ttyAMA3 mem=4M earlyprintk" -# not-vexpress (ie EB, RealviewPB, etc), with initrd -# KCMD = "console=ttyAMA0 mem=256M earlyprintk" -# not-vexpress, without initrd: -# KCMD = "root=/dev/nfs nfsroot=10.1.77.43:/work/debootstrap/arm ip=dhcp console=ttyAMA0 mem=256M earlyprintk" -# Vexpress, with initrd: -# KCMD = "console=ttyAMA0 mem=512M mem=512M@0x880000000 earlyprintk ip=192.168.27.200::192.168.27.1:255.255.255.0:angstrom:eth0:off" -# VExpress, without initrd: -KCMD ?= "console=ttyAMA0 mem=512M mem=512M@0x880000000 earlyprintk root=/dev/nfs nfsroot=172.31.252.250:/srv/arm-oneiric-root,tcp rw ip=dhcp nfsrootdebug" - MONITOR = monitor.S BOOTLOADER = boot.S -KERNEL_SRC = ../linux-kvm-arm KERNEL = uImage IMAGE = linux-system.axf LD_SCRIPT = model.lds.S -CROSS_COMPILE ?= arm-unknown-eabi- -ARCH ?= arm CC = $(CROSS_COMPILE)gcc LD = $(CROSS_COMPILE)ld @@ -85,4 +59,4 @@ force: ; Makefile: ; -.PHONY: all clean +.PHONY: all clean config.mk config-default.mk diff --git a/config-default.mk b/config-default.mk new file mode 100644 index 0000000..c465634 --- /dev/null +++ b/config-default.mk @@ -0,0 +1,89 @@ +# Configuration file included in Makefile +# +# Copyright (C) 2011 Columbia University. All rights reserved. +# Christoffer Dall +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE.txt file. +# +# This is a sample configuration file. To make changes, copy this file to +# config.mk and modify that file. +# +# For all systems you can override USE_INITRD and KCMD from the command-line. +# + +########################################################################### +# Main options +# +CROSS_COMPILE ?= arm-unknown-eabi- +ARCH ?= arm +KERNEL_SRC ?= ../linux-kvm-arm + +# Select system: +# mps: MPS (Cortex-M3) +# realview_eb: RealViewPB, EB, etc. +# vexpress: Versatile Express +SYSTEM ?= vexpress + +########################################################################### +# Turn this on to use an initrd whose contents are in filesystem.cpio.gz +USE_INITRD ?= no +ifeq ($(USE_INITRD),yes) +CPPFLAGS += -DUSE_INITRD +FILESYSTEM ?= filesystem.cpio.gz +else +FILESYSTEM = +endif + +########################################################################### +# Default NFS root +NFS_ROOT ?= /srv/nfsroot +ifeq ($(origin NFS_SERVER), undefined) +NFS_SERVER := $(shell ip addr show scope global | \ + sed -ne '/inet/{s/ *inet \([^/]*\)\/.*/\1/p;q}') +endif + + +########################################################################### +# MPS (Cortex-M3) definitions +# +ifeq ($(SYSTEM),mps) +# C-flags +CPPFLAGS += -DMACH_MPS -DTHUMB2_KERNEL +CPPFLAGS += -march=armv7-m +CPPFLAGS += -mthumb -Wa,-mthumb -Wa,-mimplicit-it=always + +# Kernel command line +KCMD ?= "rdinit=/bin/sh console=ttyAMA3 mem=4M earlyprintk" +endif + + +########################################################################### +# EB, RealviewPB, etc +# +ifeq ($(SYSTEM),realview_eb) +# Default kernel command line, using initrd: +ifeq ($(USE_INITRD),yes) +KCMD ?= "console=ttyAMA0 mem=256M earlyprintk" +endif +# +# Default kernel command line, without initrd: +ifneq ($(USE_INITRD),yes) + KCMD ?= "root=/dev/nfs nfsroot=$(NFS_HOST):$(NFS_ROOT) ip=dhcp console=ttyAMA0 mem=256M earlyprintk" +endif +endif + + +########################################################################### +# Versatile Express +# +ifeq ($(SYSTEM),vexpress) +# Default kernel command line, using initrd: +ifeq ($(USE_INITRD),yes) +KCMD ?= "console=ttyAMA0 mem=512M mem=512M@0x880000000 earlyprintk ip=dhcp" +endif +# +# Default kernel command line, without initrd: +ifneq ($(USE_INITRD),yes) + KCMD ?= "console=ttyAMA0 mem=512M mem=512M@0x880000000 earlyprintk root=/dev/nfs nfsroot=$(NFS_SERVER):$(NFS_ROOT),tcp rw ip=dhcp nfsrootdebug" +endif +endif diff --git a/get_ip.sh b/get_ip.sh new file mode 100755 index 0000000..2ef9eac --- /dev/null +++ b/get_ip.sh @@ -0,0 +1,7 @@ +#/bin/bash + +ifconfig | \ + grep 'inet addr:'| \ + grep -v '127.0.0.1' | \ + cut -d: -f2 | \ + awk '{ print $1}'