From patchwork Wed Nov 16 03:23:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Hope X-Patchwork-Id: 5163 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 505B623E0C for ; Wed, 16 Nov 2011 03:23:30 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 256ACA1830C for ; Wed, 16 Nov 2011 03:23:30 +0000 (UTC) Received: by faaa26 with SMTP id a26so1599309faa.11 for ; Tue, 15 Nov 2011 19:23:30 -0800 (PST) Received: by 10.152.134.116 with SMTP id pj20mr19090194lab.5.1321413809448; Tue, 15 Nov 2011 19:23:29 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.41.198 with SMTP id h6cs67061lal; Tue, 15 Nov 2011 19:23:29 -0800 (PST) Received: by 10.220.150.141 with SMTP id y13mr3177898vcv.196.1321413806806; Tue, 15 Nov 2011 19:23:26 -0800 (PST) Received: from snapmx1.ironport.snap.net.nz (snapmx1.ironport.snap.net.nz. [202.37.100.100]) by mx.google.com with ESMTP id fj3si6237752vcb.93.2011.11.15.19.23.25; Tue, 15 Nov 2011 19:23:26 -0800 (PST) Received-SPF: neutral (google.com: 202.37.100.100 is neither permitted nor denied by best guess record for domain of michael.hope@linaro.org) client-ip=202.37.100.100; Authentication-Results: mx.google.com; spf=neutral (google.com: 202.37.100.100 is neither permitted nor denied by best guess record for domain of michael.hope@linaro.org) smtp.mail=michael.hope@linaro.org X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAEssw057/y/M/2dsb2JhbABDqXKCeT8/LQ8VHzoUE8EeihcEmW+MVw X-IronPort-AV: E=Sophos;i="4.69,518,1315137600"; d="scan'208";a="81544455" Received: from rupert.snap.net.nz ([202.37.100.140]) by smtp1.ironport.snap.net.nz with ESMTP; 16 Nov 2011 16:23:23 +1300 X-Sender-IP: 123.255.47.204 X-Sender-IP: 123.255.47.204 X-Sender-IP: 123.255.47.204 Received: from [127.0.1.1] (204.47.255.123.static.snap.net.nz [123.255.47.204]) by rupert.snap.net.nz (Postfix) with ESMTPS id DB8571FD3A; Wed, 16 Nov 2011 16:23:23 +1300 (NZDT) MIME-Version: 1.0 Subject: [PATCH] scripts: add support for a pre-built sysroot X-Mercurial-Node: 1c30b090c664d9ca063f1c1d0926d49f512c3a14 Message-Id: <1c30b090c664d9ca063f.1321413798@crucis> User-Agent: Mercurial-patchbomb/1.7.5 Date: Wed, 16 Nov 2011 16:23:18 +1300 From: Michael Hope To: "Yann E. MORIN" Cc: crossgcc@sourceware.org, patches@linaro.org # HG changeset patch # User Michael Hope # Date 1321413746 -46800 # Branch prebuilt-sysroot-2 # Node ID 1c30b090c664d9ca063f1c1d0926d49f512c3a14 # Parent c6d10ee4ab25a8b0547b69e9a101d856d3b951a1 scripts: add support for a pre-built sysroot. Useful when building a compiler that targets an existing system such as Ubuntu or Debian. Fetches a tarball that contains the libc libraries, libc headers, and kernel headers and uses that as the sysroot. Assumes the libc is GLIBC-like and the kernel is Linux-like. Adds a new libc option called 'prebuilt'. Adds a new kernel option called 'prebuilt'. Messy: I haven't scattered 'depends ! PREBUILT_SYSROOT' across the config files. It's possible to configure something inconsistent. For discussion. I'm happy to keep this in our own tree. Signed-off-by: Michael Hope diff -r c6d10ee4ab25 -r 1c30b090c664 config/kernel/prebuilt.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/kernel/prebuilt.in Wed Nov 16 16:22:26 2011 +1300 @@ -0,0 +1,8 @@ +# Prebuilt Linux kernel options + +## depends on PREBUILT_SYSROOT +## +## select KERNEL_SUPPORTS_SHARED_LIBS +## +## help Build a toolchain targeting systems running Linux as a kernel. +## \ No newline at end of file diff -r c6d10ee4ab25 -r 1c30b090c664 config/libc/prebuilt.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/libc/prebuilt.in Wed Nov 16 16:22:26 2011 +1300 @@ -0,0 +1,8 @@ +# Prebuilt libc options + +## depends on PREBUILT_SYSROOT +## +## select LIBC_SUPPORT_NPTL +## +## help Use the EGLIBC/GLIBC from the prebuilt sysroot. +## diff -r c6d10ee4ab25 -r 1c30b090c664 config/toolchain.in --- a/config/toolchain.in Mon Nov 14 13:29:12 2011 +0100 +++ b/config/toolchain.in Wed Nov 16 16:22:26 2011 +1300 @@ -17,6 +17,28 @@ You definitely want to say 'Y' here. Yes you do. I know you do. Say 'Y'. +config PREBUILT_SYSROOT + bool + depends on USE_SYSROOT + prompt "Use a pre-built sysroot" + help + A pre-built sysroot contains the headers and libraries that were + built elsewhere for the target system. Useful when building + a compiler that targets an existing distribution like Debian or + Ubuntu. + +config PREBUILT_NAME + string + prompt "Pre-built sysroot name" + depends on PREBUILT_SYSROOT + help + Base name of the pre-built sysroot without the URL or extension. + +config PREBUILT_BASE_URL + string + prompt "Pre-built sysroot base URL" + depends on PREBUILT_SYSROOT + config SYSROOT_NAME string prompt "sysroot directory name" if ! BACKEND diff -r c6d10ee4ab25 -r 1c30b090c664 scripts/build/arch/arm.sh --- a/scripts/build/arch/arm.sh Mon Nov 14 13:29:12 2011 +0100 +++ b/scripts/build/arch/arm.sh Wed Nov 16 16:22:26 2011 +1300 @@ -7,6 +7,7 @@ # The system part of the tuple: case "${CT_LIBC},${CT_ARCH_ARM_EABI}" in *glibc,y) CT_TARGET_SYS=gnueabi;; + prebuilt,y) CT_TARGET_SYS=gnueabi;; uClibc,y) CT_TARGET_SYS=uclibcgnueabi;; *,y) CT_TARGET_SYS=eabi;; esac diff -r c6d10ee4ab25 -r 1c30b090c664 scripts/build/kernel/prebuilt.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/build/kernel/prebuilt.sh Wed Nov 16 16:22:26 2011 +1300 @@ -0,0 +1,19 @@ +# This file declares functions for pre-built Linux kernel +# Copyright 2011 Linaro Limited +# Licensed under the GPL v2. See COPYING in the root of this package + +CT_DoKernelTupleValues() { + CT_TARGET_KERNEL="linux" +} + +do_kernel_get() { + : +} + +do_kernel_extract() { + : +} + +do_kernel_headers() { + : +} diff -r c6d10ee4ab25 -r 1c30b090c664 scripts/build/libc/prebuilt.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/build/libc/prebuilt.sh Wed Nov 16 16:22:26 2011 +1300 @@ -0,0 +1,32 @@ +# This file adds functions to fetch and use a prebuilt sysroot. +# Copyright 2011 Linaro Limited +# Licensed under the GPL v2. See COPYING in the root of this package + +do_libc_get() { + CT_DoLog DEBUG "Fetching ${CT_PREBUILT_NAME}" + CT_GetFile "${CT_PREBUILT_NAME}" "${CT_PREBUILT_BASE_URL}" + + return 0 +} + +do_libc_extract() { + CT_Extract "${CT_PREBUILT_NAME}" +} + +do_libc_check_config() { + : +} + +do_libc_start_files() { + # do_kernel_headers has already run + CT_DoLog EXTRA "Installing the pre-built sysroot" + CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/${CT_PREBUILT_NAME}"/* "${CT_SYSROOT_DIR}" +} + +do_libc() { + : +} + +do_libc_finish() { + : +} diff -r c6d10ee4ab25 -r 1c30b090c664 scripts/functions --- a/scripts/functions Mon Nov 14 13:29:12 2011 +0100 +++ b/scripts/functions Wed Nov 16 16:22:26 2011 +1300 @@ -971,6 +971,7 @@ # by architecture-specific values. case "${CT_LIBC}" in *glibc) CT_TARGET_SYS=gnu;; + prebuilt) CT_TARGET_SYS=gnu;; uClibc) CT_TARGET_SYS=uclibc;; *) CT_TARGET_SYS=elf;; esac