WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tce bootcode  (Read 3484 times)

Offline JohnS

  • Newbie
  • *
  • Posts: 6
tce bootcode
« on: September 06, 2011, 12:00:01 PM »
Hi all.. I'm using TC as a base OS for an embedded device, and also for the installer for that device...

I put TC+installer onto a USB key using unetbootin, then plug the USB key into the device, and boot to an installer.. The installer then installs TC onto the device (along with the application)..

In the boot params for the USB key's TC, I specifiy the TCE directory, in this case sdb1... I have to do this, because if I don't, the autodetect will find the /tce on sda1 on the device itself (if we're updating a previous install)..

This works for the most part..

The problem we're running into, is that occasionally, we run into USB keys that do not have a partition table. The entire device is a single partition, so it gets mounted as sdb, instead of sdb1...

Is there any trick to the tce bootcode so that I can specify 2 areas to look /tce? (in this case, sdb and sdb1)?

My other solution is to modify unetbootin to fdisk these oddball keys, which is something I would prefer to avoid, since the keys may have other data that they don't want to lose..

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: tce bootcode
« Reply #1 on: September 06, 2011, 12:09:06 PM »
Use UUID or LABEL see: http://distro.ibiblio.org/tinycorelinux/faq.html#pendrives

BTW tc-install automatically uses UUID
10+ Years Contributing to Linux Open Source Projects.

Offline JohnS

  • Newbie
  • *
  • Posts: 6
Re: tce bootcode
« Reply #2 on: September 06, 2011, 01:42:38 PM »
The problem is that I don't know ahead of time what the UUID or the label is..

How it currently works is that I created a series of extensions that contain the drivers, installer, and application for the device.. I then build up an iso image from those... At this point, I create the isolinux.cfg, which contains the boot params... The iso image then gets embedded into a self-extracting acrhive with branded version of unetbootin...

The client will then download this archive, run it, and proceed to burn the iso to the USB drive that they supply... Somehow, the way the unetbootin does it, it uses the existing partition on the USB drive, and makes it bootable..

So in this case, I do not know the label or the UUID... I suppose I could modify unetbootin to try and get the uuid and re-write the isolinux.cfg, but then I would need to do that on windows, linux and mac..

Any other thoughts?

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: tce bootcode
« Reply #3 on: September 06, 2011, 09:07:30 PM »
I'm not sure whether I understand why and how you are using 'unetbootin' as I've got zero experience with that tool. But I'm pretty sure that you've got not much of an alternative to using 'tce=UUID=...' in the boot loader configuration of the target device. This is due to the "Never, ever use a hard coded device name like 'sdb' or 'sdb1' in a boot loader configuration file" rule. Maybe in your case using 'tce=LABEL=...' might be better, if you can force the label of the target device to a specific value.

So I guess you'll have to somewhat "clue up" the 'unetbootin' process. After browsing around the unetbootin home page for a short time I wonder how you are approaching this: Do you use some sort of a plugin, or are you releasing a custom build? In any case I've noticed that the source code contains a 'getuuid()' method (in the 'unetbootin.cpp' file), but I could not identify any usage example of said method. But if you create a customised version of 'unetbootin' I'd imagine you could use that method for your needs (albeit for the "price" of having to compile up to three executables).

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11628
Re: tce bootcode
« Reply #4 on: September 06, 2011, 09:55:25 PM »
Hi JohnS
Since the client has to provide the USB drive, you could require them to set the volume name to a
specific label.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: tce bootcode
« Reply #5 on: September 07, 2011, 10:50:42 AM »
Alternatively, put the installer files in a second initrd, and boot with the base bootcode. You'd need to scan for the usb stick, but this way there'd be no need for the stick to be mounted for the TC boot.
The only barriers that can stop you are the ones you create yourself.

Offline JohnS

  • Newbie
  • *
  • Posts: 6
Re: tce bootcode
« Reply #6 on: September 07, 2011, 12:21:49 PM »
@Rich: Can't do that, the clients are assumed computer illiterate (farmers, device runs on a tractor (well, drives the tractor actually.. So all you TC devs, your stuff is grown up, and driving now, though without a license..)..

@curaga, @maro: Both of these sound good.. We're going to be 'branding' unetbootin, so modifying it is somewhat reasonable.. I didn't realize that they had a get uuid/label method already.. I was assuming the worst.. That'll make the whole process easier..

I had never heard of multiple initrd's, so if plan A doesn't work out, I'll investigate that..

Thank you!

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: tce bootcode
« Reply #7 on: September 07, 2011, 12:37:17 PM »
It's called dynamic root fs remastering in the wiki, IIRC.
The only barriers that can stop you are the ones you create yourself.

Offline JohnS

  • Newbie
  • *
  • Posts: 6
Re: tce bootcode [solved]
« Reply #8 on: September 17, 2011, 02:56:52 PM »
Just a quick update...

I was able to successfully use the UUID in the bootparams, and catch that in my install scripts.. Using a method in /etc/init.d/tc-functions, I was able to translate the UUID to the real mountpoint..

In other words: Success!

Thanx for the ideas everyone.