Nexus 4 Dual Boot - Android and Ubuntu
Note : Dual boot is not part of the regular Ubuntu release
After installation:
- A single device with the ability to switch between fully functional Android and Ubuntu images
- On Android: an Ubuntu Installer app to install Ubuntu, as well as to boot into Ubuntu
- On Android: the SuperUser app to grant permissions to the Ubuntu Installer app
- On Ubuntu: an Ubuntu Dual Boot app to boot into Android
- Ubuntu system updates are not yet supported from the Ubuntu side, but they can be done via the Android app
Requirements
To install dual-boot, you'll need:
- A Nexus 4 device (other supported Nexus devices should in theory work but have not been tested at the time)
- Android 4.2 or higher running on the device, either stock firmware or based on CyanogenMod or AOSP. Note that Android 4.4 requires additional steps to get phone calls working on the Ubuntu side
- 2.7GB of free storage on the device to install Ubuntu
- ADB tools running on your desktop computer
- The device needs its bootloader to be unlocked and USB debugging enabled. Follow steps 1 to 3 below to do this, or alternatively, if your device is already unlocked and has USB debugging enabled, you can skip to the installation process
Step 1 - Desktop Setup
The following steps are required on your desktop system that you'll need in order to flash and communicate with the device.Set up the Touch Developer Preview Tools PPA
The PPA has the tools and dependencies to support Precise, Quantal, Raring and Saucy. Add the Ubuntu Touch PPA by adding the following custom source list entry to your /etc/apt/sources.list file.On your computer, press Ctrl+Alt+T to start a terminal.sudo add-apt-repository ppa:phablet-team/tools
Then do the following:sudo apt-get update sudo apt-get install phablet-tools android-tools-adb android-tools-fastboot
Step 1.5 - Optional Android Backup
- If not enabled, enable developer mode, by tapping Settings -> About phone -> Build number (x 7 times)
- If not enabled, enable usb debugging in Settings -> Developer options -> USB debugging
- Execute on your computer $ adb backup -apk -shared -all
This should hopefully create backup.ab with all of your apps, OS, and data. Later, after reflashing with android (or rooting / unlocking) you will be able to use $ adb restore backup.ab to restore all of your data.Step 2 - Device unlock
If the device is already unlocked, skip to Step 3. These steps will wipe all personal data from the device.- With the device powered off, power on the device by holding the Power button + volume up + volume down.
- The device will boot into the bootloader.
- Plug the device into the computer via the USB cable.
- On your computer, press Ctrl+Alt+T to start a terminal. Type sudo fastboot oem unlock, followed by Enter
- On the device screen, accept the terms of unlocking.
- Boot the device by pressing the power button (pointed by an arrow with Start on the screen).
Device factory reset
If you get stuck in a bootloop rebooting the tablet after unlocking the bootloader... Here's what you do:- During the bootloop.. hold the power button + volume up + volume down button simultaneously to get yourself back into fastboot mode as you were previously.
- In fastboot mode.. use the volume keys to scroll to Recovery and the power button to select it.
- In Recovery (Android robot on his back with a red triangle)... tap the volume up button and the power button simultaneously which will bring you into stock recovery. Again.. Don't hold the buttons, just tap them simultaneously. Also make sure you're holding the correct volume button. Up will be the volume key on the right.
- Once you're in Recovery.. perform a factory reset/data wipe and then reboot your tablet... you should now be back to the Welcome Screen.
Step 3 - Initial Device Setup
Follow these initial steps on your device:- If not booted, boot the device into Android
- Enable USB debugging on the device
- on Ice Cream Sandwich (version 4.0) go to Settings and turn on USB Debugging (Settings > System > Developer options > USB debugging).
- on Jelly Bean (versions 4.1 and 4.2) you need to enter Settings, About [Phone|Tablet] and tap the Build number 7 times to see the Developer Options.
- on 4.2.2, (settings > about > tap on build number 7 times to activate the developer options menu item).
- On either Android version you must then enable USB debugging via Settings > Developer options > USB debugging. You will also need to accept a host key on the device.
- On the workstation-> adb kill-server; adb start-server
- Plug the device into the computer via the USB cable.
- Depending on the installed Android version, a popup will show up on the device with the host key that needs to be accepted for the device to communicate with the workstation.
- Note, 'adb devices' should not show the device as 'offline'. If it does, unplug the device, run adb under sudo on the workstation (sudo adb kill-server; sudo adb start-server), then plug the device back in.
- In some cases, the device will continue to show offline, and the host key popup will not appear if the USB connection method is 'MTP' (default for some devices and versions of Android). Unchecking all options in the USB connection method (Settings -> Storage -> Menu -> USB computer connection -> MTP, PTP) seems to resolve this adb connection issue for some users.
- Save the version of the current image on the device, if on Android, to use as a reference to revert back to. The version can be found by going to Settings > About Phone > Build Number.
Newer Nexus 10s have not booted fully after developer mode was enabled. If this occurs boot into the bootloader and do "fastboot -w", then proceed to the next step.Dual boot installation instructions
Installing the Ubuntu Installer app in Android
- On your computer, download the dual boot installation script into your home directory from: http://humpolec.ubuntu.com/latest/dualboot.sh
- Open a terminal on your computer pressing the Ctrl+Alt+T key combination
- Make the installation script executable by running this command:
chmod +x dualboot.sh
- Ensure that your device:
- has booted normally into the Android user interface
- has USB debugging enabled
- has an unlocked bootloader
- Connect your device via USB to your computer
- Install dual-boot by running one of these commands on a terminal:
- If it's the first-time dual-boot installation and you are using stock Android or AOSP firmware without the SuperUser app, run this command:
./dualboot.sh FULL
- Alternatively, to update only the Ubuntu Installer Application or if you are running non-stock Android firmware (e.g. CyanogenMod), run this command:
./dualboot.sh UPDATE
After installation, the phone will reboot several times. Once finished, it will boot into Android and you will find the dual boot app as “Ubuntu Installer” in the Apps section.Now follow the instructions below to install Ubuntu from Android.Installing Ubuntu from Android
Note: 2.7GB of free memory space is required on your device for the Ubuntu installation.- Optionally, on your desktop, and while your device is still connected via USB, issue the following command on the terminal to free up space (say "Yes" if you are asked to grant permissions on the device):
adb shell "su sh rm -rf /cache/*"
- On the device, press the apps button in Android to bring up the list of apps
- Browse the apps to find the Ubuntu Installer icon and press it to start the app
- When the app launches, press on Choose channel to install and choose a channel to download from (the recommended channel is Trusty)
- Once download is completed you need to Grant SU permissions to the application for the install to be successful. Press the Grant button, when prompted.
- Press the Reboot to Ubuntu button to boot to Ubuntu.
- A standard phone reboot with the hard key will always boot to Android.
Notes:- All channels supported by the phablet-flash tool are also supported by the Ubuntu Installer on Android
- When selecting an Ubuntu channel, the bootstrap checkbox lets you wipe user data from Ubuntu, otherwise it is kept between installations. Since you're installing for the first time now, it won't make a difference
- When selecting an Ubuntu channel, unticking the latest version checkbox will let you select a particular image number. Otherwise, if checked it will default to the latest image.
- If during installation the Ubuntu download finished while the phone was locked or when the Ubuntu Installer app was not on the foreground, the installation button will change to Resume install. This will resume installation to the point where SuperUser permissions are requested.
Additional notes
Updating to a new Ubuntu image
Because Dual Boot is a special set-up the standard update method for Ubuntu currently does not work (see Feature Roadmap).To update Ubuntu to a newer version, On the android Ubuntu dual boot application, select "Uninstall Ubuntu" from the menu options. Next you will be asked if you want to keep the user data from Ubuntu. If you do not select "Delete user data", the next installation of Ubuntu will preserve your contacts, installed applications, pictures, background settings, ...Once Ubuntu has been uninstalled, follow the same installation step to download a newer version of Ubuntu.Getting phone calls to work in Ubuntu and Android 4.4
The radio image shipped with Android 4.4 is reused on the Ubuntu side to make phone calls or use WiFi or sound, and it is not yet supported in Ubuntu. Until Ubuntu gains support for the Android 4.4 radio, there is an easy workaround whereby an older radio firmware can be flashed in the modem partition. You can do this either before or after installing dual bootFollow these steps to downgrade the radio firmware and get Ubuntu calls to work:- Download an Android 4.3 firmware for your device onto your PC. Follow the links on this table >
- Open a terminal with Ctrl+Alt+T
- Extract the firmware tarball and cd to its directory.
- Run the following command to reboot into the bootloader
adb reboot bootloader
- Once in the bootloader, run this command to reflash the radio. Replace $RADIO_FIRMWARE by the name of the file containing the radio firmware for your device (it's easily recognizable, as it starts with radio-$DEVICECODENAME):
fastboot flash radio $RADIO_FIRMWARE.img
- After flashing, reboot and phone calls should work in Ubuntu:
fastboot reboot
If something goes wrong
If something goes wrong after the dual boot installation and you cannot boot either into Ubuntu or Android, you can revert the Android installation to the status it was before dual boot by reflashing the original boot and recovery images. Only the recovery partition is actually modified by dual boot, but you can choose to reflash the boot partition just in case.- Download the Android firmware you are running on your device onto your PC.
- Open a terminal with Ctrl+Alt+T
- Extract the firmware tarball and cd to its directory.
- Run the following command to reboot into the bootloader
adb reboot bootloader
- Once in the bootloader, run this command to reflash the boot partition:
fastboot flash boot boot.img
- Without exiting the bootloader, run this command to reflash the recovery partition:
fastboot flash recovery recovery.img
- After flashing, reboot and your phone should start into Android:
fastboot reboot
source:
Comments
Post a Comment