Samsung Galaxy S, pt. 3, My Favorite Applications

Ok, so you have your phone rooted, updated and lag-fixed. You want some apps? Here are my picks:

  • Android Terminal Emulator (Well, it’s a terminal emulator)
  • Quadrant (For benchmarking and cock-measuring contests)
  • IMDB (Because i love my movies)
  • Spotify (Great if you have the.. Unlimited? Premium? Whatever it’s called nowadays account)
  • XBMC remote (Control your XBMC media center on your phone!)
  • FMI Helsinki Testbed (great weather app for the Southern Finland area)
  • Market Access (allows me to pay for applications. Paid apps are not available in Finland officially)
  • Advanced Task Killer (kills apps left open in the background)
  • Facebook / Twitter / Other Web 2.0 Socialwhoring apps
  • Astro File Manager (Look at your filesystems. More functionality than the built in “My Files”)
  • Barcode Scanner (handles all kinds of barcodes and can do searches online)
  • Instant Heart Rate (This one was fun, measures heart rate using camera)
  • Droidopas (Helsinki area public transport guide, by my good friend Anteuz)

Samsung Galaxy S, pt.2 – Firmware Update & Lagfix

Short disclaimer: Flashing your phone may be illegal, immoral and may cause damage to your phone and/or soul. I take no responsibility for any actions you may or may not take. Proceed with caution, and remember, i don’t care if you brick your phone; even though that should be pretty hard to do!

So time for part two.

As of August 2010, The Samsung Galaxy S (European Model) ships with Android 2.1, also known as Eclaire. While it’s a pretty stable version of Android, where everything works sort of, it’s not very fast or optimized. 2.2 or Froyo, will bring out the heat, and make this into the fastest device on the market.

Want to acchieve this speed boost right now? Thought so. You can do it, with Android 2.1, by doing a few simple hacks:  Upgrade to a later build (unofficial), and install the One-Click Lagfix. I’ll try to explain both:

- The newer build of 2.1 (currently JM6 is the name assigned to the latest firmware) will improve some functionality, mostly not related to speed, but for instance GPS functionality. The builds are unofficial and come from..various sources. I won’t link to them here, as i’m unsure of their legality, but i can say that they work just fine. Paranoid users might want to skip this, as this would be the perfect slot to slide in malware or other nasties to peoples phones.

- The lagfix adresses one of the more serious issues with 2.1, namely performance. The Galaxy S phone uses an RFS filesystem on the internal flash memory, which is far from perfect or optimized for such a platform. The problem is visible as general sluggishnes, for instance while flipping from page to page, or doing things in quick succession. The lagfix creates an ext2 filesystem within a file inside the internal memory, and places system files there, which is clearly visible as a highly increased performance. No more sluggishness anywhere. Synthetic benchmarks, such as Quadrant show an increase of over 1000 points. But subjective usage improvements are, of course, most important. The lagfix used to be much more complicated (while not impossible) but is now available as an application in the Android Market, and offers “One-click” installing.

Firmware Update

Updating the firmware is not an easy process for JoeBob69, but for someone who has played with gadgets and computers for a while, it’s no trouble at all. The things you need to start updating your firmware are:

  1. An installation of Microsoft Windows (i have not tried this through wine, but it might work
  2. Samsung Kies, or just the driver for the phone. When you connect your phone with the provided  MicroUSB cable, Windows should detect the phone. This isn’t specifically needed for this phase, but you will need it for the lagfix.
  3. Odin 1.0. This is the actual firmware flashing program.
  4. The correct .pit file, which for the Galaxy S with 2.1 Android is the s1_odin_20100512.pit. Again, i won’t link to it, you can find it through google
  5. The firmware you want to install. The fastest one right now seems to be the 2.1 build JM5. The 2.2 builds are as of this time not yet good choices, and usually slow. Firmware packages need to contain three files (two in some cases, but i won’t go in on that issue here): CSC, Phone and Modem. They can be of different versions internally, for instance, my phone now has a JM6 Phone firmware, a JM1 modem and a JM3 CSC package.

Start out by setting your phone in download mode.

  1. Make any necessary backups. Your contacts, SMS messages and Emails will not survive. Stuff under /sdcard on the phone will most likely survive (pictures, media, etc.), but take precautions here. Smart people sync their stuff elsewhere, like Google. They already have everything they need about you, so don’t worry.
  2. Shut down the phone, and if you like, remove the sim card and any microSD card you might have inserted.
  3. Press down the Home key and the Volume Down button, then the power button.
  4. Phone should start to a black and yellow “Download” mode, with the classic Android mascot
  5. Start up Odin on your PC, but DO NOT hook up your phone yet.
  6. In Odin, select your pit file, and on the left side, check all three boxes (Re-partition, Auto-Reboot and F. Reset Time)
  7. At this point, hook up your phone, and wait for Odin to detect it. The status box should read “Device added!” or similar.
  8. Hit Start on the right side. Wait for the phone to reboot, and Odin reports PASS with green background.
  9. Remove the battery and disconnect the phone. Boot it up to Download-mode again, but don’t hook it up to your PC yet.
  10. Restart Odin, and this time don’t add the .pit file. Instead add the three firmware packages under Phone, Modem and CSC. They should be individual .tar packages. Don’t try to open them.
  11. Remove the checkmark from Re-partition, on the left, but leave the other two.
  12. Connect your phone and wait for it to be picked up by Odin.
  13. Hit Start, and wait for it to go to PASS, again.

Depending on the firmware you may have downloaded, you may get a funky language on your first boot. You can fix it with the following “Blind-Guide”:

  1. In the Home-screen, hit the left function key to get the menu up.
  2. Select Settings, which is the Gear-icon, in the bottom right corner of the menu.
  3. Select Locale and text, the icon is a grey box, with the capital letter A inside.
  4. Hit Select Local. This is the top item in the menu.
  5. You should now find your locale from the list.

You may also need to restore your backups, and your APN settings for mobile broadband and MMS. Follow operator directives for these, as they will probably be lost during the firmware update. Android 2.2 will fix this, allowing you to do updates Over the Air, without losing your stuff.

Lagfix

The lagfix, which is a must for any Samsung Galaxy S owner, has now been made very simple. Open up market, and search for Samsung Galaxy S. You should see the One Click Lagfix. Download and install. Start it up, and install ext2 tools, and then the lagfix. On-screen instructions are pretty self explanatory. You can also do some kind of rooting here, but i haven’t tried the functions. Reboot when asked or just let it do its thing.

What happens is, you’ll get an ext2 file system on a part of your internal memory (you can also use a fast microSD card, which, i’m told, improves performance even more), and stuff will be run from that. This is much faster, and i am sure you’ll notice the difference.

Can i break something?

Well, it’s unlikely. You can use Odin in every scenario i’ve read about to restore a working firmware on your phone. I have read of a few isolated cases where things went awry, but were still fixable through some hacks.

Everything described here should be pretty safe, but again, i’m not liable if you brick your phone. Proceed with caution and don’t forget common sense.

Benchmarking

A standard 2.1 off the shelf Galaxy S should get about 900 points in Quadrant ( a benchmark application you can find in the Market). After the firmware upgrade and lagfix, i’m getting around 2100 points. This is of course synthetic stuff, measuring CPU, I/O and Graphics performance. Quadrant Pro will show you more details about how the points are distributed and calculated. It seems to be very I/O focused, as the filesystem fix brings an improvement of over 1000 points.

On the other hand, you’ll be so pleased with your smooth flowing UI that you won’t really care.

Samsung Galaxy S, pt.1 – Rooting

So, i became a Droid of the Galactic Empire, and left the Cult of Steve; dumping my iPhone 3GS to some other poor sod at the office. A few weeks ago, i went out and got the Samsung Galaxy S; their current flagship model.

The specs of the phone are as follows:

  • 1,0 GHz “Hummingbird” processor (Arm Cortex A8 base)
  • 2,0GB ROM
  • 6,0GB Flash
  • 512MB RAM
  • microSDHC slot (up to 32GB)
  • 4,0″ Super-Amoled screen 480×800 resolution
  • All the standards in the way of wireless, 802.11n, BT, A-GPS, HSUPA (7,2Mbit/s mobile broadband)
  • MicroUSB out, with support for TV-out

Basically it has a lot more oomph than the computer i had 10 years ago, in terms of almost everything, storage, cpu, telecom, etc. Anyway. It’s a nice phone, and so far i’ve noticed very few things to complain about. My intention is not a review per se, there are tons of those which speak for themselves. I’m gonna try to write simple-as-possible instructions for doing things like firmware upgrades, lag-fixes and other nifty tricks, as well as listing handy applications from the Android Market.

rooting

rooting of the phone has been made fairly simple. it consists of three distinct steps:

  1. Copy update.zip (as is, do not extract) to the /sdcard folder on your phone
  2. Boot phone into recovery mode
  3. Apply update.zip and wait for phone to reboot

Steps are performed as follows.

1. Go to the Homescreen and press the menu button (left of the home key), -> Settings -> About Phone -> Usb Settings -> Mass storage
2. Hook up USB cable and install any drivers that might be prompted, or not. Your internal memory (/sdcard) should be mounted
3. Copy update.zip to the root of that folder
4. Disconnect USB cable, and shut down phone
5. Boot phone so that you first press the volume up key on the side of the phone, and the home button, and keep holding them down, while pressing the power button. Phone will boot into recovery mode. Release all buttons as soon as you see text scrolling by. This will come after the Samsung logo.
6. Using the volume up and down keys, select the menuitem called “Apply update.zip”, and press the Home key to confirm. Rooting will commence, and phone will reboot after it’s done.
7. You will have two new menu entries in your phone under the Applications menu: “Superuser permission” and “BusyBox Installer”.
8. Open up the BusyBox Installer and upgrade to the latest version, or do it through the Android Market.

You now have a rooted phone, which can access any part of the phone filesystem, and allows you to use su to gain superuser permissions to do whatever you want. Get a terminal app from the Market, or do whatever you please. You can’t really break it, since you can always use Odin to reflash the phone, should something go pear-shaped. I’ll cover this in my next post.

Edit: Small corrections in terminology, download mode -> recovery mode. Thanks Anteuz.

A word about Solaris Zones (including a cheat sheet)

I thought i’d do a short write up on my experience with Solaris 10 Zones. So here goes.

Solaris Zones, or Containers, are a type of virtual machine, created on top of a Solaris 10 host operating system. That’s right, it needs a host operating system, so it’s not something like ESX that installs on bare metal with VM’s on top of that. Zones are one of the two types of virtual machines that you can do with Solaris; the second being Logical Domains. The difference between the two is that LDOMs can only be installed on pure SPARC hardware, and can utilize the hardware in a different way (such as the built in crypto chip of the new T1 and T2 chips). The specifics are out there, so i won’t get into that here.

Of the two, i like Zones because of their ease of setup. Both are easy, don’t get me wrong, but zones just feel right.

The basic steps for setting up a zone are as follows:

  • Install a machine with Solaris 10
  • See that you have enough disk space locally, or map appropriate network disks
  • Get network settings down before you start (your hostname and ip, gateway and dns etc.)
  • Create Zone, configure it, boot it, and configure some more
  • Install any additional software

So let’s get started with the “cheat sheet”, “shorthand”, “whatever you want to call it”:

Choosing Zone Type

You’ve got your Solaris 10 installed on a machine, right? It’s time to choose what kind of  zone to set up. There are two basic types. A Whole-Root Zone, or a Sparse-Root zone. The main differences are, that a Whole-Root zone does not share any of the directories of the Global Zone. This means that you can configure the system fully, like any physical machine with Solaris 10 on it. If you want to be running a lot of services that rely on stuff happening in /usr/local or you need to configure host specific files that can’t be shared with other systems, or just want the system isolated for other reasons, go with the Whole-Root zone. It’ll take up more space (around 3-4 gigs for a fully configured Solaris 10 system, plus anything you install on top).

A Sparse-Root zone has stuff shared with the Host OS, meaning if you change something on the Host, the change is immideately reflected in the sparse-root zones. This can be handy if you are running a system that needs constant changes, or are short on diskspace. But it’s not good, if you need to have the zone work on it’s own, with it’s own configuration. It’s all shared, or well most of it.

Installation

So back to your host OS! Make sure it’s patched up and so on. Install any applications that you might think you need on every Zone you plan to install. This would be stuff like..favorite editors, wget, sudo.. whatever you fancy. Don’t make it anything massive like postfix or so, because it probably won’t translate too well into your Zone, and will require extensive reconfiguration anyway.

Start out by deciding on a zone name, and initializing it:

zonecfg -z myzone

Zonecfg is used whenever you want to play around with the settings of a zone, or do something fundamental with a zone, like delete it.  The -z switch is followed by a zone name, and is used almost always, when you want to specify which zone you are fiddling with.

After running this command, you’ll be thrown into a new prompt, the zonecfg prompt. It’ll look something like: zonecfg:myzone>. Here, you can run commands that set the specifications of the zone, such as devices passed through from the host OS (also known as the Global Zone), filesystems you want to mount, network configuration and much more. I’ll go through the most important here.

Next, we’ll tell it to create a base configuration. For a whole-root zone, use

create -b

For a sparse-root zone, use:

create

This creates a baseline configuration, which you can look at with the view command. The main difference is, with the create command it’ll make sure the correct directories are inherited, and create -b makes sure nothing is inherited.

After this, we’ll add the zone path. This is where the operating system of the Zone will reside. Make sure you have space, so you don’t run out later. If you want redundancy, make sure you have all that sorted out at this point. If you notice something is missing or not right, you can always quit from zonecfg, and return to it using the same commands as above.

set zonepath=/zones/myzone

This places the myzone zone under the /zones directory in your host OS.This step is performed in both whole and sparse-root installations.

Next, we choose whether we want the zone to boot when the host OS does. This is usually a good idea, unless you have special requirements that i don’t know of. If the server goes down, and your friendly neighborhood sysadmin boots it, the zones will come up if the host does. This is good, and saves your solaris guys from doing a bunch of manual work.

set autoboot=true

Then we add a network interface, since you probably want the zone to talk to other hosts, and not just sit there.

add net

This gets you into the network configuration. prompt will say something like zonecfg:myzone:net. While in here, any commands you enter are directed toward the network configuration. Let’s add an address, a network card type, and a default route.

set address=192.168.1.2

set physical=bge0

set defrouter=192.168.1.1

end

Self-explanatory, but make sure your physical card type matches that of your host system. In solaris, interface names are according to manufacturer, so use ifconfig -a to check it out in the host os if you are unsure. Zone network adapters are made as virtual interfaces under your host interface. The first zone in my example will get an interface of bge0:1 and so forth. Defrouter is not mandatory, but you can specify a default route here if you so choose.End netconfig with the end command. You are now back in the main level of zonecfg

After this, you may want to add an extra filesystem. It’s easy:

add fs

set dir=/applications

set special=/some/network/share/on/the/host

set type=lofs

end

Okay, so first we enter the filesystem config with add fs. Then, we set the directory under which the mount is visible inside the zone. This can be confusing due to the next command, set special. This command is where to point on the host operating system. Why it’s called special eludes me. There’s nothing special about it.The last command sets the type as local filesystem. Others are available, look them up using help inside zonecfg if necessary.Once again end to exit back to the main menu.

We should now be good to go. If you want to pass anything else through to the zone form the host, you can do so. For instance, adding a device is as simple as:

add device

set match=/dev/device/*

end

This would give you access to anything under /dev/device/ on the host machine. You can get freaky with wildcards here.

We can now use the view command to look at what we’ve done. After that’s done, it’s time to nut up and shut up:

verify

commit

exit

Verify that settings are sane, commit them (save them), and exit. We now have a zone that is in a configured state. You can view the states of your zones using:

zoneadm list -civ

Very useful command, but for now, we want to install the system. This means copying the OS  and packages over to your zone. Whether you did create, or create -b significantly affects the amount of stuff to be moved over, but it shouldn’t take more than 10 minutes on any modern system.

zoneadm -z myzone install

And then for some waiting….. after you are done, you can do a listing again, and see that the status has changed from configured to installed. Now all that’s left is to give the system a swift boot, and an identity.

zoneadm -z myzone boot

This boot’s the zone. Notice that it takes like 2 seconds to do so, which is neat compared to many other solutions. After this, we have a system without the final configuration and identity. Do this by issuing

zlogin -C myzone

Capital C for console, since that’s all we have over in the zone right now. It’ll ask you a bunch of questions, and want the answers immediately! Nothing you can’t handle if you made it so far. Mostly about hostnames, DNS, languages, timezones and such.When you are done, it’ll save and reboot, and then get you back in a console login prompt, where you can type in your root login and password that you just set.

Shazam. Your zone is up and running. Configure SSH as you see fit, and access your system that way from now on. Create some users to avoid using root, etc. etc. This isn’t a best practices post so i’ll skip that shit now. Pretty simple, and once you have it routined, it’ll take you 15 minutes to set up a new zone that is ready to use. Not bad, eh?

Cheat Sheet

Oh yeah and the cheet sheet, quick reference for zones:

zonecfg -z zonename

create (for sparse root) or create -b (for whole-root)

set zonepath=/zone/path/on/host

set autoboot=true

add net

set address=nnn.nnn.nnn.nnn

set physical=bge0/hme0 whatever you have

end

verify

commit

exit

zoneadm -z zonename install

zoneadm -z zonename boot

zlogin -C zonename

nat and pf on OpenBSD 4.6

So maybe you have an old computer and you’d like to put it to good use? How hard is it really to convert an old piece of shit machine to a fully fledged NAT box with a built in firewall?

Not too hard.

What you need

What you need to do this build are the following items:

  • An old computer
  • Two good network cards. I can’t emphasize this enough. Preferably Intel cards, 3com is fine too.
  • Some CAT5 / 6 cable
  • A switch (optional, if you want to have more than one machine behind the firewall)
  • A USB memory stick, or a CD with OpenBSD 4.6 (4.7 is coming out in May)
  • The ability to read and understand written instructions

Not too insurmountable, eh? No, despite the “eh”, i’m not from Canada.

Step one – Preparations

Make sure your old machine boots, and doesn’t show any obvious faults in POST. If unsure, run something like Memtest86 from a Ubuntu Live CD, or something, and any BIOS diagnostics that may be available. Make sure your disk doesn’t have bad sectors or that it doesn’t make any funny sounds. Trust, me you don’t want to do a re-install one week after, just because your disk bought the farm.At this stage, also make sure your machine is set to boot from the media you are using (CD or USB).

Prepare your boot media. This is what you’ll be using to install OpenBSD with. Instructions for installing from a USB stick are here (warning, this is a new method, and not very tested, so if  you are not of the experimenting type, go with the CD) . Go to this page http://openbsd.org/ftp.html and pick a mirror closest to you. Once inside the FTP site, browse to 4.6 (or 4.7 when it’s out)/i386/ and download the file named install46 (or 47).iso

Burn this file to a CD. This file contains all the necessary files to install a working OpenBSD system, so you don’t have to put together too much yourself. It’s pretty small by today’s standards, so it’s fast to download.

Slide that CD/USB in to your old POS, and boot the machine from that. Pick Install when asked what to do. Choose to use the entire disk, and use recommended partition layout. Easiest at this point, and works fine for most installations.

Set network settings accordingly. One of your network cards should have an external address, usually given to you by your router, modem or whatever. The other should be in a private ip-block, such as 10.x.x.x, 172.16.x.x – 172.31.x.x or 192.168.x.x (when in doubt, check the openbsd installation guide), and finish the installation. It’s not as hard as it looks.

Once done, follow the instructions for booting into your new installation.

To use your machine as a NAT and packet filter, you need to set a few system variables, and edit a few configuration files. The instructions written here, are based on this brilliant guide, that i’ve always used as a base for my installations.

The basic steps are as follows:

  1. Edit the file /etc/sysctl.conf and change the value of net.inet.ip.forwarding to 1. This enables NAT.
  2. Check that PF is enabled (should be default in 4.6), by looking at /etc/rc.conf.local. If the file is empty, just make a line pf = YES
  3. If you want to have DCHP enabled, so you don't have to give out IP's to hosts by hand, enable dhcpd by following these instructions. Once it's done, it makes life easier, if you have to add and remove workstations a lot.
  4. At this point, i usually reboot, just to see that the services start on default.
  5. Here we start the "hardest" part; editing /etc/pf.conf. This file controls how the packet filter works, and is essential if you want to offer security to your network. An incorrectly configured pf.conf means evil guys, like my friend Bob, can gain access to your stuff.
  6. You can use my file as the reference, and change as necessary. You can download the file here. The lines are commented, so you can change it pretty easily. Just make sure, if you leave comments (or with everything for that matter) that everything fits on one line! Otherwise they will be interpreted as new lines, that is to say, new rules.
  7. After the file has been edited, load the file in to pf, by using the command pfctl -F ALL. This flushes all the previous rules and such. Load the new configuration file you just made by running pfctl -f /etc/pf.conf. If no errors are shown, your file is good to go. Otherwise it's usually a case of a typo her or there, which makes the file not parse correctly.

You’re done. Either let your clients get addresses by dhcp, or configure manually, depending on how you set up your interfaces and dhcpd. Test that traffic flows correctly.

OpenBSD is commonly considered to be one of the most secure operating systems on the planet. If you keep it patched, and don’t fuck up configurations, there is very little chance of your box getting compromised.

Any questions, feel free to ask. I’m by no means an OpenBSD guru, but i have been using it for this particular purpose for a few years now.

Footnote: This is what’s currently doing all of the above:

puffy on the desk

Guff about Grub 2 – Changing default boot target

Grub 2 (btw, why is it called that since the version reports as 1.97 or something?) has a fucked up way of doing things. A grand example of engineers designing something for themselves. Changing default boot target in Grub 1 was as easy as editing menu.lst, but this is not the case with Grub 2. Here, it’s a mish-mash, a hodge-podge, of different files that rely on each other, and are mudged together by various scripts to make a working grub boot menu.

Without further ado, to change the default boot target in Grub, i.e. get Windows to boot as default, or a specific kernel version (if you have many installed) would be done like this:

Open up a terminal, and open up the file /boot/grub/grub.cfg. My file looks like this:

[...the header is here, but omitted....]

### BEGIN /etc/grub.d/10_linux ###
menuentry “Ubuntu, Linux 2.6.31-19-generic-pae” {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd1,1)
search –no-floppy –fs-uuid –set c3ebcb50-f07e-4985-9734-471bb5c607da
linux   /boot/vmlinuz-2.6.31-19-generic-pae root=UUID=c3ebcb50-f07e-4985-9734-471bb5c607da ro   quiet splash
initrd  /boot/initrd.img-2.6.31-19-generic-pae
}
menuentry “Ubuntu, Linux 2.6.31-19-generic-pae (recovery mode)” {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd1,1)
search –no-floppy –fs-uuid –set c3ebcb50-f07e-4985-9734-471bb5c607da
linux   /boot/vmlinuz-2.6.31-19-generic-pae root=UUID=c3ebcb50-f07e-4985-9734-471bb5c607da ro single
initrd  /boot/initrd.img-2.6.31-19-generic-pae
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry “Memory test (memtest86+)” {
linux16 /boot/memtest86+.bin
}
menuentry “Memory test (memtest86+, serial console 115200)” {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry “Windows 7 (loader) (on /dev/sda1)” {
insmod ntfs
set root=(hd0,1)
search –no-floppy –fs-uuid –set 561ed31d1ed2f4c9
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the ‘exec tail’ line above.
### END /etc/grub.d/40_custom ###

What you want to look at here is the name of the menu entry you wish to boot as default. In my example, we’ll use Windows 7. The relevant bit is in red.

Select and copy the relevant section, that is, whatever follows menuentry, and inside ” “, whatever the entry you want to boot as default.

Close the file without saving any changes, and open up (as sudo) the /etc/default/grub

In the beginning of the file, there’s a line that looks like:  GRUB_DEFAULT=0

The interwebs are full of instructions on changing the number to something other than 0, where 0 corresponds to the first entry in the grub.cfg file we looked at earlier. This will work just fine if you never ever install a new kernel, a second or third OS, or do any changing what so ever to your grub configuration. Why i like to use the actual menuentry name is that that will not change, unless you want to change it.

Paste in what you copied from grub.cfg replacing the 0. My new entry now looks like: GRUB_DEFAULT=”Windows 7 (loader) (on /dev/sda1)”

It’s very important to remember the quotes, because otherwise the next step will fail, since it doesn’t understand a line that ends with a parenthesis ).

Save and close the /etc/default/grub file, and run the following command: sudo update-grub

This will parse the /etc/default/grub file, and generate a new /boot/grub/grub.cfg file which controls the actual menu (you could call this the old menu.lst, but one you can’t edit by hand without fucking everything up).

If no errors are printed, you are good to go. Run sudo reboot or use the gui to reboot the computer. Your new default entry should now be highlighted in the grub menu, and if you don’t touch anything, should boot.

HTPC 2010 – The Conclusion

The Conclusion

So time has come to get down to brass tacks. How much for the ape? I kid. I’ve now been using the HTPC for a little over a week, and i’m liking it. I’m gonna try to be as non-hyping and calm as possible, and list some of the challenges and victories with this build in this, the last post in the HTPC2010 series.

The Cons

First of all, the case is really cramped in a vertical sense. The fat ATX power cable has to be forced down, which feels really dangerous, as the fragile little motherboard starts to almost bend under the force. And all this just to get the top cover on. Some of the cables are also quite short, and the 4pin 12V extra power cable that goes to the motherboard only barely makes it to where it’s going. Cable management becomes a bit hard, when you have maybe a few millimeters of breathing room.

The 55x55mm fan in the rear of the case is also a bit annoying. It is quite loud, and causes some resonance with the metal of the case, and has to be tapped once in a while to shut it up. I could remove it altogether,  but i’m pretty sure it needs at least some cooling. The Asus motherboard has a similarly sized CPU fan, which isn’t quiet either. Would a passively cooled one have been a better alternative? Not if you ask Anteuz, as his Point of View-motherboard came with a passive CPU heatsink. He said it got so hot, he actually took the fan from the rear of the lascala and put it on the cpu heatsink to cool it off. So maybe a small tradeoff here.

There is no space for bigger fans without modification of the case.

The Asus motherboard doesn’t receive high marks from me in another area as well. The onboard connectors are quite limited. There is only one internal USB, no firewire, no esata, no anything. There is actually an esata solder-point on the motherboard, but alas, no connector. This would have been nice for hooking up an external drive, either through firewire or esata, but neither is present. This presents another problem with this case: the front panel. The frontpanel of the Lascala has a memorycard reader, which needs internal usb to work. It also has 2xUSB, firewire and audio. So i have to chose either the usb ports, or the memory card reader, and make due with no firewire.

Oh yeah, and there is no cover-panel for the optical drive slot (which is above the memorycard reader. This makes for a rather ugly front panel, if you open the little flip-down hatch, and find that there is a gap there. I chose to have the front panel usb’s hooked up, and left out the memory card reader. This means there’s a huge hole where the optical drive and card reader should be. Rather ugly. They could have included a damn cover for 160 euro……

I had problems with the sound, but this was to be expected. Using the optical out isn’t always simple in Linux, but once the correct configuration was entered, everything worked fine. Basically it was like 10 rows in my .asoundrc that solved the problem. It was mysterious. Video files with high-quality audio like DTS or other fancy Dolby standards worked fine. But then simple mp3 or other audio didn’t. One would expect it to be the other way around.

I also had problems with the video drivers. I went with the ubuntu recommended 185 drivers, and they had no problems. However, upgrading to the latest 195 drivers from nvidia resulted in XBMC crashing to the desktop immediately upon trying to play an .mkv file. Frustrating.

HDMI also didn’t work with the correct resolution from the getgo, and while VGA did, it has problems placing the image correctly on my Samsung 32R86 tv. I have to run the “automatic placement” menu item on the TV to position the picture correctly. And what’s worse, the placement is different for XBMC and the desktop. So to have a perfect image, i’d have to run that thing every time.. This is probably just a TV issue, so i’ll wait for my new 40 incher until i start spending time on this.

Setting folder content in XBMC is a bit tricky. I found that working on the default Confluence skin was the surest way to go, as many of the custom skins had some kind of reverse polish logic in them. Take this use case: I add a new folder to the library, and press the folder with the right mouse button and select “Set Content”. Here, i select the scraper (which website it uses to get the metadata for the content), and start indexing the content. If i made a mistake, i can’t return to that same folder view, all i have is the contents of that folder. When i manage to get back to that view through some dark magics, i find that the Set content menu-item is no longer there, and i am unable to “re-set” the content, if something went wrong, which it did.Through some voodoo, every media file in the folder got scraped as “Home movies”, by Ridley Scott, 1986. So every media file had the same metadata (which is incorrect, i don’t even have such a file!), and re-trying was not possible. Removing the library and re-setting the content seemed like the best way to go. And even then, some content had to be set manually, because it was not detected or processed correctly. A lot of manual work, that only has to be done once, note.

The Pros

The relatively cheap ION platform, while low powered, can decode media like a motherfucker. There is no chopping or other problems while playing even super high quality full-hd content, with hd class sound. It just works. And CPU load hardly ever goes over 50%.

All things said,  the build is still very quiet, and aesthetically pleasing, with it’s Set-top-box type black case. All that’s missing is a remote. It doesn’t take up much  power when playing media. It’s compatible with most forms of video and audio. Adding spotify through wine, you can even have that functionality all in the same box (though not integrated to XBMC..yet…).

The machine can be used to do pretty much anything except like.. graphics or encoding of media, or playing games. It doubles as a general internet pc in the living room, that you can use from the comfort of your own couch. With a 150 bucks more, you can add a bluray player, and save having to buy yet another box to your already cramped equipment racks.

I’m also pleased with how little tuning XBMC took in the end (save for the partial audio problems). Installing it was easier than i thought. My wife quickly learned to use XBMC as well, though she isn’t what you’d call a total newbie. I’m just waiting to teach it to my 2.5 year old son.. :)

HTPC 2010 – The Install

The Install

Time for the install. Nothing spectacular here. I booted the thing off a USB-drive i created using unetbootin 3.93, with a Ubuntu 9.10 (32-bit) iso slapped on there.  There was some issues booting from the stick, because i couldn’t get to any kind of boot menu (F12 didn’t take me anywhere), so i had to take a look at the BIOS. The setup was a bit different from what i’m  used to, namely, the usb drive is detected as a hard drive, and not as a removable or separate device. So, to start off, i had to set the hard-disk to boot as the first device, and then set the order of the hard disks, so that the “primary” hard disk was the USB-drive, and the secondary drive was the internal 250 GB drive. After this, the boot worked just fine. After the installation was done, removing the USB drive bumped the 250GB to the primary drive.

Other things that need to be noted in the BIOS are: Setting your graphics memory to 512 (or whatever your max is). This will ensure flawless HD playback. Default is usually 64 or 128 or something, which isn’t enough. Also make sure you have all the necessary audio and video ports enabled.

The Ubuntu installation was quick and painless. I chose to use the entire 250GB drive, and let Ubuntu do it’s magic on it. Nothing special during the install.

After the installation, only a few packages are needed. The commands that i ran, in order:

apt-get upate && upgrade

apt-get install nvidia-glx-185

This updates the repositories, upgrades existing packages, and installs the nvidia hardware driver. You can also use the Administration -> Hardware Drivers, which at the time of this writing, installs the 185 driver.

Note! I had some problems with the latest 195 driver. After installing it, there were some dpkg errors that prevented the installation from finishing properly. After this, graphics were fucked, and i couldn’t start x. When i did get the driver installed, and everything seemed to work, i was completely unable to play any HD quality .mkv files. XBMC would crash to the desktop. Also, trying to play them in VLC for instanec, resulted in equally disasterous problems. So unless you are having problems with your ION and the default 185 drivers, don’t upgrade.

After this i pretty much followed the linux installation guide of XBMC in their wiki. Roughly the installation is:

  • add the correct repositories
  • run apt-get update
  • run apt-get install xbmc
  • configure sound
  • configure xbmc
  • done.

The setup i had was: Run video through VGA (i have only one HDMI in my current TV), and audio through spdif to my amplifier. This was a fairly easy thing to set up, though the audio was a bit problematic, as i will describe a bit later.

Connecting the VGA got me a good picture right away with native resolution (1366×768), whereas through the HDMI it got detected as 1280×720, which is incorrect. And the picture wasn’t scaling correctly either, so i figure i would have needed to add some modelines to my xorg.conf. More about this later when i get my new Tv and hook up using HDMI.

About the audio

Getting audio to work was a bit problematic. In XBMC go to System -> Settings -> System, and then to the audio output tab. There, you need to check that you have your amplifier or TV set to support DTS and AC3 audio (if it does), and that you are outputting digital audio. For me, i had to set the audio output device to custom, and the device to plug:dmixer, and the passthrough device to IEC958 to get everything working. Changes to your .asoundrc in your profile root was also necessary, to make it understand the plug:dmixer device.

If you don’t make the above changes, you will find that only surround movies (DTS and the likes) will work. The rest, say shittier mp3 audio movies will not play anything, or even display a “incorrect audio device” message. Which is odd, because you kind of expect it to be the other way around, that the complicated DTS and other encoded sound would not work.

First off, find out which device you want to be using, by running the command aplay -l in your terminal. Look at the card number, and the device number, and see which output you want. In my case, it was the spdif, which was card 0, device 1. In alsa speak, this equals hw0,1

The contents of my .asoundrc file, which is placed in the root of my profile is as follows:

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,1"
        period_time 0
        period_size 1024
        buffer_size 8192
        #periods 128
        #rate 44100
        rate 48000
     }
     bindings {
        0 0
        1 1
     }
}

The bold line over there is the important one, and the only one you possibly need to change. Save the file, reboot the computer to be sure.

Now sound should work in any media files, regardless of the encoding.

Customizations i used in XBMC was the Rapier skin, basically. I stream media from my other machine through gbit lan, which works fine with any type of media.  I used a standard samba share for this, and no issues have cropped up so far.

I could write a bunch on scraping and other XBMC stuff, but they are so well documented in their wiki that i won’t bother. Just remember, the backspace key takes you back one level, and the c-key gives you the “right-click” context menu on any item (like a movie or folder). That is all.

References:

http://wiki.xbmc.org/?title=XBMC_for_Linux_specific_FAQ#S.2FPDIF_out_for_both_analog_and_digital_audio

http://wiki.xbmc.org/index.php?title=Installing_XBMC_for_Linux

http://wiki.xbmc.org/index.php?title=HOW-TO_install_and_switch_between_skins_in_XBMC

http://xbmc.org/skins/

HTPC 2010 – The Build

The build

I got word from Jimm’s Pc-Store that half of my parts had arived. The rest i would buy from Verkkokauppa.com because they had it in stock. I ended up getting a 250 gig hard drive for 39 bucks, simply because the cf solution was not immediately available (not in stock), and it would have cost nearly three times as much. Otherwise the parts list in the first post holds true.

I started by skimming the manuals of the case and the motherboard, and then started taking the case apart to prepare for installation. I had to remove the top cover, obviously, and also add and remove some of the internal cables according to my needs.

All the parts in one pile!

This is what the case looks like on the inside. Note the power supply, or actually just the distribution-point. The powersupply is actually that transformer-brick next to the case there. There is a 24-pin atx, 4pin 12v extra power, cables for floppy, molex, and sata, which are fairly modular, i.e. you can chose not to connect the molex cables if you don’t need them, like me. The case has a rubber-padded spot for the hard drive, on the bottom left in the picture. This should (and did) eliminate most of the vibration caused by the movement. The case also has front panel audio, usb and firewire, as well as a memory card reader. Sadly, the motherboard i got only had one internal usb, so it was a choice between the two front panel usb ports, or the memory card reader. I chose the usb ports, because it’s a handy way to hook up external hard drives and media players. Ofcourse, one can just switch the cable, and use one of the external usb ports to hook up the memory-card reader.

Cables for power and hdd led, as well as the power-switch are also included. Cable management turned out to be a bit hard: the 24-pin atx power cable is very very thick and stiff and needs to be forced down quite a lot to get the top cover back on.

The case, opened

power supply

The "Power Supply"

After this, it was time to put in the Asus motherboard, the hard drive, and hook up all the necessary cables. I forgot to take a pic of the innards with all the parts connected, but i’ll do that today. Here’s a picture of the motherboard, pretty handy-looking huh?

motherboard

The Asus Motherboard

So when everything was connected, it was time to put the case back together, and prepare for installation. The plan is to install Ubuntu 9.10, with XBMC 9.11.  A few more pics of the ready build. Note the fucking awesome blue led, without which, this build would be like, less cool.

Done!

Done!

A view from the top

HTPC 2010

I finally got off my lazy ass and ordered the parts for my HTPC. The build itself, is inspired by Anteuz’ build, which i had the pleasure of fiddling with last weekend. The build was very convincing visually, as well as performance-wise.

I’ll document the entire process of building, installing and configuring on this blog. The first part: The Buy

The Buy

The first task in any computer project is deciding what you want the build to do. I set some goals for this build:

  • Has to be visually appealing, and suitable for my livingroom (that means, slim, silent and black)
  • Has to be able to play 1080p media (and anything below that of course)
  • Has to be usable with a cordless keyboard & mouse and/or remote control
  • Has to be able to run Linux
  • Has to not cost me an arm and a leg!
  • Hast to have some form of expandability, say if i want a Bluray drive later!

Setting out with these goals in mind, the only reasonably priced hardware that does all this is based on the Nvidia ION chipset. The build Anteuz has is a:

  • Asus AT3N7A-I Motherboard
    • Atom 330 dual core processor
    • Nvidia ION chipset
    • Gbit Ethernet
    • 8GB RAM (DDR2) max.
    • DVI/VGA/HDMI/SPDIF etc. outputs
  • 2 x 1GB DDR2 RAM
  • Hard drive
  • Silverstone Lascala SST-LC19S-R with 120W passively cooled powersupply

I ended up ordering pretty much the same set:

  • Asus AT3N7A-I Motherboard (126€ @ Jimm’s Pc-Store)
  • 2 x 1GB DDR2 (800MHZ) (44€ @ Verkkokauppa)
  • Silverstone Lascala SST-LC19S-R (160€ @ Jimm’s Pc-Store)

But as for storage i ended up with a slightly different solution:

  • SATA -> Compact Flash adapter (22€ @ Verkkokauppa)
  • 4 or 8 GB Compact Flash card from Sandisk, the Extreme III model (with ~30MB/s read and write) (34 – 51 € @ Verkkokauppa and elsewhere)

What i’m going to be doing is, putting Ubuntu on the Compact Flash card (which is completely quiet, low power, and physically small). I don’t need a lot of space for Ubuntu, since it’ll be a barebones install, with the XBMC media center application on top, it’ll hardly take more than 2 GB.

I’m not going to store any media on the HTPC, but instead, stream it over the network from my fileserver. With Gbit Ethernet, i’ll be able to stream 1080p content with no problems. The network “backbone” is an HP Procurve 1400-8G, which has more than enough throughput and oomph for my small network.

The total price for the build is 386€ with the 4GB Sandisk Extreme III (add 20 bucks for the 8GB version). For less than 400€, i will therefore have a build that can stream HD media from my network.

A future expansion will be a slim blu-ray drive, which runs at around 150€ right now, which is not a bad price. The hardware is more than capable of playing blu-ray discs in their full 1080p,  surround sound glory. And that’s cheaper than a Playstation 3, which has no games anyway :)

Next up, when i get the parts: Pictures and The Build. After that, it’s time for The Install and then The Conclusion.