Yocto Project Discussions
 help / color / mirror / Atom feed
* How to install files in root directory
@ 2024-12-04  4:52 MOHAMMED HASSAN
  2024-12-04  5:36 ` [yocto] " Ashish Mishra
  2024-12-04  5:37 ` aravind posina
  0 siblings, 2 replies; 6+ messages in thread
From: MOHAMMED HASSAN @ 2024-12-04  4:52 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

Hi guys,
I am unable to install my files, binary, etc in the /root directory. I have
searched the documentation and tried but to no avail.
Please share some snippet or recipe code for my reference.


Thanks
Hassan

[-- Attachment #2: Type: text/html, Size: 351 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] How to install files in root directory
  2024-12-04  4:52 How to install files in root directory MOHAMMED HASSAN
@ 2024-12-04  5:36 ` Ashish Mishra
  2024-12-04  5:37 ` aravind posina
  1 sibling, 0 replies; 6+ messages in thread
From: Ashish Mishra @ 2024-12-04  5:36 UTC (permalink / raw)
  To: yocto, hassanchattarki

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

Hi Hassan ,

You can create an install or install append function as per your
requirement
Example:

do_install() {
     install -d  ${D}${sysconfdir}/YOUR-CUSTOM-DIR
     install -m 644 ${WORKDIR}/TEST-FILE ${D}${sysconfdir}/YOUR-CUSTOM-DIR
}

The Macro for standard directories like sysconfdir you can get from
https://wiki.koansoftware.com/index.php/Directories_and_installation_variables

Thanks ,
Ashish




On Wed, Dec 4, 2024 at 10:22 AM MOHAMMED HASSAN via lists.yoctoproject.org
<hassanchattarki=gmail.com@lists.yoctoproject.org> wrote:

> Hi guys,
> I am unable to install my files, binary, etc in the /root directory. I
> have searched the documentation and tried but to no avail.
> Please share some snippet or recipe code for my reference.
>
>
> Thanks
> Hassan
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#64394):
> https://lists.yoctoproject.org/g/yocto/message/64394
> Mute This Topic: https://lists.yoctoproject.org/mt/109914791/4806067
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> ashishm@mvista.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 2358 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] How to install files in root directory
  2024-12-04  4:52 How to install files in root directory MOHAMMED HASSAN
  2024-12-04  5:36 ` [yocto] " Ashish Mishra
@ 2024-12-04  5:37 ` aravind posina
  2024-12-09 11:45   ` MOHAMMED HASSAN
  1 sibling, 1 reply; 6+ messages in thread
From: aravind posina @ 2024-12-04  5:37 UTC (permalink / raw)
  To: yocto, hassanchattarki

[-- Attachment #1: Type: text/plain, Size: 1413 bytes --]

Here is the recipe snippet to follow for the issue your facing.

DESCRIPTION = "Install custom files to /root directory"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://LICENSE;md5=<your-md5-here>"

SRC_URI = "file://my-binary \
           file://my-config-file"

S = "${WORKDIR}"

do_install() {
    # Create the /root directory in the target filesystem
    install -d ${D}${sysconfdir}/root

    # Install your binary and config file
    install -m 0755 ${WORKDIR}/my-binary ${D}/root/my-binary
    install -m 0644 ${WORKDIR}/my-config-file ${D}/root/my-config-file
}

FILES_${PN} += "/root"

On Wed, Dec 4, 2024 at 10:22 AM MOHAMMED HASSAN via lists.yoctoproject.org
<hassanchattarki=gmail.com@lists.yoctoproject.org> wrote:

> Hi guys,
> I am unable to install my files, binary, etc in the /root directory. I
> have searched the documentation and tried but to no avail.
> Please share some snippet or recipe code for my reference.
>
>
> Thanks
> Hassan
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#64394):
> https://lists.yoctoproject.org/g/yocto/message/64394
> Mute This Topic: https://lists.yoctoproject.org/mt/109914791/8556823
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> posinaaravind0205@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 2448 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] How to install files in root directory
  2024-12-04  5:37 ` aravind posina
@ 2024-12-09 11:45   ` MOHAMMED HASSAN
  2024-12-09 11:51     ` Alexander Kanavin
  2024-12-09 12:27     ` Gyorgy Sarvari
  0 siblings, 2 replies; 6+ messages in thread
From: MOHAMMED HASSAN @ 2024-12-09 11:45 UTC (permalink / raw)
  To: aravind posina, yocto

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

It didnt work for me guys.
I want to place the file in my root home directory.

# Root home directory
ROOT_HOME ??= "/root"

if you guys have suggestions for me please let me know. I have tried the following lines below but none worked.

install -d ${D}/${HOME}
install -m 0755 my-file ${D}/${HOME}/my-file

and also tried

install -d ${D}/root
install -m 0755 my-file ${D}/root/my-file

none worked.

Please let me know if they are any more options i can try.

Thanks
Hassan

[-- Attachment #2: Type: text/html, Size: 1024 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] How to install files in root directory
  2024-12-09 11:45   ` MOHAMMED HASSAN
@ 2024-12-09 11:51     ` Alexander Kanavin
  2024-12-09 12:27     ` Gyorgy Sarvari
  1 sibling, 0 replies; 6+ messages in thread
From: Alexander Kanavin @ 2024-12-09 11:51 UTC (permalink / raw)
  To: yocto, hassanchattarki; +Cc: aravind posina

Please keep in mind: people are busy, any help you get is a favour.
You need to do everything you can to be precise and specific in your
request.

Particularly always include the full recipe, and the corresponding
error message you're getting, or explain what behaviour you are
observing, and what is your expectation that does not match that
behaviour. What do you mean exactly when you say 'none worked'?

Alex

On Mon, 9 Dec 2024 at 12:45, MOHAMMED HASSAN via
lists.yoctoproject.org
<hassanchattarki=gmail.com@lists.yoctoproject.org> wrote:
>
> It didnt work for me guys.
> I want to place the file in my root home directory.
>
> # Root home directory
> ROOT_HOME ??= "/root"
>
> if you guys have suggestions for me please let me know. I have tried the following lines below but none worked.
>
>
> install -d ${D}/${HOME}
>  install -m 0755 my-file ${D}/${HOME}/my-file
>
> and also tried
>
> install -d ${D}/root
>  install -m 0755 my-file ${D}/root/my-file
>
> none worked.
>
> Please let me know if they are any more options i can try.
>
> Thanks
> Hassan
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#64416): https://lists.yoctoproject.org/g/yocto/message/64416
> Mute This Topic: https://lists.yoctoproject.org/mt/109914791/1686489
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [yocto] How to install files in root directory
  2024-12-09 11:45   ` MOHAMMED HASSAN
  2024-12-09 11:51     ` Alexander Kanavin
@ 2024-12-09 12:27     ` Gyorgy Sarvari
  1 sibling, 0 replies; 6+ messages in thread
From: Gyorgy Sarvari @ 2024-12-09 12:27 UTC (permalink / raw)
  To: yocto, hassanchattarki, aravind posina

On 09.12.24 12:45, MOHAMMED HASSAN via lists.yoctoproject.org wrote:
> It didnt work for me guys.
> I want to place the file in my root home directory.
> # Root home directory
> ROOT_HOME ??= "/root"
> if you guys have suggestions for me please let me know. I have tried 
> the following lines below but none worked.
> install -d ${D}/${HOME}
>  install -m 0755 my-file ${D}/${HOME}/my-file
> and also tried
> install -d ${D}/root
>  install -m 0755 my-file ${D}/root/my-file
> none worked.
> Please let me know if they are any more options i can try.
> Thanks
> Hassan
>

Just thinking loudly: home folders are special on their own, and root 
home is even more special.

Adding files to home folders is usually done through the /etc/skel 
directory, that's content is supposed to be copied into newly created 
users' folders by useradd. However not sure if it works with root also. 
Haven't tried it, though that would be my first try. My second would be 
to copy the file somewhere else, and have an init script checks upon 
startup if the file is at the correct place...



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-09 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-04  4:52 How to install files in root directory MOHAMMED HASSAN
2024-12-04  5:36 ` [yocto] " Ashish Mishra
2024-12-04  5:37 ` aravind posina
2024-12-09 11:45   ` MOHAMMED HASSAN
2024-12-09 11:51     ` Alexander Kanavin
2024-12-09 12:27     ` Gyorgy Sarvari

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox