Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp786070rwb; Sat, 5 Aug 2023 00:39:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF87UmloLmuu5PH8RiIxQ/Lm1hve36frNznis+TfU9lbser+VpRT4WuykVpGv3KZDKUtIx1 X-Received: by 2002:a05:6a20:72ac:b0:13c:9869:1aba with SMTP id o44-20020a056a2072ac00b0013c98691abamr5116365pzk.45.1691221148540; Sat, 05 Aug 2023 00:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691221148; cv=none; d=google.com; s=arc-20160816; b=j72ZmQFB+xMf4BffW7j+WnxuJ5Rct4KSlaXnumKoCb3THS0pWRbodhTplpHFo5hCqn sgkJyZhC8ZNokr7GIwhjzaFzHdENebA1uWIKqy2KaL+FGebmCTmeta9yDPmXXB0MAd/z 8ui0FOJQQvyJLpq/OtfinUsw9i6jhvHqzlIL7Sna/ky9x4JBC5QIxWn2rfhgtPfyUHkY Z/K80cLTZmelp37fbDHo3suJagG1Gm2e6Ja44UH8slDK7fONPKfmixlptKTV0Ws3aeM1 tVl4oryIseh0VwWrk5x7w4ecznqQ7ccAin+iKp+IZzRHBnkDhwi1AMjYxbmj51DC3Xm2 QsKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=gKmk7gRDlEU4hxxlMgLLdZkUI9+dV1QSym4F/u+ugl8=; fh=AzeD7YCzxWA+xrfgg0HiLIXeOkAAMHglNTjKdDLJwsU=; b=bMrqVYv8yfe7yYd0+1EwGCyOM8nZlDDJF4Qa0vX91BnRoLKU59Btwo/0EDQCuRBIBW 7O6x3bv4Lmmsrmqu58WB8wIxjkDNts4TPJN+WTa+gDCmF3YhQ45iRbnNtEoTqraRb8Xe Cs3Yig0ju/2/T6W5Sa6Qh7z8EcHf/tbDqKiN6Fo6gSQgvcHpFTuBRAtPfebXxhMdCpGR fVyVV3xV5Z3rybpyIZwuBjcmGGc63QnTNeH72Btfrxjqbyr9RxoiYJ8uLog9XtLc4/Re b+0s2FN6nvotLm0JS6sCxgfTfhq1uqmPPRnGUxx6tKnlOnaquHcP68pi+0wGIqUdxjU/ 9h8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 76-20020a63024f000000b0055fd1bfacafsi2867982pgc.755.2023.08.05.00.38.56; Sat, 05 Aug 2023 00:39:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229721AbjHEGN0 (ORCPT + 99 others); Sat, 5 Aug 2023 02:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjHEGNY (ORCPT ); Sat, 5 Aug 2023 02:13:24 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 288B64ED0; Fri, 4 Aug 2023 23:13:22 -0700 (PDT) X-QQ-mid: bizesmtp71t1691215993ty0dxrkb Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 05 Aug 2023 14:13:12 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: VudjVnMJxE6y0HQdOAnIPW2Xm5and1bBaT6pX9ZCs1jzBV+VotcyCU7xHF8c2 FJ8c1IS734nq3CP1BRwRLg4LfZfUimvLvF/xBDGhTUxe4pd1bybAdcSavoW54CMSSrHpsB2 mANBiu2rVvVdMcY7IJfVl5cYBAoG8Gq6cpaAnTWvk0cnl9r4JKMabJrlzxI/WvlLkuUr9Hs 6aM7b/2PH9u/TWGLbkDATDLliZpiME9l9NAccP4y+wcqoMokBowHc7k4HqwryQJ4Gg5ik6t ay4C4v5/10U4XvHXebFaLKXL3Vyf5F7Jryf18X3+YtN6z+6mgbkmJznf//wgfner21xQVko iKOYjLmMArC5jIDUZp0t3h5fekE5sH+9UqD6m2t6QmLjrpo3Ml8w+rF9JlPTcb6kqgFxxlt KaQ2z2e4dmM= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 9091032993655144416 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Subject: [PATCH v2 3/3] selftests/nolibc: fix up O= option support Date: Sat, 5 Aug 2023 14:13:11 +0800 Message-Id: <06d96bd81fe812a9718098a383678ad3beba98b1.1691215074.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To avoid pollute the source code tree and avoid mrproper for every architecture switch, the O= argument must be supported. Both IMAGE and .config are from the building directory, let's use objtree instead of srctree for them. If no O= option specified, means building kernel in source code tree, objtree should be srctree in such case. To support relative path, as suggested by Thomas, $(COMMAND_O) is used to pass the O=$(ABSOLUTE_O) to the $(MAKE) commands. Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/ZK0AB1OXH1s2xYsh@1wt.eu/ Suggested-by: Thomas Weißschuh Link: https://lore.kernel.org/lkml/058a264d-45bd-4f1f-8af3-56ed337b3251@t-8ch.de/ Link: https://lore.kernel.org/lkml/500504f6-fed1-45a4-a518-4631a6f3e463@t-8ch.de/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 51fef5e6a152..20797ba5d393 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -9,6 +9,9 @@ ifeq ($(srctree),) srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR))) endif +# add objtree for O= option, required by IMAGE and .config +objtree ?= $(srctree) + ifeq ($(ARCH),) include $(srctree)/scripts/subarch.include ARCH = $(SUBARCH) @@ -52,7 +55,7 @@ IMAGE_ppc64le = arch/powerpc/boot/zImage IMAGE_riscv = arch/riscv/boot/Image IMAGE_s390 = arch/s390/boot/bzImage IMAGE_loongarch = arch/loongarch/boot/vmlinuz.efi -IMAGE = $(IMAGE_$(XARCH)) +IMAGE = $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) # CROSS_COMPILE: cross toolchain prefix by architecture @@ -173,7 +176,7 @@ sysroot: sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot - $(Q)$(MAKE) -C ../../../include/nolibc ARCH=$(ARCH) OUTPUT=$(CURDIR)/sysroot/ headers_standalone + $(Q)$(MAKE) -C ../../../include/nolibc $(COMMAND_O) ARCH=$(ARCH) OUTPUT=$(CURDIR)/sysroot/ headers_standalone $(Q)mv sysroot/sysroot sysroot/$(ARCH) ifneq ($(NOLIBC_SYSROOT),0) @@ -210,19 +213,19 @@ initramfs: nolibc-test $(Q)cp nolibc-test initramfs/init defconfig: - $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare + $(Q)$(MAKE) -C $(srctree) $(COMMAND_O) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare kernel: initramfs - $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs + $(Q)$(MAKE) -C $(srctree) $(COMMAND_O) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs # run the tests after building the kernel run: kernel - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out # re-run the tests from an existing kernel rerun: - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out # report with existing test log -- 2.25.1