public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: isar-users@googlegroups.com
Subject: Re: rules.tmpl how to exec a cmd as root
Date: Wed, 28 Sep 2022 11:37:27 +0200	[thread overview]
Message-ID: <20220928113727.1e801ed8@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <CAJGKYO4_HdVGVWmuq3_2t3Gu5crf=TPwdbx4FnB1Afdkrt-E6w@mail.gmail.com>

Hi,

i recently was in the same situation that i had to install additional
files.

You sure to not need sudo there. The permissions and ownership will be
set and controlled by the package manager.

You want to make sure the Makefile of your modules installs everything
with "make install" or "make modules_install" and then override the
rules template to call the modules Makefile directly ... not the
default.

my_module_0.1.bb:
...
SRC_URI += "file://debian/my_rules.tmpl"
...
do_my_rules() {
	mv  ${WORKDIR}/debian/my_rules.tmpl ${WORKDIR}/debian/rules.tmpl
}
addtask my_rules after do_unpack before do_transform_template
...

--- isar/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
+++ my_module/files/debian/my_rules.tmpl
@@ -48,13 +48,14 @@
 endif
 
 override_dh_auto_clean:
-	$(MAKE) -C $(KDIR) M=$(PWD) clean
+	$(MAKE) KDIR=$(KDIR) clean
 
 override_dh_auto_build:
-	$(MAKE) -C $(KDIR) M=$(PWD) modules
+	$(MAKE) KDIR=$(KDIR) modules
 
 override_dh_auto_install:
-	$(MAKE) -C $(KDIR) M=$(PWD)
INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
+	$(MAKE) KDIR=$(KDIR) INSTALL_MOD_PATH=$(PWD)/debian/${PN}
modules_install
+	$(MAKE) KDIR=$(KDIR) INSTALL_MOD_PATH=$(PWD)/debian/${PN}
  install

See this discussion and patches
https://groups.google.com/g/isar-users/c/nHMhNJtX5FM/m/K4QsqjKDAQAJ

With this the Makefile of the out-of-tree module can now do all sorts
of fun stuff in "modules_install" and "install". And you patch the
sources of that module to contain a Makefile that does what you want.

Henning


Am Tue, 27 Sep 2022 15:20:57 +0200
schrieb "Roberto A. Foglietta" <roberto.foglietta@gmail.com>:

> Dear all,
> 
>  I found another corner case about compiling a 3rd party driver into
> ISAR and I need to execute a command at make level but as root.
> Unfortunately su cannot authenticate seamlessly and without the root
> permission the command fails. Suggestions?
> 
> override_dh_auto_build:
>       sudo cp -arf /usr/lib/modules/*/source/*
> /usr/lib/modules/*/build/ cp -arf /usr/lib/modules/*/source/*
> /usr/lib/modules/*/build/ $(MAKE) -n modules ${PARALLEL_MAKE}
> 
> Thanks, R-
> 


  parent reply	other threads:[~2022-09-28  9:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AM0PR10MB20205FF67C22F88DC3BE525BAA559@AM0PR10MB2020.EURPRD10.PROD.OUTLOOK.COM>
2022-09-27 13:20 ` Roberto A. Foglietta
2022-09-27 14:59   ` Roberto A. Foglietta
2022-09-27 21:13     ` Roberto A. Foglietta
2022-09-27 22:03       ` Roberto A. Foglietta
2022-09-28  9:37   ` Henning Schild [this message]
2022-09-28 14:45     ` Roberto A. Foglietta

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=20220928113727.1e801ed8@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=roberto.foglietta@gmail.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