WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Bootcode "Host" no longer works in 2.10  (Read 3787 times)

Offline baz

  • Full Member
  • ***
  • Posts: 216
Bootcode "Host" no longer works in 2.10
« on: March 24, 2010, 07:03:13 AM »
I installed 2.10 recently and noticed that the boot code "host" no longer works. It still defaults to "box".

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Bootcode "Host" no longer works in 2.10
« Reply #1 on: March 24, 2010, 01:38:40 PM »
Works fine here.

tc@dev:~$ showbootcodes
quiet host=dev waitusb=5 cron tz=PST+8PDT,M3.2.0/2,M11.1.0/2 tce=LABEL="nettop"
10+ Years Contributing to Linux Open Source Projects.

Offline baz

  • Full Member
  • ***
  • Posts: 216
Re: Bootcode "Host" no longer works in 2.10
« Reply #2 on: March 24, 2010, 04:42:04 PM »
Weird, these are mine:

host=tineee max_loop=255 opt=UUID=d09c23c4-ac3f-4a51-9d85-d594ed23be62 tce=UUID=d09c23c4-ac3f-4a51-9d85-d594ed23be62 home=UUID=d09c23c4-ac3f-4a51-9d85-d594ed23be62 noautologin noicons waitusb=7 quiet showapps pause

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Bootcode "Host" no longer works in 2.10
« Reply #3 on: March 24, 2010, 06:20:28 PM »
I believe I can provide an explanation: The changing of the host name is done via the 'sethostname' function in '/etc/init.d/tc-functions', which itself relies on function 'getbootparam' of the same file. In 'getbootparam' the following statement appears to be critical for the problem reported here:
    stringinstring " $1=" "$CMDLINE" || return 1

I made the observation that a difference between roberts and baz test cases is the relative position of the 'host=xxx' boot parameter. In the case of roberts this appeared in the middle of $CMDLINE whilst baz had it at the beginning. Looking at the above statement it seems clear what happens here: due to the blank character in " $1=", a match is found for roberts but not for baz. I guess a simple fix would be to insert an extra blank in " $CMDLINE", that means a change to
    stringinstring " $1=" " $CMDLINE" || return 1
should resolve the issue. Short term baz could just shuffle the boot parameters around and that should overcome this little problem.

Furthermore this would appear to happen to pretty much any boot parameter value extracted with 'getbootparam', where the boot parameter appears at the beginning of $CMDLINE. IIRC there might have been a previous case where a user found a difference in behaviour depending on where in $CMDLINE the parameter value appeared.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Bootcode "Host" no longer works in 2.10
« Reply #4 on: March 24, 2010, 07:10:14 PM »
Also easy if always use kernel specific parameters before any tinycore specific parameters, i.e., quiet first.
10+ Years Contributing to Linux Open Source Projects.

Offline baz

  • Full Member
  • ***
  • Posts: 216
Re: Bootcode "Host" no longer works in 2.10
« Reply #5 on: March 24, 2010, 07:42:47 PM »
Awesome! Works...

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Bootcode "Host" no longer works in 2.10
« Reply #6 on: March 24, 2010, 09:20:34 PM »
Fixed in next cut! Thanks for the report baz, and suggestion maro.
I added the space upon creation of CMDLINE.
10+ Years Contributing to Linux Open Source Projects.

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Bootcode "Host" no longer works in 2.10
« Reply #7 on: March 24, 2010, 11:08:53 PM »
I added the space upon creation of CMDLINE.
I guess that might work even better.

BTW there is another issue like this lurking in function 'getparam', which AFAIK isn't in use anywhere.