Skip to content

Commit ec15328

Browse files
Configure Linux out of source tree
That will make sure that we will not leave source directory in configured state, so other users who want to configure it out of tree will not get an error. If source directory already configured, then we use it as is. Signed-off-by: Anton Kolesov <[email protected]>
1 parent 02a347a commit ec15328

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2015-02-27 Anton Kolesov <[email protected]>
2+
3+
* build-uclibc.sh: Configure linux out of source tree.
4+
15
2015-02-27 Anton Kolesov <[email protected]>
26

37
* build-cleanup.sh: Refresh.

build-uclibc.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ echo "START ${ARC_ENDIAN}-endian uClibc: $(date)" | tee -a ${logfile}
205205
# Initalize, including getting the tool versions.
206206
. "${ARC_GNU}"/toolchain/arc-init.sh
207207
uclibc_build_dir="$(echo "${PWD}")"/uClibc
208-
linux_build_dir=${LINUXDIR}
208+
linux_src_dir=${LINUXDIR}
209+
linux_build_dir=$build_dir/linux
209210

210211
# If PDF docs are enabled, then check if prerequisites are satisfied.
211212
if [ "x${DO_PDF}" = "x--pdf" ]
@@ -243,14 +244,25 @@ mkdir -p "$build_dir"
243244
echo "Installing Linux headers ..." | tee -a "${logfile}"
244245
echo "============================" >> "${logfile}"
245246

246-
cd "${linux_build_dir}"
247-
248-
# Configure Linux if not already
247+
cd "${linux_src_dir}"
248+
249+
# It would be irresponsible for us to configure linux in source tree and leave
250+
# it at that, because if anybody else after that would try to configure/build
251+
# linux out-of-tree they will fail - Linux cannot configure out of tree when it
252+
# is already configured in tree. So we need to either clean configuration after
253+
# installing headers or just configure out of tree ourself. Second options
254+
# seems like more solid solution. However it will fail if Linux already has
255+
# been configured. Bam! In that case we just use Linux as-is. All of that is
256+
# mildly complex but this approach makes sure that this script is a friendly
257+
# neighbor and doesn't pollute in many places.
249258
if [ ! -f .config ]
250259
then
251-
if make ARCH=${arch} defconfig >> "${logfile}" 2>&1
260+
# Linux makefile expects this directory to exist.
261+
mkdir -p "$linux_build_dir"
262+
if make ARCH=arc defconfig O="$linux_build_dir" >> "${logfile}" 2>&1
252263
then
253264
echo " finished configuring Linux"
265+
cd "$linux_build_dir"
254266
else
255267
echo "ERROR: Linux configuration was not successful. Please"
256268
echo " see \"${logfile}\" for details."
@@ -260,7 +272,9 @@ else
260272
echo " Linux already configured"
261273
fi
262274

263-
if make ARCH=${arch} INSTALL_HDR_PATH=${SYSROOTDIR}/usr \
275+
# Wherever linux has been configured in or out of tree, at this stage we are in
276+
# the directory with .config file.
277+
if make ARCH=arc INSTALL_HDR_PATH=${SYSROOTDIR}/usr \
264278
headers_install >> "${logfile}" 2>&1
265279
then
266280
echo " finished installing Linux headers"

0 commit comments

Comments
 (0)