[LIVE] Option to install XBMC Live to SATA and PATA/ATA/IDE harddrive

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #16
l.capriotti Wrote:no offense at all. Looking forward to see your version of the install script, handling both USB and fixed disks!

Thanks for understanding.

I realised that the shipped livcd is not a highly modified version of Ubuntu. The progress is quite smooth. The boot loader, rootfs, partitions for nvidia and amd restricted drivers are all done. All I need to do is to write a compatible script in the initramfs so it will handle the merge of filesystem using unionfs like you guys did and couple of xmbc variables (probably just copy and paste). It really does not matter if the system is located on a usb disk or a local hard drive as long as the right module can be loaded into kernel which is the job of udev.

I hope it will finish in one day or two then I can post it here. After that I will try to make it network (san) boot which I have quite a few experience with, but it may be tricky since it needs to detect and bring up the network card before mounting the disk.

Cheers,
sam
find quote
red_lego_man Offline
Junior Member
Posts: 39
Joined: Mar 2008
Reputation: 0
Post: #17
I used the mkLiveUSB.sh script to write the live image to HDD instead of USb, by removing the "if removable drive" statement and then choosing hda from the list. i.e: lines 35 - 46 on mkLiveUSB.sh:
Code:
if [ -b /dev/${device} ]; then
        #if [ -e /sys/block/${device}/removable ]; then
          #if [ "$(cat /sys/block/${device}/removable)" = "1" ]; then
            echo "Found removable drive."
            removableDrives[${nRemovableDrives}]=${device}
            let "nRemovableDrives = $nRemovableDrives + 1"
            found="yes"
          #else
            #echo "Not removable ."
          #fi
        #fi
      fi


I also needed to change line 156 to format the partition to FAT32 instead of FAT16 as an HDD is too big for FAT16:
Code:
mkfs.vfat -I -F [b]32[/b] -n XBMCLive /dev/${removableDrives[$index]}1  &> /dev/null


Also, I then needed to change syslinux.cfg to have boot=disk instead of boot=usb, otherwise I got stuck in the "searching /dev/scd0,1,2,3 for installation source" loop (problem with /etc/initramfs-tools/usb ??):
(also altered to auto-boot nvidia after the timeout ...)

Code:
display        boot.msg
prompt        1
timeout        30
CONSOLE        1

default 1

# nVidia
label 1
  kernel vmlinuz
  append initrd=initrd0.img boot=disk splash xbmc=nvidia

# AMD
label 2
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=amd

# Intel
label 3
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=intel

#MkUSB
label 0
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=mkusb

#Safe mode
label safe
  kernel vmlinuz
  append initrd=initrd0.img boot=disk

label toramintel
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=intel,boottoram

label toramnvidia
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=nvidia,boottoram

label toramamd
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=amd,boottoram

So now I have a lovely xbmc system running from the internal HDD. Super.

This is a horrible cludge, but there you go. Wink
find quote
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #18
l.capriotti Wrote:no offense at all. Looking forward to see your version of the install script, handling both USB and fixed disks!

The script is ready, need find time to write the document and place to host an initial disk image (about 14M)

The purpose of the script is to build an unified image for usb pen drive, hard disk and san network boot. The first two goals has been achieved.

The script will generate a raw 4G disk image and you will have the freedom to put it onto your usb pen drive, hard disk or your server for network booting. The script I personally think is a reverse process of the usb installation script found in the Live CD, as It tries to unpack three raw images to disk partitions. Hope linuxer out there will appreciate it.

changes made so far

* use grub as the boot loader for easy live modification of kernel options
* add a boot script in initramfs to handle graphic drivers according to xbmc kernel options
* usplash resolution changed to 1024x768
* changed /usr/bin/diskmounter to by-pass xbmc system disks
* added a swap partition to /etc/fstab

To do

* build a new initramfs to include the support of san boot (aoe + iscsi)
* investigate how to check ext3 disk in the initramfs environment.

Upgrades to the upcoming Atlantis release will be very easy. Since all modified files were saved in separate locations, one simple update script will do the trick and user changes (documents, settings for example) will not be lost during the upgrade. The resulting 4G disk image can be scaled up or down by the end user using common tools.

Stay tuned.
find quote
red_lego_man Offline
Junior Member
Posts: 39
Joined: Mar 2008
Reputation: 0
Post: #19
Any chance of taking a look at what you've got so far? I'd love to poke around just to learn about it all.
find quote
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #20
red_lego_man Wrote:Any chance of taking a look at what you've got so far? I'd love to poke around just to learn about it all.

Hopefully you will get it tomorrow. I have written the documents. But have to test it tonight using a real pc to make sure it's all working.

Cheers,
find quote
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #21
Put up a project on google. The detailed installation is on the following page:

http://code.google.com/p/xbmc-image/wiki...ADiskImage

Changes from yesterday

* added an init script to remove any xbmc system partition node (/dev/sda1 or example) to force xbmc to ignore them
* modified /usr/bin/diskmounter to use vol_id to detect mountable partition instead of unreliable fdisk string

Personally I feel diskmounter script is not necessary since xbmc will try to mount any unmount partitions every 10 seconds.

Limitations
* Since it's all based on the Live CD, the hardware detection will still be the same as the original CD, i.e. if you hardware was not found in Live CD it's likely it will not work in the disk version
* You cannot upgrade the kernel at the moment or anything involving upgrade initramfs. This will bef fixed when network boot version is out.
* When XBMC exited unexpectedly, fluxbox will be started instead of xbmc. This probably is the bug of LiveCD. If it's not fixed in the release version of LiveCD, I will try to have look at them.
* Don't expect too much
find quote
red_lego_man Offline
Junior Member
Posts: 39
Joined: Mar 2008
Reputation: 0
Post: #22
OK, I've tried this out, both by hand and simply using the script - when I get to test this using qemu, the boot gets stuck:
Code:
Mounting: mount -o rw /dev/sda1 /container
mount: Mounting /dev/sda1 on /container failed: Invalid argument
Did not find /container/rootfs.img
sleeping for 0.5 seconds
over and over and over...
find quote
red_lego_man Offline
Junior Member
Posts: 39
Joined: Mar 2008
Reputation: 0
Post: #23
red_lego_man Wrote:OK, I've tried this out, both by hand and simply using the script - when I get to test this using qemu, the boot gets stuck:

over and over and over...

No, that was me being a fumb ducker. Typo in menu.lst. sorry.
find quote
red_lego_man Offline
Junior Member
Posts: 39
Joined: Mar 2008
Reputation: 0
Post: #24
Sam,
This is pretty good - it's good to have grub back, and to have some swap.
Now, would it be possible to include a script which allows you to create the initial image file (xbmc-beta-4G.img in your case), so you have freedom over the size? It would be good to be able to size it up to 8GB or down to 2GB for example. Choosing the size of the user partition would also be quite nice.
find quote
topfs2 Offline
Team-XBMC Developer
Posts: 4,003
Joined: Dec 2007
Reputation: 10
Post: #25
s7mx1 Wrote:Personally I feel diskmounter script is not necessary since xbmc will try to mount any unmount partitions every 10 seconds.

Uhm what? Can you explain this?
If your refering to XBMC's HalManager that is mounting the removable drives on the system then no, it's eventbased.
XBMC will get an event from Hal whenever a new disk is present and will mount it if it fits the profile we have, ie if it's removable, if it's using a correct filesystem.

So XBMC will only mount a disk once.

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #26
Topfs2 Wrote:Uhm what? Can you explain this?
If your refering to XBMC's HalManager that is mounting the removable drives on the system then no, it's eventbased.
XBMC will get an event from Hal whenever a new disk is present and will mount it if it fits the profile we have, ie if it's removable, if it's using a correct filesystem.

So XBMC will only mount a disk once.

The XBMC's HalManager is the way to do it. I was referring to the
/usr/bin/diskmounter script, which I modified to use vol_id to detect mountable partitions. It probably was a legacy script before XBMC has the halmanager integrated. The system will call the script before starting xbmc and also it's presented in /etc/rc.local
find quote
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #27
red_lego_man Wrote:Sam,
This is pretty good - it's good to have grub back, and to have some swap.
Now, would it be possible to include a script which allows you to create the initial image file (xbmc-beta-4G.img in your case), so you have freedom over the size? It would be good to be able to size it up to 8GB or down to 2GB for example. Choosing the size of the user partition would also be quite nice.

Thanks. If you have transfered the image to the hard disk. It's possible to extend the partition by removing partition 4 5 6 7 and then recreated extended partition 4 to fill the rest of the disk. Then create partition 5 which is the system root partition having the cylinder number from 40 to 164. partition 6 starts at cylinder 165 and end cylinder must be larger than 363. The last partition 7 is the swap partition.

After partition 6 is recreated, you can resize it by using resize2fs against to that partition (you need to run fsck before that) and make sure when you reformat the swap partition make sure it has label xbmc_swap, i.e. mkswap -L xbmc_swap.

Right now I have no plan for such automatic script as I am focusing on san boot. However I do plan later when san boot is finished, a new smaller image will be created so user partition will be created upon the first booting to extend to the full disk.
find quote
xentro Offline
Junior Member
Posts: 3
Joined: Sep 2008
Reputation: 0
Post: #28
red_lego_man Wrote:I used the mkLiveUSB.sh script to write the live image to HDD instead of USb, by removing the "if removable drive" statement and then choosing hda from the list. i.e: lines 35 - 46 on mkLiveUSB.sh:
Code:
if [ -b /dev/${device} ]; then
        #if [ -e /sys/block/${device}/removable ]; then
          #if [ "$(cat /sys/block/${device}/removable)" = "1" ]; then
            echo "Found removable drive."
            removableDrives[${nRemovableDrives}]=${device}
            let "nRemovableDrives = $nRemovableDrives + 1"
            found="yes"
          #else
            #echo "Not removable ."
          #fi
        #fi
      fi


I also needed to change line 156 to format the partition to FAT32 instead of FAT16 as an HDD is too big for FAT16:
Code:
mkfs.vfat -I -F [b]32[/b] -n XBMCLive /dev/${removableDrives[$index]}1  &> /dev/null


Also, I then needed to change syslinux.cfg to have boot=disk instead of boot=usb, otherwise I got stuck in the "searching /dev/scd0,1,2,3 for installation source" loop (problem with /etc/initramfs-tools/usb ??):
(also altered to auto-boot nvidia after the timeout ...)

Code:
display        boot.msg
prompt        1
timeout        30
CONSOLE        1

default 1

# nVidia
label 1
  kernel vmlinuz
  append initrd=initrd0.img boot=disk splash xbmc=nvidia

# AMD
label 2
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=amd

# Intel
label 3
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=intel

#MkUSB
label 0
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=mkusb

#Safe mode
label safe
  kernel vmlinuz
  append initrd=initrd0.img boot=disk

label toramintel
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=intel,boottoram

label toramnvidia
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=nvidia,boottoram

label toramamd
  kernel vmlinuz
  append initrd=initrd0.img boot=disk quiet splash xbmc=amd,boottoram

So now I have a lovely xbmc system running from the internal HDD. Super.

This is a horrible cludge, but there you go. Wink

Hello

could you please tell me how can I change the syslinux.cfg?

Best regards
find quote
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #29
Greetings,

Finally network booting support has been added. Image and script has been updated. Was forced to used bz2 compression due to the image size increase.

Need to do documents.




Unified XBMC image generator for usb, disk and san network booting
http://code.google.com/p/xbmc-image/
find quote
s7mx1 Offline
Senior Member
Posts: 264
Joined: Dec 2007
Reputation: 4
Post: #30
Network boot support documents has been added.

Currently it's able to boot either from aoe or iscsi.

The total boot time from a 100M network is about 50s. Time till xbmc is started is probably longer. I managed to reduce the last figure to 47s and I believe there's still much more can be done.

Happy testing.
find quote