Kodi Community Forum
[LINUX] Apple TV Crystalbuntu (Ubuntu Linux and Crystal HD) Disk Image for Apple TV - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: [LINUX] Apple TV Crystalbuntu (Ubuntu Linux and Crystal HD) Disk Image for Apple TV (/showthread.php?tid=74992)



- GuySie - 2010-09-07

GuySie Wrote:Manually changing the thumb (or doing anything else like editing a title) often freezes up the interface for a while, sometimes hanging the whole system. Might this be related to running from a USB stick with its slow transfer times versus the internal HD?

Actually, I think it might be because the USB drive appears to be full. df -h reveals nearly 100% in use now that I put a library and downloaded fanart on it. I assumed in earlier posts that partition resizing was only necessary for an image copied over to the internal drive; it appears that it's also necessary for an 8GB stick holding the 4GB image. I also found Defiler's references that this was a messy business and tooshna's posts on doing it on the internal drive. I'll have to read up some more on how this works precisely - I'm not a total n00b but this is a bit outside of my field of experience.


using more reccent versions of stuff - vajonam - 2010-09-07

davilla, your comment of its aint broke dont upgrade is valid,but is it possible to run more recent distro's on appletv like lucid for example? and upgraded nvidia drivers, i know there have been some fixes to hdmi output in the 19x seriers of drivers IIRC.

also do you run atvclient for lirc for IR? if i switch to lirc does this means my LED keeps blinking orange? at the moment I am running atv client.


- davilla - 2010-09-07

vajonam Wrote:davilla, your comment of its aint broke dont upgrade is valid,but is it possible to run more recent distro's on appletv like lucid for example? and upgraded nvidia drivers, i know there have been some fixes to hdmi output in the 19x seriers of drivers IIRC.

also do you run atvclient for lirc for IR? if i switch to lirc does this means my LED keeps blinking orange? at the moment I am running atv client.

You can run newer distros, there's nothing stopping one from doing this, you will lose audio over HDMI unless someone figures out the magic. You will also have to deal with grub vs grub2 and missing vesafb in the newer distros.

Personally, I don't see any need to run a cutting edge distro on an appliance. I stopped playing the "got'a have the latest updated Linux distro" game long ago and I spend much less time fiddling with it and more time watching videos. This thing should be inside your firewall anyway so security issues are mute.

Use atvclient to switch the LED to white on startup before LIRC starts. This is a non-problem. Personally, I run the MS MCE USB remote/controller. It's still one of the best remote/controllers around.


- defiler - 2010-09-07

GuySie Wrote:I assumed in earlier posts that partition resizing was only necessary for an image copied over to the internal drive; it appears that it's also necessary for an 8GB stick holding the 4GB image. I also found Defiler's references that this was a messy business and tooshna's posts on doing it on the internal drive. I'll have to read up some more on how this works precisely - I'm not a total n00b but this is a bit outside of my field of experience.

Partition resizing is necessary if you want to unlock the remaining space on a drive >4GB, so with your 8GB drive you can benefit.

One of my posts had a step-by-step for Tooshna - same principle applies for you, and the same warning. Make sure you are working on the correct drive before you do anything irrepairable.

It'll also be slow on the USB drive (as you've seen). Playback is excellent, but navigating the menus (and anything that involves drive access, really) will be quite slow compared to the ATV client that runs off the hard drive. That's why some people (myself and Tooshna, for example) have installed the USB image to the hard drive. We're not interested in maintaining FrontRow compaibility, but speed is important to us.

If you want to improve the speed, but keep it on a USB drive, you need to get a faster flash drive. The best price/performance I've seen in the UK was these. I bought a few for work to use for VMWare servers, which can be touchy on speed. That's a year ago, though, so there'll be faster devices that aren't too much more expensive.

Hope that helps. I may be spouting nonsense as I'm out of my nut on painkillers.Oo


- s7mx1 - 2010-09-07

vajonam Wrote:davilla, your comment of its aint broke dont upgrade is valid,but is it possible to run more recent distro's on appletv like lucid for example? and upgraded nvidia drivers, i know there have been some fixes to hdmi output in the 19x seriers of drivers IIRC.

also do you run atvclient for lirc for IR? if i switch to lirc does this means my LED keeps blinking orange? at the moment I am running atv client.

I have appletv with ubuntu 10.04 running perfectly fine with XBMC. I am running xbmc at r33094 with 3.6.0 crystalhd. From my past 3 weeks experience all I can say is its very stable and best of all it even works with interlaced materials (the earlier version of crystalhd will just crash). This means I can use it to watch bbc iplayer streams.

The only thing that bothers me is its not able to handle 1080p videos (this may due to having only 256MB memory). If you want to try it I have built some packages for ubuntu 10.04. http://code.google.com/p/xbox-remote/ Go for featured downloads and install all 4 crystalhd packages. The dkms one depends on the libcrystalhd-dev.


- s7mx1 - 2010-09-07

defiler Wrote:Partition resizing is necessary if you want to unlock the remaining space on a drive >4GB, so with your 8GB drive you can benefit.

One of my posts had a step-by-step for Tooshna - same principle applies for you, and the same warning. Make sure you are working on the correct drive before you do anything irrepairable.

It'll also be slow on the USB drive (as you've seen). Playback is excellent, but navigating the menus (and anything that involves drive access, really) will be quite slow compared to the ATV client that runs off the hard drive. That's why some people (myself and Tooshna, for example) have installed the USB image to the hard drive. We're not interested in maintaining FrontRow compaibility, but speed is important to us.

If you want to improve the speed, but keep it on a USB drive, you need to get a faster flash drive. The best price/performance I've seen in the UK was these. I bought a few for work to use for VMWare servers, which can be touchy on speed. That's a year ago, though, so there'll be faster devices that aren't too much more expensive.

Hope that helps. I may be spouting nonsense as I'm out of my nut on painkillers.Oo

I actually removed the original 2.5 inch disk and put it into a usb 2.0 hard disk enclosure and then connected it back through the usb port. The hdparm gives around 20 MB/s read performance and I did not notice it being slower. You can order the disk enclosure from deal extreme for cheap price.

The whole point of it is to prevent overheat otherwise I think it will be lucky to survive a year.

The appletv will boot with only usb disk connected.


- jodeman - 2010-09-08

defiler Wrote:Partition resizing is necessary if you want to unlock the remaining space on a drive >4GB, so with your 8GB drive you can benefit.

One of my posts had a step-by-step for Tooshna - same principle applies for you, and the same warning. Make sure you are working on the correct drive before you do anything irrepairable.

After reading and re-reading all the posts in this thread, I've successfully copied the usb image onto the internal drive. Where I get stuck, is in expanding it to use all the space on the 40gb drive. I've tried following the instructions you posted back on page 88:

Quote:Parted (on Pin's image at least) throws a strop when you try to use it because it's got a bug (quite an old version) and can't handle the fact that the table says 4GB, the drive says 40/160GB, and there's no backup GPT at the end. So you need to write over the fdisk table (sector 0) and the start of the GPT table (sectors 1 and 2) in order to convince it that it's a blank drive.

So long as you took a note of the partition layout (either in bytes, or as Sam says in sectors), you can put the same table back in again (by hand) and parted will create (1) the GPT table from sector 1, (2) the dummy fdisk table at sector 0, and (3) the GPT backup table at the end.

Once you have that, you can swapoff the swap drive, delete it, extend the ext3 partition (via Sam's link), making sure to leave yourself 1GB at the end, re-add the swap partition on the end of the drive, swapon the swap drive again, and finally resize2fs the ext3 drive to activate the extra space. Phew!

I have my partition layout:

Code:
Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          26      204819+  ee  EFI GPT
/dev/sda2   *          26          29       25500   af  Unknown
/dev/sda3              29         333     2441406+  83  Linux
/dev/sda4             333         395      500000+  82  Linux swap / Solaris

Based on Sam's link, I know I need to do something like this:
Code:
# Resize partition 4 and create the main partition for Linux + swap
parted -s /dev/sda resize 4 2732072s   54525951s
parted -s /dev/sda mkpart primary ext3 54525952s  77091549s
parted -s /dev/sda mkpart primary linux-swap 77091550s 78140126s

(except replacing partition 4 with partition 3), but I'm lost as to what numbers to put in there? Are there any other steps I need to do?

Thanks!


- GuySie - 2010-09-08

defiler Wrote:It'll also be slow on the USB drive (as you've seen). Playback is excellent, but navigating the menus (and anything that involves drive access, really) will be quite slow compared to the ATV client that runs off the hard drive.

Ah, that would be where I went wrong. I had assumed that running from a USB drive would not be slower because USB drives only write slow. I'll have to reconsider a dualboot installation on the internal drive. I don't want to kill the aTV OS entirely as in my family gadgets run downstream - if I replace the aTV with a Boxee Box (for example) this one goes to my sis or dad, and I'd prefer them to get it with a low maintenance OS even if the performance is somewhat subpar. Having them maintain a linux install is not going to happen :')

On a side note, I just updated atvclient to the newest version with OPTIONS="-m" set as default and I can now use the Harmony One remote (configured as a Plex) fully. Much recommended for others here who have a similar remote.


- TeknoJnky - 2010-09-08

http://pastebin.com/2gdjiX0f

I'm trying to get this working, I thought I have everything updated accordingly, but every time I try to run a hd movie xbmc just drops and eventually I'll get the login screen

I've recompiled the crystal hd stuff, and even removed and reinstalled xbmc, but no joy.

edit: fixed to debug log


- ewequeone - 2010-09-08

I too am stuck at this point. Any assistance would be greatly appreciated Smile

Cheers,

Jason.

jodeman Wrote:After reading and re-reading all the posts in this thread, I've successfully copied the usb image onto the internal drive. Where I get stuck, is in expanding it to use all the space on the 40gb drive. I've tried following the instructions you posted back on page 88:



I have my partition layout:

Code:
Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          26      204819+  ee  EFI GPT
/dev/sda2   *          26          29       25500   af  Unknown
/dev/sda3              29         333     2441406+  83  Linux
/dev/sda4             333         395      500000+  82  Linux swap / Solaris

Based on Sam's link, I know I need to do something like this:
Code:
# Resize partition 4 and create the main partition for Linux + swap
parted -s /dev/sda resize 4 2732072s   54525951s
parted -s /dev/sda mkpart primary ext3 54525952s  77091549s
parted -s /dev/sda mkpart primary linux-swap 77091550s 78140126s

(except replacing partition 4 with partition 3), but I'm lost as to what numbers to put in there? Are there any other steps I need to do?

Thanks!



- TeknoJnky - 2010-09-08

I followed this link below, except using parted instead of fdisk, and it worked fine for me.

edit2: these instructions assume a) your using sams full image, b) you have imaged a flash drive and booted from it, c) are trying to or have applied sams image to the internal drive (over writing any existing). If any of the above is not accurate you will have to account for any partition difference yourself.

the object is to create a parted that understands the GPT partitions the atv uses, and remove the linux-swap partition, change the ext3 to ext2, resize the ext2, change the ext2 back to ext3, re-add the linux-swap.

also, after you create the parted and you run it, it will probably ask you to fix the gpt backup partition info, go ahead and do that first, I'll update the steps

- create the bootstick image and boot up
- install and build parted 1.8.8, make sure to edit install_parted.sh and added the cflags
http://code.google.com/p/atv-bootloader/wiki/InstallParted
- install the image to the hardrive via dd. I had to mount an NFS share that held the .img file on the network and used DD across the network to atv internal drive, while booted with same image on the patchstick.
- familarize yourself with http://www.howtoforge.com/linux_resizing_ext3_partitions_p2 and http://www.gnu.org/software/parted/manual/html_chapter/parted_2.html
- parted /dev/sda print (let it fix any gpt partition errors)
- fsck -n /dev/sda2 (check for no filesystem errors on ext3)
- tune2fs -O ^has_journal /dev/sda2 (makes into ext2)
- parted /dev/sda print (shows current partition list)
- parted /dev/sda rm 3 (remove linux-swap)
- parted /dev/sda rm 2 (remove ext2, we will readd expanded next step)
- parted /dev/sda mkpart primary 35.7M 40000M (readd the ext2 with larger partition)
- parted /dev/sda mkpartfs primary linux-swap 40000M 40500M (readd linux-swap)
- parted /dev/sda mkpartfs primary ext3 40500M -0 (create new ext3 (or hfsplus if you want) for media)
- e2fsck -f /dev/sda2 (force fs check)
- resize2fs /dev/sda2 (resize the ext2)
- tune2fs -j /dev/sda2 (change back to ext3)
- reboot

this will give you a 40g root partition and an ext3 partition on /sda4 you can mount as whatever once your booted. Change the sizes if you want, just make sure you use the same starting number (ie 35.7M) for the partition you are resizing)

Code:
xbmc@atv:~$ sudo parted /dev/sda print
[sudo] password for xbmc:
Model: ATA ST9160821A (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
1      20.5kB  35.7MB  35.7MB  hfs+         primary  atvrecv
2      35.7MB  40.0GB  40.0GB  ext3         primary
3      40.0GB  40.5GB  500MB   linux-swap
4      40.5GB  160GB   120GB   ext3         primary


edit:
you will also have to update your /etc/fstab instead of being pointed to guid, change to /dev/sda2 and /dev/sda3 (or however you partitioned it)


- davilla - 2010-09-08

never, ever use fdisk on a gpt partitioned disk, it WILL bork it Smile


- davilla - 2010-09-08

jodeman Wrote:After reading and re-reading all the posts in this thread, I've successfully copied the usb image onto the internal drive. Where I get stuck, is in expanding it to use all the space on the 40gb drive. I've tried following the instructions you posted back on page 88:



I have my partition layout:

Code:
Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          26      204819+  ee  EFI GPT
/dev/sda2   *          26          29       25500   af  Unknown
/dev/sda3              29         333     2441406+  83  Linux
/dev/sda4             333         395      500000+  82  Linux swap / Solaris

Based on Sam's link, I know I need to do something like this:
Code:
# Resize partition 4 and create the main partition for Linux + swap
parted -s /dev/sda resize 4 2732072s   54525951s
parted -s /dev/sda mkpart primary ext3 54525952s  77091549s
parted -s /dev/sda mkpart primary linux-swap 77091550s 78140126s

(except replacing partition 4 with partition 3), but I'm lost as to what numbers to put in there? Are there any other steps I need to do?

Thanks!

This looks like a mix of things. Sam's link is in reference to resizing the normal Media partition to make room for Linux. This would be for an install that retains the original four AppleTV partitions.

Your partition table looks like a dd of the USB flash image onto the internal disk.


- vajonam - 2010-09-08

davilla Wrote:You can run newer distros, there's nothing stopping one from doing this, you will lose audio over HDMI unless someone figures out the magic. You will also have to deal with grub vs grub2 and missing vesafb in the newer distros.

forgot about the grub2 issue.. did some more reading on this nvidia/hdmi problem i guess its specific to ATV hardware + driver issues. and hence the limitation of 8.04 as you specify in your wiki entry.

davilla Wrote:Personally, I don't see any need to run a cutting edge distro on an appliance. I stopped playing the "got'a have the latest updated Linux distro" game long ago and I spend much less time fiddling with it and more time watching videos. This thing should be inside your firewall anyway so security issues are mute.

agreed.

davilla Wrote:Use atvclient to switch the LED to white on startup before LIRC starts. This is a non-problem. Personally, I run the MS MCE USB remote/controller. It's still one of the best remote/controllers around.

sounds good. I will try this and run lirc


According to the wiki about installing minimal xbmc under apple tv, there are lines to disable turbocache.

http://code.google.com/p/atv-bootloader/wiki/atv_blog#July_4,_2008

but according to that blog it only seems to work in later nvidia version, so its moot with the 100.x nvidia drivers.

on my setup it shows 128MB of ram, even with that option enabled.

(II) NVIDIA(0): NVIDIA GPU GeForce Go 7300 (G72) at PCI:1:0:0 (GPU-0)
(--) NVIDIA(0): Memory: 131072 kBytes
(--) NVIDIA(0): VideoBIOS: 05.72.22.68.00

have you been able to get the usplash working? are there issues using vesafb and usplash

again thanks for putting all this info together in your various blogs and wiki articles!


- TeknoJnky - 2010-09-08

I think I see what is happening to me, I am run out of memory due to SWAP does not seem to be enabled...

Code:
xbmc@atv:~$ top
top - 22:31:27 up  1:29,  2 users,  load average: 0.09, 0.12, 0.15
Tasks:  82 total,   3 running,  79 sleeping,   0 stopped,   0 zombie
Cpu(s):  4.7%us,  0.0%sy,  0.0%ni, 92.3%id,  0.0%wa,  0.0%hi,  3.0%si,  0.0%st
Mem:    248940k total,   238024k used,    10916k free,     1140k buffers
Swap:        0k total,        0k used,        0k free,    28772k cached

not sure it isn't being used, the swap partition is there.