Installing Ubuntu on the Nexus7 |
This project is no longer maintained. You might be interested in Ubuntu Touch though. |
So you're interested in the Ubuntu kernel running on the Nexus7? That's great. We need people helping us out with the kernel.
General information
Nexus 7 Kernel Notes
This is a collection of notes about the nexus 7 kernel relevant to discussions planned for UDS-R.
Kernel Delta
The nexus 7 kernel is based off of the 3.1.10 stable kernel with approximately 6100 additional non-merge commits. Many (likely most) of these are related to hardware support, including support for the tegra 3 SoC, nexus 7 board, and additional devices.
The following sections outline hardware support in the nexus 7 kernel that is not in mainline Linux as of the 3.7 merge window. Note that the list is a work in progress -- some hardware may be missing, and some drivers in the list may not actually be needed for the nexus 7.
Also noteworthy is the fact that in some places Google has squashed together a bunch of individual commits into a single commit. Therefore the raw change counts below may not be representative of the actual number of changes. The Original Google repository can be found at https://android.googlesource.com/kernel/tegra/. We sync up with new branches corresponding to new firmware updates there as Google makes them available.
Tegra 3 SoC Support
- Trusted foundations driver: Probably related to DRM (as in digital rights management, not kernel modesetting). ogra reports that the nexus 7 will not boot without this driver.
- Thermal support
- Pin muxing: This might be present upstream, but it's certainly different than in the kernel from Google. Could also be expected that pin muxing is done by the bootloader.
- SPI
- Display/graphics
- PMU
- USB: Possible differences in support, needs a closer look.
- Watchdog timer
- tegra-avp (audio/video processing)
- tegra_camera
- tegra-se (security engine): Crypto acceleration. There is a separate driver for AES acceleration that's present both upstream and in the kernel from Google.
- tegra30-dam: This is related to audio.
- tegra30-spdif
- tegra30-dit: This is related to audio.
- tegra-pcm-audio
- tegra30-hda: Looks related to HDMI, likely audio.
- tegra-sensor
- Video capture: For camera support.
- tegra-baseband: For baseband modem support.
- tegra-cryptodev: Provides device node access to AES acceleration.
Device Drivers
- max17048: Gas gauge chip for battery status information.
- bq27541-battery: Gas gauge chip for battery status information.
- smb347: Battery charger chip. There is a driver upstream, but it's completely different from the one in Google's kernel.
- rt5640: DSP
- rt5639: Audio codec
- bcm4330_rfkill: Looks like a driver for implementing rfkill support for the wireless devices based off of a GPIO pin.
- ektf3k: Touchscreen
- max77663: PMIC
- bcmdhd: Broadcom full-MAC wireless device. Possibly supported upstream by brcmfmac.
- switch_class/switch_gpio: Provide sysfs/uevent interface to userspace for hw switches.
- ltr558als: Ambient light sensor
- inv-ami305: Compass
- inv_mpu: Probably an accelerometer
- mi1040: Camera sensor
- nct1008: Temperature monitoring device
- max1749: Vibrator
- max77663: Multi-function device (PMIC, RTC, etc.)
- ricoh583: Multi-function device (PMIC, RTC)
- tps8003x: Multi-function device (PMIC, RTC)
Other Significant Changes
- A good number of the non-arch and non-driver patches appear to be backports, although it's unclear how many. A quick survey of some of the changes to core kernel code seems to indicate that most of those changes are backports.
- Google's kernel has extensive modifications to the networking code. Some of these are around security, others add features that Android userspace uses which are not likely to be needed for Ubuntu. However some appear to be legitimate bug fixes that may not be upstream.
- Google kernel exports chip and pcb ids via sysfs. Might not be needed, unless we need to account for hardware version differences in userspace somehow.
- Android drivers. These are supported to various degrees in mainline under the staging tree, but we shouldn't need most of them if we need any at all. Some drivers are not in staging however:
switch_class/switch_gpio: Provides sysfs/uevent interface to userspace for hw switches connected to GPIOs. Note: This has likely been superseded upstream by the extcon driver.
- gpio_output/gpio_axis/gpio_event/gpio_input/gpio_matrix
- keychord: Driver to provide notifications when specified key combinations are pressed.
Breakdown of changes on top of 3.1.10
Paths with no changes were omitted.
- Total non-merge commits on top of 3.1.10: 6069
- Broken down by subdirectories
- /arch: 3130
- /arm: 3112
- /ia64: 4
- /s390: 2
- /sh: 1
- /sparc: 9
- /x86: 8
- /block: 4
- /crypto: 5
- /Documentation: 17
- /drivers: 2655
- /base: 110
- /bluetooth: 12
- /char: 3
- /cpufreq: 52
- /cpuidle: 1
- /crypto: 49
- /dma: 8
- /gpio: 24
- /gpu: 38
- /hid: 5
- /hwmon: 37
- /i2c: 45
- /infiniband: 1
- /input: 107
- /iommu: 89
- /leds: 1
- /md: 6
- /media: 188
- /mfd: 108
- /misc: 101
- /mmc: 116
- /mtd: 15
- /net: 219
- /nfc: 5
- /oprofile: 1
- /pci: 1
- /power: 61
- /regulator: 101
- /rtc: 57
- /s390: 1
- /scsi: 4
- /spi: 34
- /ssb: 1
- /staging: 48
- /switch: 2
- /tty: 51
- /usb: 316
- /video: 661
- /w1: 2
- /watchdog: 13
- /fs: 27
- /ecryptfs: 5
- /ext4: 2
- /fat: 1
- /fuse: 1
- /nfs: 2
- /nilfs2: 1
- /partitions: 4
- /proc: 5
- /xfs: 2
- /yaffs2: 3
- /include: 540
- /init: 3
- /kernel: 74
- /lib: 3
- /mm: 14
- /net: 88
- /sctp: 2
- /sunrpc: 1
- /wireless: 9
- /xfrm: 1
- /security: 8
- /sound: 238
- /virt: 3
- /arch: 3130
Restricted Drivers
This page is a running record of any third party or restricted drivers utilized within the Nexus7 image.
- Updated 2012-10-25
Overview
See https://developers.google.com/android/nexus/drivers for the latest OTA update available and Nexus7 specific drivers.
Currently: the Nexus7 image is only shipping the Broadcom wireless and bluetooth firmware which is required for functionality within the linux-firmware package as well as nvidia-tegra3 which is provided from the Ubuntu archive. Lastly, Cardhu video codecs have been included from nVidia to support video playback.
Possible: no further inclusions planned
component |
source |
present in image |
notes |
wireless |
YES |
Required for functionality provided via linux-firmware |
|
bluetooth |
YES |
Required for functionality, provided via linux-firmware |
|
graphics |
YES |
Required for functionality, provided via nvidia-tegra3 package |
|
video codecs |
YES |
Required for functionality, video playback support |
|
touchscreen |
NO |
May be required if full functionality is not present with in-tree firmware investigation |
Building the kernel
Here's how to cross-build the kernel from the git repository.
Initial setup
Having ccache installed is optional but helpful if you are often rebuilding the package from scratch with minor modifications.
sudo apt-get install gcc-arm-linux-gnueabihf ccache git kernel-wedge libncursesw5-dev
Get the source:
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-nexus7.git
Create an alias called fdr that points to fakeroot debian/rules. You can stick this in ~/.bash_aliases and then source the file to make it permanent.
alias fdr="fakeroot debian/rules"
Rebuild the package
Go to the source directory
cd ubuntu-nexus7
Remove leftover from previous builds or other cruft
git clean -xdf
You need to do the following in order to disable cross-building of the linux-tools binary package, as that requires multiarch setup and some armhf libs installed in the host system.
sed -i '/do_tools/ s/true/false/' debian.linaro/rules.d/armhf.mk
Calling fakeroot debian/rules (fdr) clean is necessary before each build.
fdr clean
Next we create the package, and depending on your system speed, ccache and on the kernel configurations that are enabled it can take anywhere between 3 minutes and a couple of hours. The value for parallel works best when it equals the number of CPUs in your system + 1.
debuild -eDEB_BUILD_OPTIONS="parallel=3" -eCROSS_COMPILE="ccache arm-linux-gnueabihf-" -b -aarmhf -us -uc -nc
Change the configuration
The configuration file is in debian.linaro/config/config.common.ubuntu
Bring up menuconfig
fdr editconfigs
See what you have changed
git diff
Or edit that file manually and then updateconfigs so it checks your changes and fixes up any possible side-effects
fdr updateconfigs
Then run debuild again as above
Build zImage only
Sometimes you just want a zImage for a quick test such as inserting it in a boot.img and trying it out without a full deb installation.
This does an out of source tree build of a zImage (no modules) using the current Ubuntu configs. Faster than a full package build. Like the value for parallel mentioned above, the -j value works best when it is number of CPUs + 1.
cd ubuntu-nexus7 mkdir ../build cp debian.linaro/config/config.common.ubuntu ../build/.config CROSS_COMPILE="ccache arm-linux-gnueabihf-" ARCH=arm make O=../build -j3 zImage