From patchwork Tue Oct 27 14:01:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 1388617 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rockwellcollins.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rockwellcollins.com header.i=@rockwellcollins.com header.a=rsa-sha256 header.s=hrcrc2020 header.b=N4lMKt9j; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CLD0V3FCjz9sSW for ; Wed, 28 Oct 2020 01:02:02 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 762C0872CF; Tue, 27 Oct 2020 14:01:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ufCbHam++vg3; Tue, 27 Oct 2020 14:01:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id DA1BF870E0; Tue, 27 Oct 2020 14:01:57 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id AD7291BF328 for ; Tue, 27 Oct 2020 14:01:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A2DDE20353 for ; Tue, 27 Oct 2020 14:01:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0bjWmBMjE5qq for ; Tue, 27 Oct 2020 14:01:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ch3vs05.rockwellcollins.com (ch3vs05.rockwellcollins.com [205.175.226.130]) by silver.osuosl.org (Postfix) with ESMTPS id 747C62034B for ; Tue, 27 Oct 2020 14:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rockwellcollins.com; s=hrcrc2020; h=from:to:cc:subject:date:message-id; bh=6ItCuQHmWQbPZUCZW4f56qGgd0mvmagpq+wnMRcnr7U=; b=N4lMKt9j5qVUmXzMkCyFU9/NTQZp8dxPH9+4mezP5vSmcfb4zXk1dbUo kT5FZSMEt4h90o8Eb2Fa9T9/tBL7nShyDScf0TxrKlwJiaSvPWiz7/UyW yHtYe1FTEFD7Dd1D+alWUdRkWvPpTNvULLC3Qk+irLAIh7UKxfK1EF3XX JvF8yJEFDbhmRS3DsHDBQvzSsMGtK7qdEDOQSlIOVPLXq6q55TKlT52/S V4HeaO5DsN0TQJWV6P0r4lE9325Oe6RF5BllZcXZ3zD/xPVSKtWhwCiVl NDAg7el8U76zM1qApkryJy8+WfKlr0hj75uXPZoNeqUAZx6BLMe1QUYmb Q==; IronPort-SDR: 5rO5BU85kDgMLHYu9ejeA71JlHlhiDCJaFy3ydQyMFG6/lJv4pQDi2bGyxJCz4ryoBOknK56n4 BSjsfZTnA5U+6zm1sDkc/gXSRNk0be40GP8y5qmsel4ki9T5XzLsjjSz6PSVQjYx0dMxxs+DrG vv+Ed1AFDguyBNwGOcwKM74d6RWxzYz+memkDm5E3QcKK+T8FvSuhZNU5+8Jzfre61JAKeQo9U TQHHOV+/LfOwwK/TY93/nuhNWypdi7ddJpGCp8h+/rfVZgMtpOjZ+j1m9d2gJdweLCVotcUfbh Uq8= Received: from ofwch3n02.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.226.14]) by ch3vs05.rockwellcollins.com with ESMTP; 27 Oct 2020 09:01:42 -0500 X-Received: from biscuits.rockwellcollins.com (biscuits.rockwellcollins.lab [10.148.119.137]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id 66FF420052; Tue, 27 Oct 2020 09:01:41 -0500 (CDT) From: Matt Weber To: buildroot@buildroot.org Date: Tue, 27 Oct 2020 09:01:40 -0500 Message-Id: <20201027140140.47982-1-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH] package/environment-setup: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , Maury Anderson , Angelo Compagnucci , Angelo Compagnucci MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Angelo Compagnucci Install an helper script to setup a build environment based on buildroot. It's useful when a developer wants to use a buildroot generated sdk to build an external project. Signed-off-by: Angelo Compagnucci Tested-by: Michael Trimarchi Tested-by: Adam Duskett Signed-off-by: Maury Anderson Signed-off-by: Matt Weber --- Reviving a patch from this series. http://patchwork.ozlabs.org/project/buildroot/patch/1588085161-28104-1-git-send-email-angelo@amarulasolutions.com/ Changes v6 -> new v1 (Maury) - Adjusted host tool naming in menuconfig to be prefixed with "host " --- docs/manual/using-buildroot-toolchain.txt | 8 +++++ package/Config.in.host | 1 + package/environment-setup/Config.in.host | 6 ++++ package/environment-setup/environment-setup | 16 +++++++++ .../environment-setup/environment-setup.mk | 34 +++++++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 package/environment-setup/Config.in.host create mode 100644 package/environment-setup/environment-setup create mode 100644 package/environment-setup/environment-setup.mk diff --git a/docs/manual/using-buildroot-toolchain.txt b/docs/manual/using-buildroot-toolchain.txt index 0c0c35fced..98dae6cdcc 100644 --- a/docs/manual/using-buildroot-toolchain.txt +++ b/docs/manual/using-buildroot-toolchain.txt @@ -27,6 +27,14 @@ Upon extracting the SDK tarball, the user must run the script +relocate-sdk.sh+ (located at the top directory of the SDK), to make sure all paths are updated with the new location. +For your convenience, by selecting the host package +BR2_PACKAGE_HOST_ENVIRONMENT_SETUP, you can have a +setup-environment+ script +installed in +output/host/+. +This script can be sourced with +. your/sdk/path/environment-setup+ to launch +the buildroot shell. Inside this shell, you will find an environment already +set up with the correct PATH and the complete list of +target configure +options+. + Alternatively, if you just want to prepare the SDK without generating the tarball (e.g. because you will just be moving the +host+ directory, or will be generating the tarball on your own), Buildroot also allows diff --git a/package/Config.in.host b/package/Config.in.host index 546f1c226d..c69c756f3a 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -19,6 +19,7 @@ menu "Host utilities" source "package/dtc/Config.in.host" source "package/e2fsprogs/Config.in.host" source "package/e2tools/Config.in.host" + source "package/environment-setup/Config.in.host" source "package/erofs-utils/Config.in.host" source "package/eudev/Config.in.host" source "package/exfatprogs/Config.in.host" diff --git a/package/environment-setup/Config.in.host b/package/environment-setup/Config.in.host new file mode 100644 index 0000000000..d3604525a5 --- /dev/null +++ b/package/environment-setup/Config.in.host @@ -0,0 +1,6 @@ +config BR2_PACKAGE_HOST_ENVIRONMENT_SETUP + bool "host environment setup" + help + Install an helper script to setup a build environment + based on buildroot. It's useful when you export an sdk + and want to use buildroot to build an external project diff --git a/package/environment-setup/environment-setup b/package/environment-setup/environment-setup new file mode 100644 index 0000000000..b48f1979d6 --- /dev/null +++ b/package/environment-setup/environment-setup @@ -0,0 +1,16 @@ +cat <<'EOF' + _ _ _ _ _ +| |__ _ _(_) | __| |_ __ ___ ___ | |_ +| '_ \| | | | | |/ _` | '__/ _ \ / _ \| __| +| |_) | |_| | | | (_| | | | (_) | (_) | |_ +|_.__/ \__,_|_|_|\__,_|_| \___/ \___/ \__| shell + + Making embedded Linux easy! + +Some tips: +* PATH is now pointing to the HOST_DIR path +* Target configure options are already exported +* To configure do "./configure $CONFIGURE_FLAGS" + +EOF +SDK_PATH=$(dirname $(realpath "${BASH_SOURCE[0]}")) diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk new file mode 100644 index 0000000000..6d2396f8f1 --- /dev/null +++ b/package/environment-setup/environment-setup.mk @@ -0,0 +1,34 @@ +################################################################################ +# +# environment-setup +# +################################################################################ + +ENVIRONMENT_SETUP_FILE = $(HOST_DIR)/environment-setup +ENVIRONMENT_SETUP_HOST_DIR_SED_EXP = 's+$(HOST_DIR)+\$$SDK_PATH+g' +ENVIRONMENT_SETUP_HOST_BIN_DIR_SED_EXP = 's+$(HOST_DIR)/bin/++g' + +define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS + cp package/environment-setup/environment-setup $(ENVIRONMENT_SETUP_FILE) + for var in $(TARGET_CONFIGURE_OPTS); do \ + printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \ + done + printf "export \"CROSS_COMPILE=$(TARGET_CROSS)\"\n" >> $(ENVIRONMENT_SETUP_FILE) + printf "export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --program-prefix=\"\n" >> $(ENVIRONMENT_SETUP_FILE) + $(SED) $(ENVIRONMENT_SETUP_HOST_BIN_DIR_SED_EXP) \ + -e $(ENVIRONMENT_SETUP_HOST_DIR_SED_EXP) \ + -e '/^export "PATH=/c\' \ + $(ENVIRONMENT_SETUP_FILE) + printf "export \"PATH=\$$SDK_PATH/bin:\$$SDK_PATH/sbin:\$$PATH\"\n" \ + >> $(ENVIRONMENT_SETUP_FILE) + +endef + +$(eval $(host-generic-package))