Difference between revisions of "RootFS"

From WikiDLXTV
Jump to: navigation, search
Line 7: Line 7:
 
Theres a little known feature thats in WDLXTV G2/Live/Plus that I think more people should be enjoying.
 
Theres a little known feature thats in WDLXTV G2/Live/Plus that I think more people should be enjoying.
  
There is a built in ability to pivot and boot a firmware directly off a flash device or fast hard drive. This is not root.bin I'm talking about, this is all the files directly on your device. The device you use must be formatted in either ext2 or ext3, I suggest ext3 since the journal will come into use occasionally.
+
There is a built in ability to pivot and boot a firmware directly off a flash device or fast hard drive. This is not '''root.bin''' I'm talking about, this is all the files directly on your device. The device you use must be formatted in either ext2 or ext3, I suggest ext3 since the journal will come into use occasionally.
  
 
You can build your '''.rootFS''' either from an existing [http://wiki.wdlxtv.com/Difference_between_FW_formats#EXT3-Boot_.5Bnon-flash.5D Ext3Boot] '''root.bin''' or checkout the latest version from SVN.
 
You can build your '''.rootFS''' either from an existing [http://wiki.wdlxtv.com/Difference_between_FW_formats#EXT3-Boot_.5Bnon-flash.5D Ext3Boot] '''root.bin''' or checkout the latest version from SVN.

Revision as of 06:19, 12 February 2012

Introduction

Theres a little known feature thats in WDLXTV G2/Live/Plus that I think more people should be enjoying.

There is a built in ability to pivot and boot a firmware directly off a flash device or fast hard drive. This is not root.bin I'm talking about, this is all the files directly on your device. The device you use must be formatted in either ext2 or ext3, I suggest ext3 since the journal will come into use occasionally.

You can build your .rootFS either from an existing Ext3Boot root.bin or checkout the latest version from SVN.


Installation

Format USB with ext2/3

First thing to do is to format your designated drive with ext2/3 filesystem. You can do this on any linux system or on the WDTV itself.

In the process you will lose all data on the drive!!

Here's how to do this on WDTV, make sure the drive you want to use is the only drive connected!

  • Find the device and unmount it
# mount | grep /tmp/media/usb/USB
/dev/sda1 on /tmp/media/usb/USB2/0fc063da-7518-4fab-83b2-31ff56c0adcc type vfat (rw,noatime,nodiratime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,utf8)
# umount /dev/sda1
  • Delete any existing partitions on the drive and create a new linux partition (type 83) using fdisk.
    Use p to print the current partition table, use d to delete existing partitions then use n to create a new partition (answer: primary, 1, defaults) and finaly write the changes with w.
# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1001 MB, 1001848320 bytes
255 heads, 63 sectors/track, 121 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1         122      978336   b Win95 FAT32
Partition 1 has different physical/logical endings:
     phys=(120, 254, 63) logical=(121, 204, 18)

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-121, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-121, default 121): Using default value 121

Command (m for help): w
The partition table has been altered.

# fdisk -l /dev/sda

Disk /dev/sda: 1001 MB, 1001848320 bytes
255 heads, 63 sectors/track, 121 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1         121      971901  83 Linux
  • Create a filesystem in the partition
# mkfs.ext3 /dev/sda1
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
60800 inodes, 242972 blocks
12148 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=251658240
8 block groups
32768 blocks per group, 32768 fragments per group
7600 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Copy root filesystem...

...from root.bin

Grab the latest Ext3Boot root.bin, save it to the device you want to play with, and open your closest shell. Example below is done on the wdtv-live itself.

Replace USBx/xxx-xxx-xxx with USB1 or USB2 and your drives UUID!

cd /tmp/media/usb/USBx/xxx-xxx-xxx
mkdir ext3-boot
mount -o loop root.bin ext3-boot
mkdir .rootFS
rsync -avHS ext3-boot/ .rootFS
umount ext3-boot
rm root.bin
sync && sync && sync && reboot

Now when this boots you should be greeted with ext3-boot, without root.bin.


...from SVN

With subversion you can run bleeding edge if you have an ext3 device:

cd /tmp/media/usb/USBx/xxx-xxx-xxx
mkdir .rootFS
svn co --username guest --password guest https://svn.wdlxtv.com/svn/wdlxtv-live/trunk .rootFS
chmod 4755 .rootFS/usr/bin/sudo
chmod 440 .rootFS/etc/sudoers
chmod 440 .rootFS/etc/sudoers.d/README
chmod 700 .rootFS/root/.ssh
sync && sync && sync && sync

Change the SVN URL to check out different versions:


Notes:

  • Your device MUST come alive fast to work
  • Any device that is already known to work with Ext3Boot root.bin will work with .rootFS
  • Only one external 3.5 hdd I've tried out of ~10 will boot .rootFS / root.bin, the rest will not because they are too slow
  • All 5 of my various 2.5" 'portable' external hdd's successfully boot root.bin / .rootFS


Advanced setup

Using ROOT_UUID

If your drive is slow you can try to force the boot drive by setting ROOT_UUID to the UUID of your drive. This can be done in WEC or in telnet/shell:

# blkid | grep sda1
/dev/sda1: UUID="bd292dba-874d-4f7f-8dea-fe0393c0b435" SEC_TYPE="ext2" TYPE="ext3"
config_tool -c ROOT_UUID='bd292dba-874d-4f7f-8dea-fe0393c0b435'
config_tool -s


Using ROOT_TAG

You can use tags on .rootFS the same way as on root.bin. This way you can have different .rootFS version on the same drive.

  • Tag your .rootFS
mv .rootFS .rootFS-102
  • Set ROOT_TAG
config_tool -c ROOT_TAG=102
config_tool -s


Links


--Recliq 13:15, 12 February 2012 (UTC)