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)



- docentore - 2010-06-11

frumpy_uk Wrote:Ah, OK - thanks. So I assume this process wipes sda2? And magically adds sda3?

Issue I have is that several months ago I prepared my hard drive for installing linux on the hard coexisting with aTV OS (per the instructions here : http://code.google.com/p/atv-bootloader/wiki/AlternatePartitioning2).

Ideally I would like to retain such a setup - aTV OS lives in sda1-4 (I think) and Linux lives in sda 5-6.

Can anyone confirm that I would therefore need to
Code:
sudo dd if=/dev/sdb of=/dev/sda[b]5[/b] bs=4096
, then work out how to set it up so that with a usb stick inserted it points to sda5 for boot, otherwise without usb stick it points to sda1 for boot?

you would have to resize media partition first and create new partitions. and then
Code:
sudo dd if=/dev/sdb1 of=/dev/sda5
sudo dd if=/dev/sdb2 of=/dev/sda6

etc...

I'm pretty sure that would be the way to do it


- frumpy_uk - 2010-06-11

docentore Wrote:you would have to resize media partition first and create new partitions. and then
Code:
sudo dd if=/dev/sdb1 of=/dev/sda5
sudo dd if=/dev/sdb2 of=/dev/sda6

etc...

I'm pretty sure that would be the way to do it

My partitions look like this :
Code:
Number Start        End           Size           File system  Name      Flags  
1        40s          69671s       69632s       fat32        EFI          boot  
2        69672s     888823s      819152s       hfs+         Recovery  atvrecv
3        888824s    2732015s    1843192s       hfs+         OSBoot          
4        2732016s  36083499s   33351483s       hfs+         Media            
5        36083500s 77091549s  41008049s                    
6        77091550s 78140126s  1048576s



- pin87a - 2010-06-11

frumpy_uk Wrote:My partitions look like this :
Number Start End Size File system Name Flags
1 40s 69671s 69632s fat32 EFI boot
2 69672s 888823s 819152s hfs+ Recovery atvrecv
3 888824s 2732015s 1843192s hfs+ OSBoot
4 2732016s 36083499s 33351483s hfs+ Media
5 36083500s 77091549s 41008049s
6 77091550s 78140126s 1048576s

If you are looking to keep the ATV OS on the drive I'm not sure dd is the tool you would want to use since it does a block-level copy (filesystem and all).

You should be able to resize the Media partition (looks like you already did that), add the linux partitions, copy the files from the usb drive (rsync would be a good tool for this), fix the fstab file on the copied install (change partition uuids), and edit com.apple.Boot.plist on the usb drive to point to the internal drive linux install (/dev/sda5).

I will put together a quick tutorial for this if I have some time later today.


- da-bitsch - 2010-06-11

pin87a Wrote:If you are looking to keep the ATV OS on the drive I'm not sure dd is the tool you would want to use since it does a block-level copy (filesystem and all).

You should be able to resize the Media partition (looks like you already did that), add the linux partitions, copy the files from the usb drive (rsync would be a good tool for this), fix the fstab file on the copied install (change partition uuids), and edit com.apple.Boot.plist on the usb drive to point to the internal drive linux install (/dev/sda5).

I will put together a quick tutorial for this if I have some time later today.

sounds great Smile


- frumpy_uk - 2010-06-11

pin87a Wrote:If you are looking to keep the ATV OS on the drive I'm not sure dd is the tool you would want to use since it does a block-level copy (filesystem and all).

You should be able to resize the Media partition (looks like you already did that), add the linux partitions, copy the files from the usb drive (rsync would be a good tool for this), fix the fstab file on the copied install (change partition uuids), and edit com.apple.Boot.plist on the usb drive to point to the internal drive linux install (/dev/sda5).

I will put together a quick tutorial for this if I have some time later today.

Would be really good - thanks!


- xeonicxpression - 2010-06-11

defiler Wrote:For component video output, you need to edit your xorg.conf:
Code:
sudo nano /etc/X11/xorg.conf
You only need to change the "Screen" section - leave the rest in place. My Screen section (using Pin87a's minimal install) looks like this:
Code:
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    Option         "UseDisplayDevice" "TV"
    Option         "TVOutFormat" "COMPONENT"
    Option         "TVStandard" "HD720p"
    Option         "TVOverScan" "0.80
    DefaultDepth    24
    Option         "NoLogo" "True"
    SubSection     "Display"
        Modes      "1920x1080" "1280x720" "1024x768" "720x480" "800x600" "640x480"
        Depth       24
    EndSubSection
EndSection

To my knowledge you just need to change the TVStandard option to the correct HDTV mode that your screen can handle. After that it just works. Go into the system settings in XBMC and change your audion output to the optical one.

Well, that worked. I restored the backup xorg.conf and edited just the screen section and it worked. Thanks!


- fodos - 2010-06-11

mauzzz Wrote:The same here. Snow leopard, macbook, sandisk cruzer 4Gb, same alert when booting. Just checking: have other forum members succesfully created the USB stick on mac os x and booted it on ATV?

I see some tutorials online about writing linux images to usb under mac os x in which bs=1M is advised. I haven't tried if that is succesfull. Any thoughts?

The same to me. "Dropping to terminal..."
I bought a 8GB Transcend, and restored the image to it with Windows Disk Image Tool. I have no MAC OS, so what is the way for windows users to fix? Unfortunately I have no linux skills. Thx.


- xeonicxpression - 2010-06-11

I can't seem to browse my workgroup. I just get "Connection timed out". I can see that I did get the correct IP and gateway though, so dhcp is working.

Edit: Nevermind....a reboot fixed the problem


- xeonicxpression - 2010-06-11

fodos Wrote:The same to me. "Dropping to terminal..."
I bought a 8GB Transcend, and restored the image to it with Windows Disk Image Tool. I have no MAC OS, so what is the way for windows users to fix? Unfortunately I have no linux skills. Thx.

Restore it using USBIT and make sure you run it as an admin. It has to be in device mode.


- xeonicxpression - 2010-06-11

Wow, this is night an day vs ATV OSX. I can play my 1080p rip of avatar that wouldn't even come close to playing on the ATV OS. Thanks a lot guys!


- fodos - 2010-06-11

xeonicxpression Wrote:Restore it using USBIT and make sure you run it as an admin. It has to be in device mode.

Thanks, it was helpful.


- JDizzy - 2010-06-11

Alright, loaded up the Minimal image and all went well.

But, I can't see my ATV's internal drive so I can put some content there and access from within XBMC.
With Sam's image I would just go to the Home folder and add my content. Now it will not allow me to create a folder, or add anything.
In XBMC the Home folder appears empty. All my Windows shares show up so I can add content to the library, just can't access the ATV drive.
A little later:
Hmmm... just added all my music in and it seems .flac files will not play for some reason (missing codex? I can't seem to find the log files it refers me to)...mp3 play fine. Think I'm going to stick with the heftier version for now.


- Angrenost - 2010-06-12

I have to quote myself about SMB,after a search and some testing i can say that the problem is on the Mac side,Snow Leopard and recent firmwares update caused randomic SMB server stops responding,the only way to let it start again is to force Airport reboot.
Didn't see this before because i used AFP in frontrow since the last year,before that SMB worked fine.
There are hundreds of post in the Apple official forum,and the Apple reply is...nothing as usual Angry
Need some feedback from other Mac users.
I am sorry to be moanful but an AFP solution is urgent,any help is apreciated,really!


Angrenost Wrote:SMB seems to be unstable here.
I use a Time Capsule formatted HFS+ mounted using SMB procol.At the beginning is working fine but randomly i have "could not connect to network server" error!
No way to connect,i have to reboot my Time Capsule to let it work again.
In System Info->network link:connected and ip if correct.
Unable to understand why this Linux and my Time Capsule are fighting Sad
Tried also to follow many tutorials in this post and Googling around to enable AFP,wich could solve all my problems,but it's not working at the moment Sad
This img is a very nice step ahead but if the network is unstable is unusable.
Is it just me or other Mac users in the same trouble?
Can provide more info if needed.



How To: copy the disk image to the atv harddrive and keep os x option - pin87a - 2010-06-12

Since it was requested I put together a quick tutorial on how to copy the image (should work for full and minimal) to the internal drive without removing the ATV OS. (usb drive plugged in boots to Linux, drive removed boots to OS X).

Pretty much everything in this tutorial comes from here or here so credit goes to the original authors.

Requirements:
Another usb drive (separate from the one you have the image restored on to)
Since you are making changes to the internal hard drive it is highly recommended that you make a backup of the recovery partition first so you can undo the changes if necessary. Instructions available here:
http://code.google.com/p/atv-bootloader/wiki/ATVBackup

For some reason the version of Parted included in Ubuntu 8.0.4 generates partitions that stop the ATV OS from booting properly. I couldn't figure out why so I switched to running Parted from the atv-bootloader package since it works perfectly.

Download atv-usb-creator and create a atv-bootloader drive (select atv-bootloader from the options). Then plug the drive into the ATV and reboot.

Once the atv bootloader has loaded telnet into it (user root / pass root)

Delete current Media partition and create new one
This tutorial assumes a 40GB atv drive. If you have a 160 you can make the atv media partition and the linux partition (sda5) larger.

I use vim for editing files throughout this tutorial. Feel free to use emacs, nano, or any other editor if you wish.
(warning - will delete data - be sure you back up if necessary)
Code:
parted -s /dev/sda rm 4
parted -s /dev/sda mkpart primary HFS 2732072s 54525951s

Create Linux Partitions
Code:
parted -s /dev/sda mkpart primary ext3 54525952s 77091549s
parted -s /dev/sda mkpart primary linux-swap 77091550s 78140126s

Format New Partitions
Code:
partprobe /dev/sda
mkfs.hfsplus -J -v Media /dev/sda4
mkfs.ext3  -b 4096 -L Linux /dev/sda5

Remove usb drive and reboot
Run factory restore in ATV OS

If all is well in the ATV OS connect the linux usb drive and reboot
Once linux is loaded ssh into the atv (user xbmc pass xbmc)

Copy Data
Code:
sudo mkdir /media/atvdrive
sudo mount /dev/sda5 /media/atvdrive/
sudo rsync -av --exclude "/proc/" --exclude "/dev/" --exclude "/sys/" --exclude "/mnt/"  --exclude "/media/"  / /media/atvdrive
cd /media/atvdrive
sudo mkdir -p proc dev sys mnt media
cd

Fix fstab on new install:
First you need to get the uuid information for the linux partitions
The uuid should look something like '72270e11-6b2e-4eb1-807d-4ca29f077626'

Run the following commands and copy the output somewhere so you can use it later.

sda5
Code:
sudo vol_id /dev/sda5 | grep ID_FS_UUID
sda6
Code:
sudo vol_id /dev/sda6 | grep ID_FS_UUID

Edit fstab on new install
Code:
sudo vim /media/atvdrive/etc/fstab
replace the root partition (/) UUID with the uuid you saved for sda5
replace the swap partition UUID with uuid you saved for sda6

unmount partition
Code:
sudo umount /media/atvdrive/
sudo rm -fdr /media/atvdrive/

Point atv-bootloader (on usb drive) to new internal drive install
Code:
sudo fsck.hfsplus /dev/sdb2
sudo mkdir /media/atvboot
sudo mount /dev/sdb2 /media/atvboot
sudo vim /media/atvboot/com.apple.Boot.plist
Change root to /dev/sda5
Code:
sudo umount /media/atvboot
sudo rm -fdr /media/atvboot/

Reboot into the linux install on the hard drive
Code:
sudo reboot

If all is well you can delete the linux partitions on the usb drive
ssh into atv
Code:
sudo umount /dev/sdb3
sudo parted -s /dev/sdb rm 3
sudo parted -s /dev/sdb rm 4

Once complete you can switch between linux and os x by inserting or removing the usb drive and rebooting.
Drive inserted = Linux.
Drive removed = OS X


- da-bitsch - 2010-06-12

@pin87a

Nice tutorial Smile I was though hoping for a solution where i didn't need the usb hanging out of the ATV. Can that be applied easilly to you tutorial?