X-Original-To: alpine-devel@lists.alpinelinux.org Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by lists.alpinelinux.org (Postfix) with ESMTP id C1FD15C41B6 for ; Mon, 18 Jul 2016 05:40:45 +0000 (GMT) Received: by mail-lf0-f66.google.com with SMTP id l89so10547124lfi.2 for ; Sun, 17 Jul 2016 22:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2Hj5As/ROUbMzEh907Er27/w6jyewmeIw4GtLPiCc3E=; b=o17CzR7/mIlwvHRYGHxhJZOTlEvXFzReqgNguoXOJFgwrO0SGj0VRVGZiy95DP7f9i ar2MoZwfnb2FyyobRtRQ3coyGdUW4ylL4vhZ17hDp9uKHxqxXjl2H+bl9d7xpDEMfZY1 ecdTdw0gvBoDh3l2SuBk5NHB+qjs/K7nUNSfF+g3UxmxCZ6uf5czqOd/WfjF+Pgcj7yY dDB91s1Du04grdLAu4EC2eEwLmRsba3sBKaFdYquE0wMeAypbTfRAhvGLbqjShjJSe1K 00i6lLbcjNfvKMrUxL02D1kiKNlYH343T5jZ+pt1/v/9gssla43oMSEjV2cAUJphzYeF u6gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2Hj5As/ROUbMzEh907Er27/w6jyewmeIw4GtLPiCc3E=; b=C1//qRqfKbxLNQZgn2uV5JIDoRKCrNNDIRZAUyomsem41fN16arhG1PDRAGULbh+2+ iwXSsNJXV0x8tfmlYZAt5vSCILQUVmM8JZYBheeuL2DEL0IklQjQ6ly8Bs3nsSdsd8gI /85e5eJEdbB/PRZipSEgTocQ3C63qGm8mzrITin7wV2WF6hatJp+mxnn6Scb2NRBwOxr DIr9XqkB3T0cfnbfBTBV8kZA1AW2Qg5711b8vM32Al1E+riNPxqZo4Gu9NsbcfcH6BHq aMRJLd3MsHSiSs4ddYEm0zTO4H2QYZi+Hy+2GNFGFnZ1CLwN7DLQnxEtihUDS04KgxG0 iTIQ== X-Gm-Message-State: ALyK8tJJyIvMaSkcSoClaflreUVfucdhIsWlrgIMec5jKlm6qKAWs4aAffyeAk1ZPG1rzg== X-Received: by 10.25.147.200 with SMTP id v191mr15783848lfd.9.1468820444318; Sun, 17 Jul 2016 22:40:44 -0700 (PDT) Received: from vostro.util.wtbts.net ([2001:1bc8:101:f402:e66f:13ff:fef3:8cd0]) by smtp.gmail.com with ESMTPSA id g29sm4074170lji.45.2016.07.17.22.40.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Jul 2016 22:40:43 -0700 (PDT) Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= Date: Mon, 18 Jul 2016 08:40:38 +0300 From: Timo Teras To: "Tuan M. Hoang" Cc: "alpine-devel" Subject: Re: [alpine-devel] Porting Alpine scripts Message-ID: <20160718084038.23773fca@vostro.util.wtbts.net> In-Reply-To: <155f440c618.129c9f0aa5155.5728200182511575692@flatglobe.org> References: <155a8e57d76.f37920c130996.6728092923369604578@flatglobe.org> <20160703225319.0ce46f62@vostro> <155b28d7dfa.ca28fe6d67425.5841089419777612642@flatglobe.org> <20160705172656.788ec089@vostro.util.wtbts.net> <20160706172836.74bab5d1@vostro> <155e6497a8e.11ad265cf269464.7355344611305011615@flatglobe.org> <155f440c618.129c9f0aa5155.5728200182511575692@flatglobe.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.28; x86_64-alpine-linux-musl) X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 16 Jul 2016 22:08:53 +0700 "Tuan M. Hoang" wrote: > I have successfully built armv7 cross-toolchain using > createcross-toolchain.sh. Nice. > About crossbuild-alpine-bootstrap.sh, I have 2 questions: > > 1. At cross-building busybox (in the for loop), there was an error of > missing linux/kd.h header, even though /usr/include/linux/kd.h is > present in my Alpine build machine. So I have to install the newly > cross-built linux-headers package from previous loop, like this: > > diff --git a/crossbuild-alpine-bootstrap.sh > b/crossbuild-alpine-bootstrap.sh --- a/crossbuild-alpine-bootstrap.sh > +++ b/crossbuild-alpine-bootstrap.sh > @@ -1,6 +1,6 @@ > #!/bin/sh > > -TARGET_ARCH=aarch64 > +export TARGET_ARCH=armv7 > > export > ABUILD_CREATECROSS_CONF=$PWD/abuild-createcross-$TARGET_ARCH.conf > export ABUILD_CONF=$PWD/abuild-crossbuild-$TARGET_ARCH.conf @@ -47,6 > +47,10 @@ for PKG in linux-headers musl libc-dev \ cd > $APORTS/main/$PKG BOOTSTRAP=bootimage abuild -r || exit 1 > > + if [ "$PKG" = "linux-headers" ]; then > + ${SUDO_APK} -u --root "$CBUILDROOT" --repository > "$REPODEST_TARGET/main" --arch "$TARGET_ARCH" add linux-headers | > exit 1 > + fi > + > if [ "$PKG" = "libc-dev" ]; then > # install libc-dev, as implicit but mandatory > dependency ${SUDO_APK} -u --root "$CBUILDROOT" add libc-dev || exit 1 > > How about your procedures? busybox apkbuild has: makedepends_host="linux-headers" So when cross building abuild should have automatically installed this for you. It does it for me. > 2. At cross-building binutils step, I have the error : > > ./a.out: cannot execute binary file: Exec format error > > I checked the configure log (http://pastebin.com/t9QS9DZZ) and it > looks like the build, host, target machines are all > 'armv7-alpine-linux-muslgnueabihf', which is incorrect I guess. I > think the build machine should be 'x86_64-alpine-linux-musl' because > we are using a cross-compiler running on x86_64 targeting armv7. So > from its point of view, the build machine is x86_64, it builds > program to run on host machine (armv7), and I am not really sure what > to pass as target machine, maybe armv7 too. > > If I try to pass to binutils configure script with > '--build=x86_64-alpine-linux-musl > --host=armv7-alpine-linux-muslgnueabihf > --target=armv7-alpine-linux-muslgnueabihf ' then it configure and > build just fine. > > Doing the same strategy with make, it failed. > > What do you think ? Sounds like you figured out the root of the problem. CBUILD needs to be the build host's triplet, or things will not work. Usually it is configured in /etc/abuild.conf, and that's what my scripts expect. E.g. my abuild-crossbuild-armv7.conf has: # inherit CBUILD, and other basic defines source /etc/abuild.conf It expects CBUILD= to be in /etc/abuild.conf. This is also used by abuild to deduce if cross building or not, and probably caused the problem #1 too. > 3. I am curious about CBUILD variable. Where is it defined? Can't > find in your script nor (any) APKBUILD nor APKBUILD reference > documentation/webpage. In cross-building binutils case, it is set to > 'armv7-alpine-linux-muslgnueabihf', same as CHOST. See above. > By the way, your work is beautiful. Thank you. We managed to bootstrap aarch64 recently. We have it running on qemu and on real hw too. I believe when it comes up, it could be used for aarch64 and possibly armv7 builds. /Timo --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---