blob: 4fe6e448bee49de675e1483092debe110ade7de2 [file] [log] [blame]
wdenk7ebf7442002-11-02 23:17:16 +00001#!/bin/sh -e
2
3# Script to create header files and links to configure
4# U-Boot for a specific board.
5#
wdenk1d9f4102004-10-09 22:21:29 +00006# Parameters: Target Architecture CPU Board [VENDOR] [SOC]
wdenk7ebf7442002-11-02 23:17:16 +00007#
8# (C) 2002 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
9#
10
11APPEND=no # Default: Create new config file
Wolfgang Denk5078cce2006-07-21 11:16:34 +020012BOARD_NAME="" # Name to print in make output
wdenk7ebf7442002-11-02 23:17:16 +000013
14while [ $# -gt 0 ] ; do
15 case "$1" in
16 --) shift ; break ;;
17 -a) shift ; APPEND=yes ;;
Wolfgang Denk5078cce2006-07-21 11:16:34 +020018 -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
wdenk7ebf7442002-11-02 23:17:16 +000019 *) break ;;
20 esac
21done
22
Wolfgang Denk5078cce2006-07-21 11:16:34 +020023[ "${BOARD_NAME}" ] || BOARD_NAME="$1"
24
wdenk7ebf7442002-11-02 23:17:16 +000025[ $# -lt 4 ] && exit 1
wdenk1d9f4102004-10-09 22:21:29 +000026[ $# -gt 6 ] && exit 1
wdenk7ebf7442002-11-02 23:17:16 +000027
Wolfgang Denk5078cce2006-07-21 11:16:34 +020028echo "Configuring for ${BOARD_NAME} board..."
wdenk7ebf7442002-11-02 23:17:16 +000029
30cd ./include
31
32#
33# Create link to architecture specific headers
34#
35rm -f asm
36ln -s asm-$2 asm
37rm -f asm-$2/arch
wdenk86c98882005-04-03 14:26:46 +000038
Wolfgang Denk507d3b02005-08-03 22:58:55 +020039if [ -z "$6" -o "$6" = "NULL" ] ; then
wdenk86c98882005-04-03 14:26:46 +000040 ln -s arch-$3 asm-$2/arch
41else
42 ln -s arch-$6 asm-$2/arch
43fi
wdenk7ebf7442002-11-02 23:17:16 +000044
wdenkb783eda2003-06-25 22:26:29 +000045if [ "$2" = "arm" ] ; then
46 rm -f asm-$2/proc
47 ln -s proc-armv asm-$2/proc
48fi
49
wdenk7ebf7442002-11-02 23:17:16 +000050#
51# Create include file for Make
52#
wdenk1d9f4102004-10-09 22:21:29 +000053echo "ARCH = $2" > config.mk
54echo "CPU = $3" >> config.mk
55echo "BOARD = $4" >> config.mk
wdenk7ebf7442002-11-02 23:17:16 +000056
wdenk1d9f4102004-10-09 22:21:29 +000057[ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
58
59[ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk
wdenk7ebf7442002-11-02 23:17:16 +000060
61#
62# Create board specific header file
63#
64if [ "$APPEND" = "yes" ] # Append to existing config file
65then
66 echo >> config.h
67else
68 > config.h # Create new config file
69fi
70echo "/* Automatically generated - do not edit */" >>config.h
71echo "#include <configs/$1.h>" >>config.h
72
73exit 0