Re: building in 32bit chroot on x86_64 host broken

From: Theodore Y. Ts'o
Date: Sat Jun 09 2018 - 12:49:39 EST


On Sat, Jun 09, 2018 at 09:23:55PM +0900, Masahiro Yamada wrote:
> Just a note.
>
> In case of cross-compiling, not only ARCH but also CROSS_COMPILE
> must be passed when you do "make *config".

Sure, what was being discussed was people who build 32-bit x86 kernels
on a 64-bit platform. I do this occasionally to check and make sure
that 32-compat ioctl handling is working correctly, etc. I suspect
there are more developers setting just ARCH= and not CROSS_COMPILE
because they are building 32-bit x86 kernels (which can then be
trivially tested using qemu) than there are building cross-compiled
kernels for a completely different architecture.

I saw this thread and decided I didn't care because I use a standard
"kbuild32" script (I also have a "kbuild" script for building normal
64-bit kernels), and it always passes ARCH=i386.

- Ted

#!/bin/bash

N=$(getconf _NPROCESSORS_ONLN)

if test -f .git/kbuild/config ; then
. .git/kbuild/config
else
echo "Missing kbuild configuration file!"
exit 1
fi

if test ! -d "$BLD_DIR_32" ; then
mkdir -p "$BLD_DIR_32"
if test -f .git/kbuild/kernel-config ; then
cp .git/kbuild/kernel-config-32 "$BLD_DIR_32/.config"
fi
for i in x509.genkey signing_key.pem signing_key.x509
do
if test -f ".git/kbuild/$i" ; then
mkdir -p "$BLD_DIR_32/certs"
cp ".git/kbuild/$i" "$BLD_DIR_32/certs"
fi
done
fi

time nice make O="$BLD_DIR_32" ARCH=i386 -j$N $*

cp "$BLD_DIR_32/.config" .git/kbuild/kernel-config-32