From patchwork Mon Jul 25 06:01:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 652171 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ryVy03ZS7z9sR9 for ; Mon, 25 Jul 2016 16:01:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jms.id.au header.i=@jms.id.au header.b=al7Vpt1b; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CB6158A991; Mon, 25 Jul 2016 06:01:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r2ypNlkHj3Rk; Mon, 25 Jul 2016 06:01:40 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 738BB8A32A; Mon, 25 Jul 2016 06:01:40 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 58D741C0DFF for ; Mon, 25 Jul 2016 06:01:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 551FC8A32A for ; Mon, 25 Jul 2016 06:01:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3+QjPd++FUie for ; Mon, 25 Jul 2016 06:01:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by whitealder.osuosl.org (Postfix) with ESMTPS id 708CE8A125 for ; Mon, 25 Jul 2016 06:01:37 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id y134so11285476pfg.3 for ; Sun, 24 Jul 2016 23:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=from:to:subject:date:message-id; bh=saX1FurH4luXlVWGLQaV1/JycN4M49S5hdhf++aEjHE=; b=al7Vpt1bAZ9EPVAetPTddpagNlXKBFA4Mtz2fadoVR1C/WnHjLgFC1GDLiaE33QgU4 1p8tS4KNuHWh02B4Nfx1P6rgX3ghu3/Lo4BJiid7kqau65T8zlqPNm0Sx4PdCYGV0ZAm A4lkbkywpn7jSS0GH9VkzsFzw9LsUwcQ+cNFQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=saX1FurH4luXlVWGLQaV1/JycN4M49S5hdhf++aEjHE=; b=i9KDbZ8Ai8XRXP+xD8a0t+0gmJxwUhJmVbuXO15BW6b9meDOjsaKrM56Jjrb35jvkJ LHW8Tw1ykczHY6cVWaKazaWt/NEzLB9L40FWjqIy831uQjuDZXKTo2IZ0XMmjV2jNh4L oRdousoSIpj4aC5I60UoH2tcsrD6aOkk0W4ZJjnxlj9QXAbREj457s1JWSoyU+xjsq2A oG1hhNl6pvwQP8Dp1l9bKx2sweX6hdfkz8wSJL89tI939J5G8lWCpgwf34O4IhhIM2uV 5DUJPN7/LJfOi/90fOmc3yJlY0Uy0jqBCcwsIR8ZGOj7iAameFmkfA/Oqq/KgvRgIWqr hf1g== X-Gm-Message-State: AEkoouuXMMOUAvFKT7nOywJ7vX+6/WS3rULBwayurH6ak1LBc9uB/z10c1jJxGaXi35Rpg== X-Received: by 10.98.54.134 with SMTP id d128mr26660565pfa.150.1469426496460; Sun, 24 Jul 2016 23:01:36 -0700 (PDT) Received: from aurora.ibm.com ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id 89sm36543332pft.96.2016.07.24.23.01.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Jul 2016 23:01:35 -0700 (PDT) From: Joel Stanley To: buildroot@buildroot.net Date: Mon, 25 Jul 2016 15:31:27 +0930 Message-Id: <1469426487-19558-1-git-send-email-joel@jms.id.au> X-Mailer: git-send-email 2.8.1 Subject: [Buildroot] [PATCH] package/pflash: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" pflash is a tool for reading and writing to the PNOR on OpenPower servers, for firmware upgrades, and extracting diagnostic information. This includes a fix so that pflash can build with musl, which has been submitted upstream[1]. [1] http://patchwork.ozlabs.org/patch/652168/ Signed-off-by: Joel Stanley --- package/Config.in | 1 + ...-pflash-use-atexit-for-musl-compatibility.patch | 42 ++++++++++++++++++++++ package/pflash/Config.in | 6 ++++ package/pflash/pflash.mk | 32 +++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch create mode 100644 package/pflash/Config.in create mode 100644 package/pflash/pflash.mk diff --git a/package/Config.in b/package/Config.in index 814141f18784..9f873c31fa58 100644 --- a/package/Config.in +++ b/package/Config.in @@ -426,6 +426,7 @@ endmenu source "package/owl-linux/Config.in" source "package/parted/Config.in" source "package/pciutils/Config.in" + source "package/pflash/Config.in" source "package/picocom/Config.in" source "package/pifmrds/Config.in" source "package/powertop/Config.in" diff --git a/package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch b/package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch new file mode 100644 index 000000000000..f8ac58eba329 --- /dev/null +++ b/package/pflash/0001-pflash-use-atexit-for-musl-compatibility.patch @@ -0,0 +1,42 @@ +From 7f6b017b8dc3b5f276b30353e0a7186e4e433e7a Mon Sep 17 00:00:00 2001 +From: Joel Stanley +Date: Mon, 25 Jul 2016 13:24:37 +0930 +Subject: [PATCH] pflash: use atexit for musl compatibility +To: skiboot@lists.ozlabs.org + +I accidentally built myself a cross-toolchain with the musl libc. It does +not support on_exit which we use to clean up in pflash. + +Instead use atexit with is supported by both uclibc, musl and glibc. + +Signed-off-by: Joel Stanley +--- + external/pflash/pflash.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c +index c124356fd3d9..27000469052e 100644 +--- a/external/pflash/pflash.c ++++ b/external/pflash/pflash.c +@@ -509,7 +509,7 @@ static void print_help(const char *pname) + printf("\t\tThis message.\n\n"); + } + +-void exiting(int d, void *p) ++void exiting(void) + { + if (need_relock) + arch_flash_set_wrprotect(bl, 1); +@@ -775,8 +775,7 @@ int main(int argc, char *argv[]) + exit(1); + } + +- on_exit(exiting, NULL); +- ++ atexit(exiting); + + rc = blocklevel_get_info(bl, &fl_name, + &fl_total_size, &fl_erase_granule); +-- +2.8.1 + diff --git a/package/pflash/Config.in b/package/pflash/Config.in new file mode 100644 index 000000000000..315989724088 --- /dev/null +++ b/package/pflash/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_PFLASH + bool "pflash" + depends on BR2_arm || BR2_powerpc64 || BR2_powerpc64le || BR2_x86_64 + help + PNOR Flash reading and writing tool for OpenPower servers. Used for + firmware upgrades and extracting diagnostic infromation from flash. diff --git a/package/pflash/pflash.mk b/package/pflash/pflash.mk new file mode 100644 index 000000000000..ab19ad699866 --- /dev/null +++ b/package/pflash/pflash.mk @@ -0,0 +1,32 @@ +################################################################################ +# +# pflash +# +################################################################################ + +PFLASH_VERSION = skiboot-5.2.4 + +PFLASH_SITE = $(call github,open-power,skiboot,$(PFLASH_VERSION)) +PFLASH_INSTALL_STAGING = YES +PFLASH_LICENSE = Apache 2.0 +PFLASH_LICENSE_FILE = LICENCE + +PFLASH_MAKE_OPTS += CROSS_COMPILE="$(TARGET_CROSS)" \ + PFLASH_VERSION=$(PFLASH_VERSION) \ + DESTDIR=$(TARGET_DIR) \ + -C $(@D)/external/pflash \ + +# A makefile bug causes recent versions of pflash to fail setting CC and LD +# based on CROSS_COMPILE. Set CC and LD to remain compatible with those +# versions. +PFLASH_MAKE_OPTS += CC=$(TARGET_CC) LD=$(TARGET_LD) + +define PFLASH_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) $(PFLASH_MAKE_OPTS) all +endef + +define PFLASH_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) $(PFLASH_MAKE_OPTS) install +endef + +$(eval $(generic-package))