From: Avri Altman <Avri.Altman@wdc.com>
To: Zhan Liu <zliua@micron.com>,
"'linux-mmc@vger.kernel.org'" <linux-mmc@vger.kernel.org>
Cc: 'Ulf Hansson' <ulf.hansson@linaro.org>
Subject: RE: [PATCH v1] mmc-utils:makefile: cross compile
Date: Sun, 14 Apr 2024 10:50:12 +0000 [thread overview]
Message-ID: <DM6PR04MB6575C1911A7D969708509A6AFC0A2@DM6PR04MB6575.namprd04.prod.outlook.com> (raw)
In-Reply-To: <BY5PR08MB62644DD78E097A0239ACA8E8CA042@BY5PR08MB6264.namprd08.prod.outlook.com>
Please resend as a text-only - patchwork doesn't capture HTML patches.
Also please remove the "Micron Confidential" notations.
Thanks,
Avri
From: Zhan Liu <zliua@micron.com>
Sent: Friday, April 12, 2024 6:12 PM
To: 'linux-mmc@vger.kernel.org' <linux-mmc@vger.kernel.org>
Cc: Avri Altman <Avri.Altman@wdc.com>; 'Ulf Hansson' <ulf.hansson@linaro.org>
Subject: [PATCH v1] mmc-utils:makefile: cross compile
CAUTION: This email originated from outside of Western Digital. Do not click on links or open attachments unless you recognize the sender and know that the content is safe.
Micron Confidential
[PATCH v1] mmc-utils: makefile: cross compile
From: Zhan Liu mailto:zliua@micron.com
Problem and my changes
Current makefile can only compile for local gcc (x86). Add cross compile so we can easily compile for other platform by doing "make ARCH=arm CROSS_GCC=/path/to/your/cross/compiler" .
---
Signed-off-by: Zhan Liu mailto:zliua@micron.com
---
diff --git a/Makefile b/Makefile
index a890833..fb7e30e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,19 @@
-CC ?= gcc
+ifneq ($(CROSS_GCC), )
+ifneq ($(ARCH), )
+GCC_DIR = $(dir $(CROSS_GCC))
+# To remove the trailing 'bin/' part
+GCC_DIR := $(patsubst %bin/,%, $(GCC_DIR))
+endif
+endif
+
+ifeq ($(ARCH), arm)
+CC = $(CROSS_GCC)gcc
+else #By default, we will build for X86 platform
+CC = gcc
+endif
+
+
+
GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)"
AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 \
-DVERSION=\"$(GIT_VERSION)\"
Micron Confidential
next prev parent reply other threads:[~2024-04-14 10:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BY5PR08MB6264AE3F237D7E11B9AEFBA4CA052@BY5PR08MB6264.namprd08.prod.outlook.com>
2024-04-12 8:20 ` [PATCH v1] mmc-utils: FFU Status check for device without FW install support Avri Altman
[not found] ` <BY5PR08MB62644DD78E097A0239ACA8E8CA042@BY5PR08MB6264.namprd08.prod.outlook.com>
2024-04-14 10:50 ` Avri Altman [this message]
2024-04-20 3:16 [PATCH v1] mmc-utils: makefile: cross compile Zhan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR04MB6575C1911A7D969708509A6AFC0A2@DM6PR04MB6575.namprd04.prod.outlook.com \
--to=avri.altman@wdc.com \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=zliua@micron.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).