2011-05-22 00:18:59 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# This file is part of the coreboot project.
|
|
|
|
#
|
|
|
|
# Copyright (C) 2011 Patrick Georgi <patrick@georgi-clan.de>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
#
|
|
|
|
# DESCR: Check that build directories can be chosen freely
|
|
|
|
|
|
|
|
# $1: command to test for GNU make
|
|
|
|
search_make() {
|
Make the device tree available in the rom stage
We thought about two ways to do this change. The way we decided to try
was to
1. drop all ops from devices in romstage
2. constify all devices in romstage (make them read-only) so we can
compile static.c into romstage
3. the device tree "devices" can be used to read configuration from
the device tree (and nothing else, really)
4. the device tree devices are accessed through struct device * in
romstage only. device_t stays the typedef to int in romstage
5. Use the same static.c file in ramstage and romstage
We declare structs as follows:
ROMSTAGE_CONST struct bus dev_root_links[];
ROMSTAGE_CONST is const in romstage and empty in ramstage; This
forces all of the device tree into the text area.
So a struct looks like this:
static ROMSTAGE_CONST struct device _dev21 = {
#ifndef __PRE_RAM__
.ops = 0,
#endif
.bus = &_dev7_links[0],
.path = {.type=DEVICE_PATH_PCI,{.pci={ .devfn = PCI_DEVFN(0x1c,3)}}},
.enabled = 0,
.on_mainboard = 1,
.subsystem_vendor = 0x1ae0,
.subsystem_device = 0xc000,
.link_list = NULL,
.sibling = &_dev22,
#ifndef __PRE_RAM__
.chip_ops = &southbridge_intel_bd82x6x_ops,
#endif
.chip_info = &southbridge_intel_bd82x6x_info_10,
.next=&_dev22
};
Change-Id: I722454d8d3c40baf7df989f5a6891f6ba7db5727
Signed-off-by: Ronald G. Minnich <rminnich@chromium.org>
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/1398
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2012-08-01 01:47:25 +02:00
|
|
|
if [ -n "`$1 --version 2>&1 | grep GNU`" ]; then MAKE=$1; fi
|
2011-05-22 00:18:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# if $1 and $2 differ, exit with failure
|
|
|
|
compare_output() {
|
|
|
|
if ! [ "$1" = "$2" ]; then
|
|
|
|
echo \'$1\' should be \'$2\'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1: object directory
|
|
|
|
run_printall() {
|
Make the device tree available in the rom stage
We thought about two ways to do this change. The way we decided to try
was to
1. drop all ops from devices in romstage
2. constify all devices in romstage (make them read-only) so we can
compile static.c into romstage
3. the device tree "devices" can be used to read configuration from
the device tree (and nothing else, really)
4. the device tree devices are accessed through struct device * in
romstage only. device_t stays the typedef to int in romstage
5. Use the same static.c file in ramstage and romstage
We declare structs as follows:
ROMSTAGE_CONST struct bus dev_root_links[];
ROMSTAGE_CONST is const in romstage and empty in ramstage; This
forces all of the device tree into the text area.
So a struct looks like this:
static ROMSTAGE_CONST struct device _dev21 = {
#ifndef __PRE_RAM__
.ops = 0,
#endif
.bus = &_dev7_links[0],
.path = {.type=DEVICE_PATH_PCI,{.pci={ .devfn = PCI_DEVFN(0x1c,3)}}},
.enabled = 0,
.on_mainboard = 1,
.subsystem_vendor = 0x1ae0,
.subsystem_device = 0xc000,
.link_list = NULL,
.sibling = &_dev22,
#ifndef __PRE_RAM__
.chip_ops = &southbridge_intel_bd82x6x_ops,
#endif
.chip_info = &southbridge_intel_bd82x6x_info_10,
.next=&_dev22
};
Change-Id: I722454d8d3c40baf7df989f5a6891f6ba7db5727
Signed-off-by: Ronald G. Minnich <rminnich@chromium.org>
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/1398
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2012-08-01 01:47:25 +02:00
|
|
|
$MAKE CONFIG_USE_BLOBS=n CONFIG_CCACHE=n CONFIG_SCANBUILD_ENABLE=n NOMKDIR=1 \
|
|
|
|
DOTCONFIG=$TMPCONFIG obj=$1 printall | \
|
|
|
|
sed -e "s,^ *,," -e "s,^r.mstage-objs:=,," \
|
|
|
|
-e "s,mainboard/[^/]*/[^/]*/,.../,g" | \
|
2012-09-17 10:38:22 +02:00
|
|
|
tr " " "\n" | GREP_OPTIONS= grep "/static.*\.[co]" | sort | \
|
Make the device tree available in the rom stage
We thought about two ways to do this change. The way we decided to try
was to
1. drop all ops from devices in romstage
2. constify all devices in romstage (make them read-only) so we can
compile static.c into romstage
3. the device tree "devices" can be used to read configuration from
the device tree (and nothing else, really)
4. the device tree devices are accessed through struct device * in
romstage only. device_t stays the typedef to int in romstage
5. Use the same static.c file in ramstage and romstage
We declare structs as follows:
ROMSTAGE_CONST struct bus dev_root_links[];
ROMSTAGE_CONST is const in romstage and empty in ramstage; This
forces all of the device tree into the text area.
So a struct looks like this:
static ROMSTAGE_CONST struct device _dev21 = {
#ifndef __PRE_RAM__
.ops = 0,
#endif
.bus = &_dev7_links[0],
.path = {.type=DEVICE_PATH_PCI,{.pci={ .devfn = PCI_DEVFN(0x1c,3)}}},
.enabled = 0,
.on_mainboard = 1,
.subsystem_vendor = 0x1ae0,
.subsystem_device = 0xc000,
.link_list = NULL,
.sibling = &_dev22,
#ifndef __PRE_RAM__
.chip_ops = &southbridge_intel_bd82x6x_ops,
#endif
.chip_info = &southbridge_intel_bd82x6x_info_10,
.next=&_dev22
};
Change-Id: I722454d8d3c40baf7df989f5a6891f6ba7db5727
Signed-off-by: Ronald G. Minnich <rminnich@chromium.org>
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/1398
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2012-08-01 01:47:25 +02:00
|
|
|
tr '\012\015' ' ' | sed -e "s, *, ,g" -e "s, *$,,"
|
2011-05-22 00:18:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# find GNU make
|
2012-09-28 14:13:19 +02:00
|
|
|
MAKE=
|
2011-05-22 00:18:59 +02:00
|
|
|
search_make make
|
2012-09-28 14:13:19 +02:00
|
|
|
[ -z $MAKE ] && search_make gmake
|
|
|
|
[ -z $MAKE ] && search_make gnumake
|
2011-05-22 00:18:59 +02:00
|
|
|
|
|
|
|
if [ "$MAKE" = "" ]; then
|
|
|
|
echo Could not identify GNU make
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# prepare a config to use
|
2013-07-02 16:39:28 +02:00
|
|
|
TMPOBJ=`mktemp .tmpobj.XXXXXX`
|
|
|
|
rm $TMPOBJ
|
|
|
|
mkdir -p ${TMPOBJ}
|
2012-02-25 15:33:43 +01:00
|
|
|
TMPCONFIG=`mktemp .tmpconfig.XXXXXX`
|
2011-05-22 00:18:59 +02:00
|
|
|
rm -f $TMPCONFIG
|
2013-07-02 16:39:28 +02:00
|
|
|
$MAKE obj=$TMPOBJ DOTCONFIG=$TMPCONFIG allyesconfig >/dev/null
|
2011-05-22 00:18:59 +02:00
|
|
|
|
|
|
|
# look up parent directory
|
2012-09-28 14:14:38 +02:00
|
|
|
CURRENTDIR=`pwd -P`
|
|
|
|
PARENTDIR=`dirname $CURRENTDIR`
|
2011-05-22 00:18:59 +02:00
|
|
|
|
2012-11-25 17:10:47 +01:00
|
|
|
compare_output "`run_printall build`" "build/.../static.c build/.../static.c build/.../static.romstage.o"
|
|
|
|
compare_output "`run_printall ../obj`" "$PARENTDIR/obj/.../static.c $PARENTDIR/obj/.../static.c $PARENTDIR/obj/.../static.romstage.o"
|
|
|
|
compare_output "`run_printall /tmp`" "/tmp/.../static.c /tmp/.../static.c /tmp/.../static.romstage.o"
|
|
|
|
compare_output "`run_printall /../tmp`" "/tmp/.../static.c /tmp/.../static.c /tmp/.../static.romstage.o"
|
2011-05-22 00:18:59 +02:00
|
|
|
|
2013-07-02 16:39:28 +02:00
|
|
|
rm -rf $TMPCONFIG $TMPOBJ
|
2011-05-22 00:18:59 +02:00
|
|
|
|