Bug 5762 - Document the usage of the ROOT_HOME variable
Summary: Document the usage of the ROOT_HOME variable
Status: RESOLVED FIXED
Alias: None
Product: Reference
Classification: Documentation
Component: handbook (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Low normal
Target Milestone: 1.6
Assignee: Scott Rifenbark
QA Contact:
URL:
Whiteboard: 3 February 2014: RESOLVED
Depends on:
Blocks:
 
Reported: 2014-01-28 13:56 UTC by Laszlo Papp
Modified: 2014-02-03 12:26 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Done (doc changes complete)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laszlo Papp 2014-01-28 13:56:17 UTC
This is yet another important hidden gem as of now. It would be nice to see some documentation for it.

Some relevant information can be found the link below how to override the default and what the default value of this variable is.

http://patches.openembedded.org/patch/49683/
Comment 1 Scott Rifenbark 2014-01-31 20:57:12 UTC
Hi, 

Please see http://www.yoctoproject.org/docs/1.6/ref-manual/ref-manual.html#var-ROOT_HOME for the variable.  I am marking the status as IN PROGRESS REVIEW. Please look it over and comment if needed.

Thanks,
Scott
Comment 2 Laszlo Papp 2014-01-31 21:06:14 UTC
I have only one suggestion. Instead of:

    ROOT_HOME ?= "<path>"

I would probably write:

    ROOT_HOME = "/root"

a) "?=" means the variable is set if it is not yet set (at least in my understanding), but it will be always set to something by default ("/home/root").

b) "/root" seems to be probably the most common case (i.e. majority) for the override.

Otherwise, it looks OK.

Hmm, perhaps I would also mention the reason why the default value is that rather than the most common Unix "/root". As far as I know, the reason is that some embedded scenarios prefer to have read-only root filesystem, and hence they prefer to keep the writable data in one place, hence "/home/root" because other user folders are also under the "/home" folder.
Comment 3 Scott Rifenbark 2014-01-31 21:31:18 UTC
Laszlo, 

Thanks for the suggestions.  I will get another version in that uses them.  Before that, though, I have a question on overriding this path.  I don't see how the default would ever be overridden.  The "?=" operator does only assign the override path if ROOT_HOME is not set.  But it is set in the BitBake conf file.  I don't get it... Maybe you can explain it to me.

Thanks,
Scott
Comment 4 Laszlo Papp 2014-01-31 21:38:43 UTC
As far as I know, "=" will always override. "?=" will only override if it is not set. For instance, in the following scenario:

    FOO ?= bar

    FOO = baz

FOO will be set to baz. I am not 100% sure how the bitbake conf is evaluated, but since it seems to be the core of the system, it is likely to be evaluated before the layers, especially the end user's layer. So, you can compare bitbake's setting to "bar", and the end user's baz.

Paul Eggleton or Ross Burton could fix me if I am wrong, but that would be my understanding.

This is also what I discussed with an existing user on IRC how he sets the variable to "/root" with simple the "=" (assignment) operator.
Comment 5 Scott Rifenbark 2014-01-31 21:44:25 UTC
Okay - that makes sense.  The comment in the http://patches.openembedded.org/patch/49683/ did not make sense.  He specifically says to override it with "?=".  That was confusing me... 

Thanks
Comment 6 Laszlo Papp 2014-01-31 21:55:33 UTC
Hmm, from the bitbake manual:

http://docs.openembedded.org/bitbake/html/ch02.html#id398548

Now, I am also confused. :) I do not have much experience with "??=" and "?=". Your original code about "?=" might be wrong, and I wrongly misled you, apologize.

So, if I understand the bitbake documentation correct, if you do this:

    FOO ??= bar

and later in the same parsing unit:

    FOO ?= baz

Then we can conclude the following:

FOO is initially unset, so it will be set to either bar or baz. "??=" guarantees no immediate assignment until the complete parsing is done, so it goes further. Once the parsing reaches the second statement, FOO is still unset, and the immediate assigment will assign baz.

So, it seems to be your original version is right, and the "=" assignment is also right. As for me as an end user, "=" would cause the least confusion for this scenario, so I think it is good idea to represent that.

You are right that probably the patch from Kang should have suggested that instead.
Comment 7 Laszlo Papp 2014-01-31 21:56:24 UTC
"Your original code about "?=" might be wrong, and I wrongly misled you, apologize."

Sorry, that is a typo. I meant to write that:

"Your original code about "?=" might be correct, and I wrongly misled you, apologize."
Comment 8 Scott Rifenbark 2014-01-31 22:25:19 UTC
Okay Laszlo... Try this new version at http://www.yoctoproject.org/docs/1.6/ref-manual/ref-manual.html#var-ROOT_HOME.  I tried to get in the extra information and I am covering both the "=" and "?=" cases.  Let me know if you have more changes.

Thanks, 
Scott
Comment 9 Laszlo Papp 2014-02-01 02:55:19 UTC
Works for me, thanks!
Comment 10 Scott Rifenbark 2014-02-03 12:26:06 UTC
Thanks Laszlo, 

I am marking this one as RESOLVED and setting the doc flag to "Done".

Thanks, 
Scott