• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7
[LINUX] HOW-TO install Crustalbuntu minimal image to internal Apple TV harddrive
#1
Thumbs Up 
I decided to put this guide together for others who like me who wanted the image loading off the internal hard drive and not a USB. There may be an easier/faster way to do it then the way I did it, but it works and i posted all the commands and steps exactly step by step as i did it. I did it twice using this very same post to make sure i didn't miss anything.

FOLLOWING MY GUIDE WILL REMOVE THE APPLE TV OS FROM THE HARD DRIVE AND WILL ONLY LEAVE THE MINIMAL UBUNTU IMAGE. READ (GOOGLE) ATV-BOOTLOADER PAGE FOR INSTRUCTIONS ON HOW TO BACKUP OR RESTORE THE APPLE TV OS IF YOU EVER WANT TO GO BACK. I USED WINDOWS 7 AND WINSCP + PUTTY TO ENTER ALL THE COMMANDS. YOU CAN DO THE SAME IN AN SSH TERMINAL WINDOW ON UBUNTU OR ANY OTHER LINUX DISTRO WITH A TERMINAL WINDOW.

You will need a 4GB or bigger USB Flash Drive, some flash drives may not be bootable, I used a corsair voyager mini, my HP v125w did not work for this, patriot xporter XT 16GB also worked.

Read the thread about the image if you want to know what it includes. It is Crustalbuntu minimal image
http://forum.xbmc.org/showthread.php?tid=74992

#First thing you have to do is download pin87's image from any of the following links listed on the first page of this thread.
download:
http://www.surfanddestroy.org/resources/...256-R3.rar
http://meaninglesswebsite.com/atv-usbboo...256-R3.rar
http://stmlabs.com/resources/atv-usbboot...256-R3.rar

On windows download USB Image Tool to load the image into your 4gb or great USB drive.
Download USB Image Tool Link
http://www.alexpage.de/download/usbit/usbit.zip

1. Extract USB Image Tool Onto A Folder on your Desktop
2. Open USB Image Tool.exe
3. In the dropdown menu select Device Mode
4. Click on your device on the left hand side
Image

I Reccomend you make an initial backup image of your Unmodified USB Drive incase something goes wrong and you have to restore it after you put the Linux image on it to make it useable again.

4a. Click the Backup button, enter a name for the backup of your USB Drive and save it to your desktop.

5. Click the restore button and select the Minimal ubuntu image (atv-usbboot-xbmcbuntu-crystalhd-hdmi-28256-R3.img) that you downloaded earlier. Let it image to your USB device, this may take some time.
6. Your Linux Apple TV USB Drive is ready.
7. Connect the patchstick to your Apple TV and power it on (unplug, plug)
8. Let it do it's thing (may take a few moments)
9. Once you are at the XBMC Home Screen you are ready to begin copying the USB Image to your Apple TV Hard Drive
10. Leave the Apple TV On the XBMC Home Screen During the Entire Process.
11. Download Putty.exe (SSH Client for windows) from http://the.earth.li/~sgtatham/putty/late.../putty.exe
12. Open putty.exe and you will get the following screen
Image
13. Enter the IP Address of your Apple TV (You may have to look in your router Client list for this.
14. Click Open and you will get a command window saying "login as" enter xbmc for user and xbmc for password
so
xbmc
xbmc
15. If you logged in succesfully you should now have a window that looks like this
Image
16. You can continue following the instructions below.

Anything that is after a # sign are comments anything that DOES NOT start with a # is commands you have to enter in the putty SSH window. You can copy and right click paste them into the window. Whenever it asks for password remember its xbmc.

After entering a command do not continue to the next one until you have
"xbmc@appleTV:~$" indicating the previous command is finished. Some commands take time and will look like this while it is executing them
Image

Do NOT continue writing commands until it is done and the window looks like this:
Image

Each line is 1 command and must be entered by line. Some commands will ask for your input, such as do you want to continue, or some will ask you to press CTRL + O to save a file etc. Make sure you type "y" and press enter and CTRL + O + Enter and then CTRL + X to exit accordingly. You will see as you get to them.

################################################################################################################################################

#Copy Minimal Ubuntu to Apple TV Hard Drive. This will DELETE the Apple TV OS and leave ONLY the linux installation. Read ATV-BOOTLOADER page for instructions on backing up and restoring the original Apple TV OS and how to Restore if you didn't backup the Apple TV OS#

All the commands are inside command quotes line by line as you have to enter them into SSH, comments are outside the CODE marked with a #

#Zero Apple TV Hard Drive, This will Wipe All Partitions from the drive#
Code:
sudo dd if=/dev/zero of=/dev/sda bs=4096 count=1M

#Install Patched Parted, HFS Tools#
Code:
sudo apt-get install build-essential patch
wget http://atv-bootloader.googlecode.com/files/hfs_support-1.0.tar.gz
tar -xzf hfs_support-1.0.tar.gz
cd hfs_support/
sudo ./build_diskdev_cmds.sh
cd
sudo /usr/bin/apt-get remove parted
wget http://atv-bootloader.googlecode.com/files/parted-1.8.8-atv.tar.gz
tar -xzf parted-1.8.8-atv.tar.gz
cd parted
#Read the Comment after this command#
Code:
sudo nano ./install_parted.sh

###Scroll through the text and find the line that says "./configure --enable-static and change it to
Code:
./configure CFLAGS="-fgnu89-inline" --enable-static=yes
, CTRL O to Write Out and then CTRL X to exit###

Code:
sudo ./install_parted.sh
sudo ln -s /usr/local/sbin/parted /sbin/parted

#Verify you have parted version 1.8.8 If yes continue, if anything else repeat steps from "Install Patched parted"#
Code:
parted --version


##Initiate GPT Partition##
Code:
sudo parted -s /dev/sda mklabel gpt

##Check Drive Names using parted print all##
Code:
sudo parted
print all
##Here Check that the Apple TV Hard Drive is named /dev/sda and that the USB Stick is /dev/sdb, all the commands below this are based on apple tv hard drive being /dev/sda and usb stick being /dev/sdb##
Image

#Once you verify the names quit parted with the following command
quit

#Clone USB Drive to Apple TV Hard Drive, This Clones the USB Drive and all partitions to the Internal Apple TV Hard Drive, This May take a few minutes#
Code:
sudo dd if=/dev/sdb of=/dev/sda bs=4096
reboot

#AFTER REBOOT the connection will close, close the putty window, check your TV, once its back to the XBMC Home Screen Re-Open putty and recconect using the same IP Address as before, user is the same as password (xbmc)#
Code:
sudo fsck.hfsplus /dev/sda2
sudo mkdir tmp
sudo mount /dev/sda2 tmp

#Read Comment after this command to know what to do#
Code:
sudo nano tmp/com.apple.Boot.plist

###Change the line near the bottom that says /dev/sdbX to /dev/sdaX, Just change the b to an a, leave the number the same. CTRL O + Enter to write out and CTRL X to exit###

Code:
reboot

###If you are not using the internal hard drive for storage you can stop now and remove the USB stick from the Apple TV, The apple tv will now boot from the hard drive and no longer needs the USB Stick. The Hard Drive will be recognized as a total of 4GB since we cloned it from the USB stick.

If you want all the space of your Apple TV Hard Drive LEAVE THE USB STICK PLUGGED IN and continue below after reboot, Close the putty window and re-open/reconnect using the same IP Address and user/password as before once its back to the XBMC Home Screen###

Code:
sudo parted
sudo select /dev/sda
#Parted will give you a message saying the GPT Partition table needs to be fixed, type "fix" and press enter#
#quit parted using below command#
Code:
quit
sudo swapoff /dev/sda4
sudo parted
sudo rm 3
sudo rm 4
quit


##We are not going to create new partitions using the full size of the hard drive and copy the files from the USB partitions into the corresponding hard drive partitions.
The Below Examples are for 40GB Hard Drives. If you have 60GB You would put 58.9GB and 60.0GB Accordingly. 160GB Hard Drive would me 158.9GB and 160.0GB etc etc the first command is always from 236m as that is where the 2nd partition (Recovery) ends. the end sector is 1.1GB less then your hard drive. The 2nd Commands Starts where the first command left off and the final sector is the final size of your hard drive as you can see below##

Code:
sudo parted -s /dev/sda mkpart primary ext3 236m 38.9GB
sudo cp /dev/sdb3 /dev/sda3
sudo parted -s /dev/sda mkpart primary linux-swap 38.9GB 40.0GB
sudo cp /dev/sdb4 /dev/sda4
sudo e2fsck -f /dev/sda3
sudo resize2fs /dev/sda3
sudo tune2fs -j /dev/sda3
reboot

#When the Apple TV Starts Rebooting wait until the screen turns black and remove the USB Drive and it should boot from the Internal Hard Drive and you will have the full size of your hard drive available to you for files, you can now also close putty or any other ssh terminal you are using#
Reply
#2
If you want to restore the USB Flash Drive back to normal you can restore it in USB Image Tool using the backup you were "supposed" to make or you can do it in windows using the diskpart command.

Open a Command Prompt Window (Start > All Programs > Accesories > Command Prompt)
Code:
diskpart
list disk
Look for the Disk Number of your USB Flash Drive MAKE SURE YOU ARE SURE ITS THE RIGHT ONE! If you select wrong one you could wipe out one of your hard drives, so make sure its the only USB plugged in and just look for it by the right size.
Code:
select disk #
clean
You will need to create a new partition on the drive.
Right Click the "My Computer" either on the start menu or on your desktop and select "Manage"
Double Click on "Storage" then on "Disk Management(Local"
You will see your USB Hard Flash drive on the bottom in black saying unallocated space.
Right click the black unallocated space and press "New Simple Volume", press Next until you get to the format options, format it as FAT32 or NTFS, whatever you prefer, set the Volume Name if you like and perform quick format, Next.
Your USB Drive should be clean and and back to it's full original capacity.
Reply
#3
awesome post! can't wait to give this a try.
Reply
#4
To get your flash drive back to normal it's easy to use HP's flash drive formatting utility. I don't have a link now but it's easy to find.
Reply
#5
Smile 
Bandit_Kaine Wrote:
Code:
sudo parted -s /dev/sda mkpart primary ext3 236m 38.9GB
sudo cp /dev/sdb3 /dev/sda3
sudo parted -s /dev/sda mkpart primary linux-swap 38.9GB 40.0GB
sudo cp /dev/sdb4 /dev/sda4
reboot

#When the Apple TV Starts Rebooting wait until the screen turns black and remove the USB Drive and it should boot from the Internal Hard Drive and you will have the full size of your hard drive available to you for files, you can now also close putty or any other ssh terminal you are using#

Very good tutorial! Thank you! All worked well!
But I had to use the next two commands too to made it all happen on my internal drive.

resize2fs /dev/sda3
tune2fs -j /dev/sda3

Regards
Reply
#6
moonwalker Wrote:Very good tutorial! Thank you! All worked well!
But I had to use the next two commands too to made it all happen on my internal drive.

resize2fs /dev/sda3
tune2fs -j /dev/sda3

Regards

Did you do that before or after you pulled the USB drive out?

Also, once done, does it allow XBMC Thumbnails folder to expand using this extra space?
(I want to turn on dds images through advanced settings to further speed things up and it will take a lot of disk space).
Reply
#7
Bandit_Kaine Wrote:#Zero Apple TV Hard Drive, This will Wipe All Partitions from the drive#
Code:
sudo dd if=/dev/zero of=/dev/sda bs=4096 count=1M

##Initiate GPT Partition##
Code:
sudo parted -s /dev/sda mklabel gpt

Thx for the guide.. following along, but getting stuck... /dev/sda is disappearing and I'm unable to gpt label it or anything. I verified sda:
Code:
xbmc@AppleTV:~$ sudo parted /dev/sda print
qModel: ATA FUJITSU MHW2040A (scsi)
Disk /dev/sda: 40.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags  
1      20.5kB  35.7MB  35.7MB  fat32        EFI System Partition  boot  
2      35.7MB  455MB   419MB                Apple_HFS_Untitled_1  atvrecv
3      455MB   1399MB  944MB                Apple_HFS_Untitled_2        
4      1399MB  40.0GB  38.6GB               Customer

Zero'ed it with dd:
Code:
xbmc@AppleTV:~$ sudo dd if=/dev/zero of=/dev/sda bs=4096 count=1M
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 17.0934 s, 251 MB/s

But now I'm getting:
Code:
xbmc@AppleTV:~$ sudo parted -s /dev/sda mklabel gpt
Error: Input/output error during write on /dev/sda

And parted/fdisk no longer recognize disk:
Code:
xbmc@AppleTV:~$ sudo parted /dev/sda print
Error: /dev/sda: unrecognised disk label
xbmc@AppleTV:~$ sudo fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 8019 MB, 8019509248 bytes
255 heads, 63 sectors/track, 974 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         975     7831551+  ee  EFI GPT
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 0, 1) logical=(0, 0, 2)
Partition 1 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(974, 250, 44)

Thoughts? I feel like I'm missing something simple. Big Grin
Reply
#8
Hey

i do get an error when installing parted :

Extracting parted source and patching
patching file include/parted/disk.h
patching file libparted/disk.c
patching file libparted/labels/gpt.c
Building parted
./install_parted.sh: line 36: unexpected EOF while looking for matching `"'
./install_parted.sh: line 39: syntax error: unexpected end of file


anyone know what that can be ?

Thanks for the help.

Cheers
Reply
#9
I am experiencing drop frame problems when trying to play a 1080p blueray rip using the latest Dharma RC1 release, CrystalHD 174, and the Apple TV.

I have installed PIN's minimal xbmc-linux image to the Apple TV to the internal 40gb drive using the latest instructions. I have updated xbmc and crystalhd drivers/firmware.

I am using the component cables to my 720p capable set, and optical cables to the DTS capable AVR. I have a custom xorg.conf to enable 720 as per the ATV-bootloader instructions, and selected the iec948 audio device to get optical pass-through audio.

The media is stored on an SMB share over 100mb wired network.

The video appears to start ok, then after a few seconds starts dropping frames.

I am wondering if this is due to the high bitrate of the source video (even with the crystalhd it can't handle it?) or something else?

Here are the logs:

DMESG - http://pastebin.com/HQAQJTvw
xbmc.log - http://pastebin.com/FYaPK1zi
mediainfo - http://pastebin.com/4dCmBvhe
xorg.conf - http://pastebin.com/echgBRx1

The same video file plays fine over the same network using my ion Acer revo.

Thank you very much for the help.

JT
Reply
#10
ddingle Wrote:Zero'ed it with dd:
Code:
xbmc@AppleTV:~$ sudo dd if=/dev/zero of=/dev/sda bs=4096 count=1M
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 17.0934 s, 251 MB/s

I couldn't tell you why, but losing 'count=1M' from the dd command has fixed the issue I was having and all is well now.
Reply
#11
DrPepper Wrote:Hey

i do get an error when installing parted :

Extracting parted source and patching
patching file include/parted/disk.h
patching file libparted/disk.c
patching file libparted/labels/gpt.c
Building parted
./install_parted.sh: line 36: unexpected EOF while looking for matching `"'
./install_parted.sh: line 39: syntax error: unexpected end of file


anyone know what that can be ?

Thanks for the help.

Cheers

He's got mismatched quotation marks on the line you put in install_parted.sh. Kill the one at the end.

To clarify:
./configure CFLAGS="-fgnu89-inline" --enable-static
Reply
#12
JDizzy Wrote:Did you do that before or after you pulled the USB drive out?

Also, once done, does it allow XBMC Thumbnails folder to expand using this extra space?
(I want to turn on dss images to further speed things up and it will take a lot of disk space).

You can do it at the end, once the USB drive is out and you've booted from the HD.
Reply
#13
Thanks for the guide OP! I also needed the resize2fs / tune2fs stuff to get the full space of my drive available, you should probably add them to the guide.
Reply
#14
moonwalker Wrote:Very good tutorial! Thank you! All worked well!
But I had to use the next two commands too to made it all happen on my internal drive.

resize2fs /dev/sda3
tune2fs -j /dev/sda3

Ditto to above. Also maybe worth noting that instead of rebooting all the time you can issue
Code:
sudo partprobe /dev/sda
to pick up changes and keep moving on. Saves a little time anyway. Thanks again for the tutorial.

Now happily running Sam's image on my internal HD. Big Grin
Reply
#15
One more thing is that the tutorial is assigning 1GB+ to sda4 swap, but top only shows 499992k available and swapoff & resize2fs doesn't work on swap's sda4.. and I'm a linux noob so have no idea how to change that
Code:
xbmc@AppleTV:~$ sudo swapoff /dev/sda4
xbmc@AppleTV:~$ sudo resize2fs /dev/sda4
resize2fs 1.40.8 (13-Mar-2008)
resize2fs: Bad magic number in super-block while trying to open /dev/sda4
Couldn't find valid filesystem superblock.
so there is a bit of wasted space going on for swap, but who cares really as there is plenty still anyway for 1080p etc. Just making a note of it.
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7

Logout Mark Read Team Forum Stats Members Help
[LINUX] HOW-TO install Crustalbuntu minimal image to internal Apple TV harddrive2