Difference between revisions of "Dragonboard/APQ8060A"

From eLinux.org
Jump to: navigation, search
(Fix style)
 
(16 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
<big><big>APQ8060A Linux upstream work</big></big>
 
<big><big>APQ8060A Linux upstream work</big></big>
  
This documentation is for folks who who want to work on ramping up linux upstream development based on APQ8060A. You'll need am armel toolchain installed. Below are documentation for Linux distributions.
+
This documentation is for folks who who want to work on ramping up linux upstream development based on APQ8060A. APQ8060A is based on a family of chipsets based on 8960: 8960, 8060a, 8064, 8930.
 +
 
 +
You'll need am armel toolchain installed. Below are documentation for Linux distributions.
  
 
<big><big>Getting gcc-armel on Debian</big></big>
 
<big><big>Getting gcc-armel on Debian</big></big>
Line 8: Line 10:
 
Add this to your /etc/apt/sources.list:
 
Add this to your /etc/apt/sources.list:
  
:deb http://www.emdebian.org/debian testing main
+
<pre>
 +
deb http://www.emdebian.org/debian testing main
 +
</pre>
  
 
Then do
 
Then do
  
:sudo apt-get update
+
<pre>
:sudo apt-get install gcc-4.4-base-armel-cross
+
sudo apt-get update
 +
sudo apt-get install gcc-4.4-base-armel-cross
 +
</pre>
  
 
<big><big>Updating environment</big></big>
 
<big><big>Updating environment</big></big>
Line 19: Line 25:
 
Add to your .bashrc:
 
Add to your .bashrc:
  
:export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-gcc-4.4
+
<pre>
 +
export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-
 +
</pre>
  
 
It would also help if you have a simple script called '''make-arm''' in your PATH somewhere that does this:
 
It would also help if you have a simple script called '''make-arm''' in your PATH somewhere that does this:
  
:make ARCH=arm O=../kobj $@
+
<pre>
 
+
make ARCH=arm O=kobj $@
 +
</pre>
  
 
<big><big>Get the code</big></big>
 
<big><big>Get the code</big></big>
  
As it stands this code is available from codeaurora and the master branch has issues to clone so just clone the msm-3.4 branch:
+
We are going to be relying on two trees, one from CAF and another one that is used for upstream development and is synched regularly to Linus. The goal is to get rid of the delta. There is an issue with the CAF git tree master branch so use the jb_2.5 branch.
  
:git clone git://codeaurora.org/quic/la/kernel/msm.git msm-3.4
+
<pre>
 +
git clone git://codeaurora.org/quic/la/kernel/msm.git jb_2.5
 +
git clone git://git.kernel.org/pub/scm/linux/kernel/git/davidb/linux-msm.git
 +
</pre>
  
<big><big>Building</big></big>
+
The way to think about this:
  
:mkdir kobj
+
* jb_2.5: things not upstream
:cp arch/arm/configs/msm_defconfig kobj/.config
+
* linux-msm: target upstream -- you should be on the for-next branch
:make-arm menuconfig
+
 
:make-arm -j 4
+
<big><big>Building jb_2.5</big></big>
 +
 
 +
<pre>
 +
mkdir kobj
 +
cp arch/arm/configs/msm8960_defconfig kobj/.config
 +
make-arm menuconfig
 +
make-arm -j 4
 +
</pre>
 +
 
 +
<big><big>Building linux-msm</big></big>
 +
 
 +
<pre>
 +
mkdir kobj
 +
cp arch/arm/configs/msm_defconfig kobj/.config
 +
make-arm menuconfig
 +
make-arm -j 4
 +
</pre>
 +
 
 +
<big><big>Getting your initrd</big></big>
 +
 
 +
For jb_2.5 you'll want to get the ramdisk that came with you original boot.img, the interweb has a script [https://bitbucket.org/celtus/huaweis7/src/d4b55983392aa7a1bb6451154354ceca7cbacffa/port-tools/unpack-H.pl unpack-H.pl] that you can use to extract it:
 +
 
 +
<pre>
 +
unpack-H.pl boot.img
 +
</pre>
 +
 
 +
Your ramdisk will be named boot.img-ramdisk.gz
 +
 
 +
<big><big>Creating your own ramdisk</big></big>
 +
 
 +
The Android ramdisks gzipped compressed ASCII (crc) CPIO archives. To create your own with a simple sleep init you can compile a simple init as follows:
 +
 
 +
<pre>
 +
$ cat init.c
 +
#include <stdio.h>
 +
 
 +
int main(int argc, char *argv)
 +
{
 +
printf("Init has kicked off, sleeping now...\n");
 +
sleep(999999999);
 +
}
 +
 
 +
$ /usr/bin/arm-linux-gnueabi-gcc -static -o init init.c
 +
</pre>
 +
 
 +
Now to create your ramdisk:
 +
 
 +
<pre>
 +
$ ls | cpio -H crc -ov > foo.cpio
 +
$ gzip -9 foo.cpio
 +
</pre>
 +
 
 +
Your final foo.cpio.gz is your ramdisk.
 +
 
 +
<big><big>Enabling debug</big></big>
 +
 
 +
Enable a few kernel debugging flags:
 +
 
 +
  * CONFIG_DEBUG_LL
 +
  * CONFIG_EARLY_PRINTK
 +
 
 +
<pre>
 +
Kernel Hacking -->
 +
    Kernel low-level debugging functions (read help!)
 +
    Early printk
 +
</pre>
 +
 
 +
You do not need to enable anything under " Kernel low-level debugging port (No low-level debugging UART)", that is, you ''do not'' need CONFIG_DEBUG_ICEDCC or CONFIG_DEBUG_SEMIHOSTING.
 +
 
 +
<big><big>Disabling a few Android config options</big></big>
 +
 
 +
These should be ''disabled''!
 +
 
 +
  * CONFIG_ANDROID_PARANOID_NETWORK
 +
<pre>
 +
Networking support  --->
 +
  Networking options  --->
 +
    Only allow certain groups to create sockets
 +
</pre>
 +
 
 +
  * CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES
 +
<pre>
 +
Device Drivers -->
 +
  Staging drivers (STAGING [=y])
 +
    Android -->
 +
      Android Drivers (ANDROID [=y])
 +
        Android Low Memory Killer (ANDROID_LOW_MEMORY_KILLER [=y])
 +
</pre>
 +
 
 +
<big><big>Enabling APQ8060A</big></big>
 +
 
 +
The jb_2.5 branch lacks some code to get the APQ8060A booted. The patches are available from Intrinsic though, and at least the first one is required to sort of boot the device. The next task is to figure out what else is needed.
 +
 
 +
With the first patch from Intrinsic applied on the jb_2.5 branch you will need to enable:
 +
 
 +
  * CONFIG_MACH_APQ8060A_DRAGON
 +
 
 +
<pre>
 +
System Type  --->
 +
  MSM Board Selection  --->
 +
    [*] APQ8060A Based Dragonboard 
 +
</pre>
 +
 
 +
<big><big>Latest boot log</big></big>
 +
 
 +
This is the latest boot log.. with just one pending patch applied (out of I don't know how many left) to the jb_2.5 branch to be able to start hacking.
 +
 
 +
Latest log With battery plugged in:
 +
 
 +
https://gist.github.com/mcgrof/5493467
 +
 
 +
A good boot log with the built-in shipping kernel:
 +
 
 +
https://gist.github.com/mcgrof/5470735
 +
 
 +
This is based on porting Intrinsic's changes onto the jb_2.5 kernel... waiting to see if we can post this.
  
 
<big><big>Generating initial boot image</big></big>
 
<big><big>Generating initial boot image</big></big>
  
The APQ8060A will have shipped with an Android boot loader so you need to first get the kernel you built into a format it will like. This section will be expanded soon.
+
The APQ8060A will have shipped with an Android boot loader so you need to first get the kernel you built into a format it will like. This section will be expanded soon. Right now this is a placeholder for some more details to be added later.
 +
 
 +
* jb_2.5: package 8960 boot.img-ramdisk.gz --cmdline="console=ttyMSM0,115200,n8"
 +
* linux-msm: package 8960dt --cmdline="console=ttyMSM0,115200,n8"

Latest revision as of 02:52, 1 May 2013

APQ8060A Linux upstream work

This documentation is for folks who who want to work on ramping up linux upstream development based on APQ8060A. APQ8060A is based on a family of chipsets based on 8960: 8960, 8060a, 8064, 8930.

You'll need am armel toolchain installed. Below are documentation for Linux distributions.

Getting gcc-armel on Debian

Add this to your /etc/apt/sources.list:

deb http://www.emdebian.org/debian testing main

Then do

sudo apt-get update
sudo apt-get install gcc-4.4-base-armel-cross

Updating environment

Add to your .bashrc:

export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-

It would also help if you have a simple script called make-arm in your PATH somewhere that does this:

make ARCH=arm O=kobj $@

Get the code

We are going to be relying on two trees, one from CAF and another one that is used for upstream development and is synched regularly to Linus. The goal is to get rid of the delta. There is an issue with the CAF git tree master branch so use the jb_2.5 branch.

git clone git://codeaurora.org/quic/la/kernel/msm.git jb_2.5
git clone git://git.kernel.org/pub/scm/linux/kernel/git/davidb/linux-msm.git

The way to think about this:

  • jb_2.5: things not upstream
  • linux-msm: target upstream -- you should be on the for-next branch

Building jb_2.5

mkdir kobj
cp arch/arm/configs/msm8960_defconfig kobj/.config
make-arm menuconfig
make-arm -j 4

Building linux-msm

mkdir kobj
cp arch/arm/configs/msm_defconfig kobj/.config
make-arm menuconfig
make-arm -j 4

Getting your initrd

For jb_2.5 you'll want to get the ramdisk that came with you original boot.img, the interweb has a script unpack-H.pl that you can use to extract it:

unpack-H.pl boot.img

Your ramdisk will be named boot.img-ramdisk.gz

Creating your own ramdisk

The Android ramdisks gzipped compressed ASCII (crc) CPIO archives. To create your own with a simple sleep init you can compile a simple init as follows:

$ cat init.c 
#include <stdio.h>

int main(int argc, char *argv)
{
	printf("Init has kicked off, sleeping now...\n");
	sleep(999999999);
}

$ /usr/bin/arm-linux-gnueabi-gcc -static -o init init.c

Now to create your ramdisk:

$ ls | cpio -H crc -ov > foo.cpio
$ gzip -9 foo.cpio

Your final foo.cpio.gz is your ramdisk.

Enabling debug

Enable a few kernel debugging flags:

 * CONFIG_DEBUG_LL
 * CONFIG_EARLY_PRINTK
Kernel Hacking -->
    Kernel low-level debugging functions (read help!)
    Early printk

You do not need to enable anything under " Kernel low-level debugging port (No low-level debugging UART)", that is, you do not need CONFIG_DEBUG_ICEDCC or CONFIG_DEBUG_SEMIHOSTING.

Disabling a few Android config options

These should be disabled!

 * CONFIG_ANDROID_PARANOID_NETWORK
Networking support  --->
  Networking options  --->
    Only allow certain groups to create sockets
 * CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES
Device Drivers -->
  Staging drivers (STAGING [=y])
    Android -->
      Android Drivers (ANDROID [=y])
        Android Low Memory Killer (ANDROID_LOW_MEMORY_KILLER [=y])

Enabling APQ8060A

The jb_2.5 branch lacks some code to get the APQ8060A booted. The patches are available from Intrinsic though, and at least the first one is required to sort of boot the device. The next task is to figure out what else is needed.

With the first patch from Intrinsic applied on the jb_2.5 branch you will need to enable:

 * CONFIG_MACH_APQ8060A_DRAGON
System Type  ---> 
  MSM Board Selection  ---> 
    [*] APQ8060A Based Dragonboard  

Latest boot log

This is the latest boot log.. with just one pending patch applied (out of I don't know how many left) to the jb_2.5 branch to be able to start hacking.

Latest log With battery plugged in:

https://gist.github.com/mcgrof/5493467

A good boot log with the built-in shipping kernel:

https://gist.github.com/mcgrof/5470735

This is based on porting Intrinsic's changes onto the jb_2.5 kernel... waiting to see if we can post this.

Generating initial boot image

The APQ8060A will have shipped with an Android boot loader so you need to first get the kernel you built into a format it will like. This section will be expanded soon. Right now this is a placeholder for some more details to be added later.

  • jb_2.5: package 8960 boot.img-ramdisk.gz --cmdline="console=ttyMSM0,115200,n8"
  • linux-msm: package 8960dt --cmdline="console=ttyMSM0,115200,n8"