Categories
Canonical Computing

Ubuntu Touch Demo for Mobile Asia Expo

Last week, I attended Mobile Asia Expo (MAE) in Shanghai. It was my first experience of China, and I have to say I thoroughly enjoyed it. I got the chance to meet lots of folk from Canonical, as we all arrived from around the world to attend the trade show.

One of my tasks was to assist the London marketing team with loading the demo build we selected for showing off at the show. If you’d like to see it as well (what, you couldn’t fly to Shanghai to see it?), you can simply load it from our servers.

You’ll need a Nexus 4 or a Nexus 10 device, and you need to be prepared to replace the android software on it (you can go back). You need to setup the phablet-flash tool. The desktop setup part of our install instructions are sufficient, but the whole document is worth a read (this is still developer territory, and not quite for end users yet). Connect the device via it’s USB cable to your host Ubuntu desktop.

If your device has already been modified to run adb as root, the instructions are simple:

$ phablet-flash --legacy --revision raring/monthly-06  
$ phablet-network-setup  
$ phablet-demo-setup  

phablet-network-setup clones the current settings from the host laptop. If that’s not what you want you can configure the phone using it’s UI, before running phablet-demo-setup.

Note that you need ‘–legacy’ because our engineering teams have already moved forward to a new way of hosting the Android parts, and last weeks trade show image is old-style!

If your device needs to be prepared from scratch (it’s just come out of the box), then you need to use some extra steps:

First, boot the device to the bootloader (hold down the power key and volume down), and unlock it:

$ fastboot oem unlock

Now partition the storage, and format the data partitions:

$ fastboot -w

Now, download the binaries we’ll need.

$ phablet-flash -b -d mako -D --legacy --revision raring/monthly-06

Now load on the custom recovery image:

$ fastboot flash recovery ~/Downloads/phablet-flash/ubuntu-touch-preview/raring/raring/monthly-06/raring-preinstalled-recovery-armel+mako.img

Now, boot to recovery mode (select it from the bootloader menu), which has a working adb. We can push a zip to ‘/sdcard/autodeploy.zip’ and the recovery tool will flash it at next boot. First, do the android BSP:

$ adb push ~/Downloads/phablet-flash/ubuntu-touch-preview/raring/raring/monthly-06/raring-preinstalled-armel+mako.zip /sdcard/autodeploy.zip  
$ adb reboot recovery  

When the device has rebooted, and settles down to the charging icon, reboot it by hand to the recovery mode again, by booting to the bootloader and selecting recovery mode. We can now flash Ubuntu onto it:

$ adb push ~/Downloads/phablet-flash/ubuntu-touch-preview/raring/raring/monthly-06/raring-preinstalled-phablet-armhf.zip /sdcard/autodeploy.zip  
$ adb reboot recovery  

Now the device will boot into ubuntu, and you can add the demo content as before:

$ phablet-network-setup  
$ phablet-demo-setup  

If you have a Nexus 10, then substitute ‘manta’ where you see ‘mako’ above. Note that it needs both volume keys and the power button held down to get to the bootloader.

I found that sometimes this build would not populate the people lens correctly, or show the thumbnail pictures of contacts. I found that a reboot (after opening contacts in the phone app) worked to resolve it.

If you’re curious what changed to make these images ‘legacy’, it was the container switch, announced here.

Categories
Canonical Computing

Installing Ubuntu on a Macbook Pro (Retina 13″)

Or two ways to install Ubuntu 13.04 on a ‘MacBook Pro, 13″ with Retina display’ (also known as MacBookPro10,2)…

Having recently joined Canonical, my first task was to provision a laptop to work on, naturally running Ubuntu. Asking for advice about which models to choose, I was advised to seek out designs with Intel wifi & graphics adaptors, presumably down to the quality of the open source drivers available. The 13″ retina MacBook has a screen I wanted to use, and met half the criteria – it uses Intel graphics. I was also encouraged to believe that installing on a modern Mac had gotten a lot easier than the information readily available suggests, so I gambled on the wifi requirement. It seems to have paid off.

The major decision is how to host OS X. You need to maintain a copy to host the firmware updates occasionally issued by Apple – they make no pretense to support anything other than OS X as a host for these.

You can elect to have OS X on an external drive, or keep an internal partition with it on. The first implies that when the external drive is not connected, the PC will be ‘single booting’ to Ubuntu, and the internal storage can be entirely managed by Ubuntu. The second option implies a ‘dual boot’ setup, and dividing the internal storage between the two operating systems. Having chosen a single boot or dual boot configuration, a secondary decision is how to select between this OS X instance and Ubuntu at boot time. The Mac’s boot manager ‘Startup Manager‘ can easily cope with multiple boot options, but it does prefer to manage instances of OS X. I only enjoy using it when it can be used as with OS X, booting straight to some preferred default unless keys are held down. rEFInd is an excellent alternative boot manager, and I’ve used it in the dual boot configuration.

To dual boot

You need:

  • The MacBook
  • A bootable usb key with a 64-bit Ubuntu 13.04 image on it
  • rEFInd. You can download this during the process
  • A wifi network your Mac can join

The basic steps

  1. Boot OS X, and get the latest updates. Adjust the volume if you want to mute the boot chime
  2. Shrink the partition hosting OS X with ‘Disk Utility’
  3. Install rEFInd
  4. Install Ubuntu, using the 3rd party software offered (that’s where the wifi drivers are)
  5. Fix a couple of audio bugs

More detailed steps

  1. Boot the Macintosh, and walk through the OS X setup
  2. Now’s a good time to adjust the volume. If you mute now, the boot chime will also be muted – Ubuntu lacks a tool to control the boot chime.
  3. Allow OS X to update (via the App Store). This may take a few cycles, if several updates need applying in sequence, and will catch any firmware updates already issued.
  4. Using Disk utility, resize the partition hosting ‘Macintosh HD’ to the amount you want. This will silently include the OS X recovery partition, so I went for 30G.
  5. Restart OS X, and download ‘rEFInd’
  6. Install rEFInd, using the –esp option if you’d like to keep it independent of your OS X install.
  7. Restart, and confirm that rEFInd is now part of the boot sequence.
  8. Insert your Ubuntu USB key (use a 64-bit, not 64-bit Mac image, see notes below), and restart. Select the offered ‘EFI\boot\grubx64.efi’ to start the setup process
  9. Elect to ‘Install Ubuntu’
  10. Elect to ‘continue’ after selecting your language. You’ll have been informed you’re currently offline by a notification window.
  11. Elect to ‘Install this third party software’ and continue. This is where your wifi driver is coming from.
  12. Elect to set up the ‘Broadcom Corporation BCM4331 802.11a/b/g/n’, selecting ‘connect to this network’, and configuring your wifi details. ‘Connect’ attempts to connect, and you use the same button a second time (as ‘continue’) to proceed if the connection works.
  13. Choose ‘Install Ubuntu alongside Mac OS X’, and then ‘Install Now’.
  14. Select your location, and continue.
  15. Select your keyboard. In my case ‘English (UK) – English (UK, Macintosh)’ seemed sensible.
  16. Enter the details for your user account
  17. Allow the install to complete.
  18. Once you’ve first logged in, allow Ubuntu to pull down the updates since the CD image you used was mastered.
  19. After it reboots, and you log in, you may find your audio is mute. In which case, you’ve been bitten by bug 1169984, and you need to follow the workaround listed. When I wrote these notes the fix hadn’t made it to the auto-update set.
  20. You will find the built in microphone doesn’t work. To enable this, the snd_hda_intel module needs to be explicitly informed which model it is running on, so add:
    options snd-hda-intel model=mbp101
    to the file /etc/modprobe.d/alsa-base.conf (sudo nano /etc/modprobe.d/alsa-base.conf is a good choice, if you’re used to mac editors), and reboot one last time.
  21. You’re done!

To single-boot

You will need:

  • The MacBook
  • A bootable usb key with a 64-bit Ubuntu 13.04 image on it
  • An external drive you can install OS X to. I used a 32Gb USB key. Slow, but I won’t be running this often!
  • A wifi network your Mac can join

Note that rEFInd is not needed – whenever you want access to OS X, Apple’s Startup Manager can offer the option.

The basic steps

  1. Boot OS X and get the latest updates. Adjust the volume if you want to mute the boot chime
  2. Restart, and ask the Mac to boot its recovery partition. (Hold down ‘option/alt’ while it boots)
  3. Install a copy of OS X on your external drive
  4. Install Ubuntu, replacing the internal OS X, using the 3rd party software offered (that’s where the wifi drivers are)
  5. Fix up the Ubuntu EFI install, so the Mac Startup Manager can understand it
  6. Fix a couple of audio bugs

Whenever you want to boot to OS X you need to insert your usb key, and use ‘option/alt’ during boot to select it.

More detailed steps

  1. Boot the Macintosh, and walk through the OS X setup
  2. Now’s a good time to adjust the volume. If you mute now, the boot chime will also be muted – Ubuntu lacks a tool to control the boot chime.
  3. Allow OS X to update (via the App Store). This may take a few cycles, if several updates need applying in sequence, and it will catch any firmware updates already issued.
  4. Restart, holding down ‘option/alt’ (the label depends on your keyboard) as the boot starts, to get the Apple Startup Manager. Select the Recovery partition, and boot that.
  5. Insert your external drive, and if needed, use Disk Utility to arrange for it to have a single ‘Mac OS Extended (Journaled)’ partition with the device using a ‘GUID Partition Table’ (This part is in Options). Note that the utility will allow space for a recovery partition also. Quit to return to the recovery menu.
  6. ‘Reinstall OS X’, selecting your external drive as the target. The setup wizard can be configured as you wish, and it appears that an Apple ID is optional to set up the OS, and receive firmware and OS updates.
  7. Boot this version of the OS, and take the chance to make sure it is up to date. Shut it down, and remove the external drive.
  8. Insert your Ubuntu USB key (use a 64-bit, not 64-bit Mac image, see notes below), and boot to the Startup Manager using ‘option/alt’. Select one of the ‘EFI Boot’ options (both seem to work equally well).
  9. Select ‘Install Ubuntu’
  10. Elect to ‘continue’ after selecting your language. You’ll have been informed you’re currently offline by a notification window.
  11. Elect to ‘Install this third party software’ and continue. This is where your wifi driver is coming from.
  12. Elect to set up the ‘Broadcom Corporation BCM4331 802.11a/b/g/n’, selecting ‘connect to this network’, and configuring your wifi details. ‘Connect’ attempts to connect, and you use the same button a second time (as ‘continue’) to proceed if the connection works.
  13. Elect to ‘Replace Mac OS X with Ubuntu’. Given that we’re effectively taking over the machine, the wizard knows how to offer full disk encryption and LVM support. Use them if you wish, and enter the necessary encryption key if you do.
  14. Check the final dialog is proposing to install on the internal disk, and then start the install proper.
  15. Select your location, and continue.
  16. Select your keyboard. In my case ‘English (UK) – English (UK, Macintosh)’ seemed sensible.
  17. Enter the details for your user account
  18. Allow the install to complete.
  19. Reboot when prompted, removing the Ubuntu USB key.
  20. The Startup Manager thinks a bit, and then gives up, prompting you with a Folder icon with a question mark. Insert the Ubuntu USB key, and after booting it, elect to ‘Try Ubuntu without installing’. We’ll use Ubuntu to patch things up with Startup Manager.
  21. Bring up a terminal, mount your EFI partition (a relatively small FAT32 partition), and rename the bootloader ubuntu installed to have the default EFI name:
    $ sudo mkdir /boot/efi $ sudo mount /dev/sda1 /boot/efi $ sudo mv /boot/efi/EFI/ubuntu /boot/efi/EFI/BOOT $ sudo mv /boot/efi/EFI/BOOT/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
    You can now shutdown Ubuntu and remove the USB key. There may be other more sophisticated ways to patch up what Ubuntu and Startup Manager can agree via the dialect of EFI they have in common, but setting the bootloader name to the default works for now.
  22. Boot the machine, and it will take you straight to Ubuntu.
  23. Once you’ve first logged in, allow Ubuntu to pull down the updates since the CD image you used was mastered.
  24. After it reboots, and you log in, you may find your audio is mute. In which case, you’ve been bitten by bug 1169984, and you need to follow the workaround listed. When I wrote these notes the fix hadn’t made it to the auto-update set.
  25. You will find the built in microphone doesn’t work. To enable this, the snd_hda_intel module needs to be explicitly informed which model it is running on, so add:
    options snd-hda-intel model=mbp101
    to the file /etc/modprobe.d/alsa-base.conf (sudo nano /etc/modprobe.d/alsa-base.conf is a good choice, if you’re used to mac editors), and reboot one last time.
  26. You’re done!

Notes

If you’ve got one, the Thunderbolt ethernet adaptor works, and removes the need to install 3rd party software at install time to get on the internet. I assume you could then choose exactly which third party software you install post-setup, and get the wifi that way.

As far as what works, the screen is gorgeous, but I think it’s worth tweaking font sizes and so on to trade readability & screen real estate (Unity Tweak Tool is your friend). I like that Ubuntu gives me more choices here than OS X. The ‘function’ keys above the keyboard work similarly to OS X, with all but the launchpad (!) and mission control buttons mapping to Ubuntu functions. The keyboard & screen backlights work, as do the audio controls. The trackpad can be configured to support two finger scrolling in the same fashion as OS X, if you’re like me and already habituated to that.

It appears that an Apple ID is optional during setup of your OS X image, and the App Store still provides OS and firmware updates to machines without a logged in ID.

FWIW, I can see no reason you couldn’t configure a dual boot system to encrypt the Ubuntu installation, but the wizard can’t help you, and I’ve not explored the options (my machine single boots).

If you’re willing to live without OS X entirely you have two recovery options if you want to uninstall Ubuntu and return to OS X. You can create a standalone recovery USB key (needs less space than an OS X bootable disk), or you can depend on the internet recovery mode available in the Apple Startup Manager.

Ubuntu 13.04 is available in at least 3 desktop flavors: 32bit, 64bit, and ’64bit Mac’. Whilst the 32bit one clearly can work (I tried it, the OS did boot), you end up using a BIOS compatibility shim that Apple seem to have only intended for use with Windows. Having used the plain 64 bit install a lot while writing this, I did briefly try the mac flavour. My notes are poor, but I recall it didn’t work well on this modern Mac. Given the current support in the standard 64 bit installer, there seems to be no need to use it. Fortunately the default download page contains apparently good advice to select the standard 64 bit verson for a modern PC.

The built in microphone not working had me puzzled for a while, and I used a USB headset until I found the workaround. I was looking for information on hotplugging thunderbolt (which seems not to work yet), and found an installation guide for Fedora 18 that noted the crucial step of letting snd_hda_intel know it is running on an mpb101. With this step the built in audio is fully functional.

I am indebted to James Jesudason for his tutorial for installing on the 15″ Macbook for setting me on the right track.

Categories
Computing Miscellanea

Goodbye ARM, and thank you!

A short post to mark my leaving ARM, after just over three years, and to thank my ex colleagues for my leaving card and gift. I started in April 2010, after concluding Transmission Begins was not going to go where I wanted.

I’ve met lots of really interesting people, and learned a lot.

My last day was Friday, and I attach the suitably modified card I received:

A leaving card with the customised logo: Mali 3D Giants
Mali, 3D Giants!

Thank you all!