From patchwork Sat Mar 13 14:51:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vincent Fortier X-Patchwork-Id: 400248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C228C433E0 for ; Sat, 13 Mar 2021 14:52:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 017AA64F14 for ; Sat, 13 Mar 2021 14:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbhCMOwV (ORCPT ); Sat, 13 Mar 2021 09:52:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbhCMOvs (ORCPT ); Sat, 13 Mar 2021 09:51:48 -0500 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327E9C061574 for ; Sat, 13 Mar 2021 06:51:48 -0800 (PST) Received: by mail-qt1-x82f.google.com with SMTP id m7so6134617qtq.11 for ; Sat, 13 Mar 2021 06:51:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=H0C4X24D3kuU76q6uKQU00KMZsY2eN3yhU4UepqH3gY=; b=pqtS3M/t92j41vdLyDalmI3jp67tucaVnosDAdZDool565IlqpVC9d6nK1SYVSS+UG +7sh4jyBRNosTFP3JW6i80jtWE+h1k683FLfsgbwvBRWZRy0BYkSyU4fToOKZQ/kJnGw EeV5bmvpXfts02nm5ixxrndiQzaNwLalr9HFnz6dl3Ecn8sphJ2mQViU2OG9yQ8YGzvq e0hE2DYvbL8IvI/GvDPpY+Jx2LABCPe4HlDB2kTrbttWueeDyiicA3q4XjrxPmjKD0wf cLQC44gszPr2glFQ7zzSOARuymB9CZtI75LD+VqKfJlLWzvg5J0pJMaJOLwxmj1Tj6Xe EU1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=H0C4X24D3kuU76q6uKQU00KMZsY2eN3yhU4UepqH3gY=; b=At2EZXx2/RKJIQQ36VQ9WuY6uzcqda4et9fhB2gU/7tFwM3qdFXOxhdHyBJt8V/M5q OzyMNVOAZ6dBDxzigpZ7e0stiGfq/ryWvv/OGFnoA/sAEg1e164YMEawULB8Bd69DvZr aCjtTX3ikxr0EB98LprXqirtBKWC/HJPXmHONR5vmwtRsQifdCdGYp2PbLaKECdUBt25 s0Ja24SfuDBTgPX76rcXjv42ufjqrHKwpC4QeNBJjZOUBJhQIYeCD+KVpx/X+0c8uueZ gcLRChljvrzmEGdDbUXlASajw8xAxHWRT72io2SJ8RngUGOQnlPIs+A62fXhWNQuV8Ml pB3A== X-Gm-Message-State: AOAM5322FycDnm/5tOerMeBpQKUoOfIfI98bUHdPz6RvYYXsXKrUZET5 o1R6kB3YrJAmmrY5G7aGTHTZLJFOhQ+rjA== X-Google-Smtp-Source: ABdhPJzeCem5c+5kfGfH9utwXFjkylfuRPEXicCDRnjAPeaqlyaGKZATPK9foWq3WIhRnrbW/SN+jw== X-Received: by 2002:ac8:66d6:: with SMTP id m22mr16203771qtp.56.1615647107084; Sat, 13 Mar 2021 06:51:47 -0800 (PST) Received: from [192.168.80.12] ([24.105.64.120]) by smtp.gmail.com with ESMTPSA id c5sm6862390qkl.21.2021.03.13.06.51.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Mar 2021 06:51:46 -0800 (PST) To: linux-media@vger.kernel.org From: Vincent Fortier Subject: [PATCH 1/2] media_build: CROSS_COMPILE variable environment and disable rmmod.pl Message-ID: <28d6325e-9fd6-f442-bac3-4f5b2b529c48@gmail.com> Date: Sat, 13 Mar 2021 09:51:45 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi all, The current framework seems to presume the build is occurring over a native environment by default.  In order for it to work using cross-compiler toolset, calls to scripts/rmmod.pl needs to be removed (in lack of finding another option) as otherwise it fails over various insmod,rmmod command execution which are totally unecessary.  The following patch 1/2 disable this by adding a CROSS_COMPILE variable environment.  This allows calls to cross-compile the media drivers using the spksrc SynoCommunity framework for the various media_build stages using: $(RUN) CROSS_COMPILE=y make allyesconfig $(RUN) LDFLAGS="" CROSS_COMPILE=y make -j`nproc` MAKEFLAGS= $(RUN) CROSS_COMPILE=y make install DESTDIR=$(INSTALL_DIR)/$(INSTALL_PREFIX) Signed-off-by: Vincent Fortier ---  prepare:: config-compat.h Makefile.media links @@ -66,9 +70,16 @@ prepare:: config-compat.h Makefile.media  # Object specific rules  # Targets which don't need Makefile.media's rules +ifneq ($(strip $(CROSS_COMPILE)),y) +no-makefile-media-targets := %config clean distclean snapshot snap \ +    tarball release %links \ +    start insmod load stop rmmod unload reload \ +    card% update push %commit help debug cx88-ivtv lxdialog +else ifeq ($(strip $(CROSS_COMPILE)),y)  no-makefile-media-targets := %config clean distclean snapshot snap \ -    tarball release %links start insmod load stop rmmod unload reload \ +    tarball release %links \      card% update push %commit help debug cx88-ivtv lxdialog +endif  # Targets which don't need .myconfig to exist, to keep us from including it  no-dot-config-targets := $(no-makefile-media-targets) %install remove @@ -188,7 +199,11 @@ ifeq ($(inst-m),)    inst-m    := $(obj-m)  endif +ifneq ($(strip $(CROSS_COMPILE)),y)  v4l_modules := $(shell /sbin/lsmod|cut -d' ' -f1 ) $(patsubst %.ko,%,$(inst-m)) +else ifeq ($(strip $(CROSS_COMPILE)),y) +v4l_modules := +endif  #################################################  # locales seem to cause trouble sometimes. @@ -416,7 +431,9 @@ old-install:: rminstall      -install -d $(DEST)      -install -m 644 -c $(inst-m) $(DEST) +ifneq ($(strip $(CROSS_COMPILE)),y)      /sbin/depmod -a ${KERNELRELEASE} +endif  #################################################  # Tree management rules diff -uprN ../linuxtv.orig/v4l/scripts/make_makefile.pl v4l/scripts/make_makefile.pl --- ../linuxtv.orig/v4l/scripts/make_makefile.pl    2021-02-08 10:24:43.000000000 +0000 +++ v4l/scripts/make_makefile.pl    2021-03-13 14:39:47.238414024 +0000 @@ -258,7 +258,10 @@ while (my ($dir, $files) = each %instdir      print OUT "fi;\n\n";  }  print OUT "\t@echo\n"; -print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n\n"; +print OUT "ifneq (\$(strip \$(CROSS_COMPILE)),y)\n"; +print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n"; +print OUT "endif\n"; +print OUT "\t@echo\n";  # Creating Remove rule  print OUT "media-rminstall::\n"; diff -uprN ../linuxtv.orig/v4l/Makefile v4l/Makefile --- ../linuxtv.orig/v4l/Makefile    2021-02-08 10:24:43.000000000 +0000 +++ v4l/Makefile    2021-03-13 14:39:19.674250245 +0000 @@ -51,13 +51,17 @@ default:: prepare      @echo Kernel build directory is $(OUTDIR)      $(MAKE) -C ../linux apply_patches      $(MAKE) -C $(OUTDIR) M=$(PWD) $(MYCFLAGS) modules +ifneq ($(strip $(CROSS_COMPILE)),y)      ./scripts/rmmod.pl check +endif  #    $(MAKE) checkpatch  mismatch:: prepare      @echo Kernel build directory is $(OUTDIR)      $(MAKE) -Wfatal-errors -C $(OUTDIR) M=$(PWD) $(MYCFLAGS) CONFIG_DEBUG_SECTION_MISMATCH=y modules +ifneq ($(strip $(CROSS_COMPILE)),y)      ./scripts/rmmod.pl check +endif  # Anything in this target shouldn't be build in parallel. From patchwork Sat Mar 13 14:51:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vincent Fortier X-Patchwork-Id: 399844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5331CC433DB for ; Sat, 13 Mar 2021 14:52:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A1CF64F19 for ; Sat, 13 Mar 2021 14:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233610AbhCMOwV (ORCPT ); Sat, 13 Mar 2021 09:52:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233478AbhCMOvu (ORCPT ); Sat, 13 Mar 2021 09:51:50 -0500 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CF83C061574 for ; Sat, 13 Mar 2021 06:51:50 -0800 (PST) Received: by mail-qv1-xf35.google.com with SMTP id l15so5711585qvl.4 for ; Sat, 13 Mar 2021 06:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=PupIkF/7i3Y2UOV6hRRIgjSWhNK3V0kQ1xe6TbeRbBw=; b=fHUPrSj+hA6ytb/sQxDT/RZrQebuXh6KbflCoKQldz8YqdAgnv74I4zgTf8+WxudHY JbrFPxLvAp8Jxsqxyn+dMZdolKriuvDw/2uhJaSnO2OhD73xpY5SWz3enZGBrxmbErY0 f9WqMpH74sDdR9WguQWVuZ3Nr2OJFP0g4vVQZ+8NPmzr/qICk5jmerw/jaNB/y3W9B+1 ckTXsoB58aZy92Efl5Ne683Qb4uB/C3LPsmyelvcMNvADuyQ63k69riFnGAPupUmiTf/ Ib62crGyLRNWMKMqrWRggjvz1LLSSduqXLrFca1yzCN9AdWTQ9Ih8iws4C/Q9ilEyt7U DB2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=PupIkF/7i3Y2UOV6hRRIgjSWhNK3V0kQ1xe6TbeRbBw=; b=WUVHF5oSbc4PWHJr5113sn3o1Lv+QTZjtR3KoD8/e5JHQyjJFdL62qGN11OgZQusPp IYNKHV+2nZXOgcmYq3zrAL2PR7vs1f+efaaJOGWtV5PvaTV6w544080FQcn0LArTUiRJ RERePEL+1QrAw6sMTSfvaKyHrixv62nuUvwqj6lY4PwRCcHLrY0kKzkXAzD1g4Vy00kT ejeYCTWz4rguP4BMlPWNT6kBp7J9uusWpHqSWL1knhFV2UzwgutnQEpWvCkMVY/kreQ5 THix+w8r4RXISEiLSsedbEbvh5GowNOzqeDRYqLuwRSEexzGqVH8RBTyxkiRCKSzw52S asqg== X-Gm-Message-State: AOAM530qSZL0U2DGeaLlMUFBMvQ1+Gg36J8BOS+5ctC3GxMftHBlNoix 62E64d86gIswAOaLmJthj9RibWuxSKe38w== X-Google-Smtp-Source: ABdhPJxOy6flUgUOnIIyZ2zZN9+Qz7XGq1o8ktDErwnsC6tQqqA84aEZVaiBZJ+oXKFB8vBiI2KKrA== X-Received: by 2002:a05:6214:12a1:: with SMTP id w1mr17005886qvu.57.1615647109656; Sat, 13 Mar 2021 06:51:49 -0800 (PST) Received: from [192.168.80.12] ([24.105.64.120]) by smtp.gmail.com with ESMTPSA id w13sm6174427qtv.37.2021.03.13.06.51.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Mar 2021 06:51:49 -0800 (PST) To: linux-media@vger.kernel.org From: Vincent Fortier Subject: [PATCH 2/2] media_build: Allow cross-environment strip command Message-ID: <374c79c8-c56b-ec79-311f-b27aa3220432@gmail.com> Date: Sat, 13 Mar 2021 09:51:48 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi all, The current framework assume the strip command is natively available.  While using external toolchain to cross-compile there is a need to point towards such tool using a STRIP variable environment using spksrc SynoCommunity framework. The following patch tries to address this. Signed-off-by: Vincent Fortier --- diff -uprN ../linuxtv.orig/v4l/scripts/make_makefile.pl v4l/scripts/make_makefile.pl --- ../linuxtv.orig/v4l/scripts/make_makefile.pl    2021-02-08 10:24:43.000000000 +0000 +++ v4l/scripts/make_makefile.pl    2021-03-13 13:55:46.534414452 +0000 @@ -254,7 +254,7 @@ while (my ($dir, $files) = each %instdir      print OUT "echo -n \"\$\$i \"; ";      print OUT "install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; ";      print OUT "if [  \$\$n -ne 0 ]; then echo; "; -    print OUT "strip --strip-debug \$(DESTDIR)\$(KDIR26)/$dir/*.ko; "; +    print OUT "\$(STRIP) --strip-debug \$(DESTDIR)\$(KDIR26)/$dir/*.ko; ";      print OUT "fi;\n\n";  }  print OUT "\t@echo\n"; diff -uprN ../linuxtv.orig/v4l/Makefile v4l/Makefile --- ../linuxtv.orig/v4l/Makefile    2021-02-08 10:24:43.000000000 +0000 +++ v4l/Makefile    2021-03-13 13:58:27.939468937 +0000 @@ -44,6 +44,11 @@ endif  endif    # TOPDIR +# Allow passing STRIP variable to use cross-compiler toolset +ifeq ($(strip $(STRIP)),) +STRIP = strip +endif +  #################################################  # default compilation rule @@ -411,7 +416,7 @@ cx88-ivtv::  old-install:: rminstall      @echo -e "\nInstalling new V4L modules at $(DEST)..." -    @strip --strip-debug $(inst-m) +    $(STRIP) --strip-debug $(inst-m)      -install -d $(DEST)      -install -m 644 -c $(inst-m) $(DEST)