Template:Luneos build

From WebOS-Ports
Revision as of 16:39, 16 August 2013 by Herrie (talk | contribs)
Jump to navigation Jump to search



Build WebOS Ports Open webOS

Prepare the Build Environment

[[comment_prepare-build-environment-for-{{{devicename}}}|Add a comment to this section]]


You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the WebOS Port Open webOS source code for another device, skip to Prepare the device-specific code.

Install the SDK

[[comment_install-the-sdk-for-{{{devicename}}}|Add a comment to this section]]
If you have not previously installed adb and fastboot, install the Android SDK. "SDK" stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more-- all from your computer.

Helpful Tip

While the SDK contains lots of different things-- the two tools you are most interested in for building WebOS Ports Open webOS are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

[[comment_install-the-build-packages-for-{{{devicename}}}|Add a comment to this section]]

Several "build packages" are needed to build WebOS Ports Open webOS. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you'll need:

git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jre openjdk-6-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc

In addition to the above, for 64-bit systems, get these:

g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

[[comment_create-the-directories-for-{{{devicename}}}|Add a comment to this section]]

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

[[comment_install-the-repo-command-for-{{{devicename}}}|Add a comment to this section]]

Enter the following to download the "repo" binary and make it executable (runnable):

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

Make sure that the ~/bin directory you just created is in your path of execution so that you can easily run the repo command even when you're not in ~/bin. Assuming you are using the BASH shell, the default in recent versions of Ubuntu, you can set it like this:

$ export PATH=${PATH}:~/bin

Helpful Tip

You can make this change to the path permanent for all future Terminal sessions:

$ gedit ~/.bashrc

This will launch a graphical text editor. Enter

export PATH=${PATH}:~/bin

on its own line, then save the file.

Initialize the WebOS Ports Open webOS source repository

[[comment_initialize-source-repository-for-{{{devicename}}}|Add a comment to this section]]

Enter the following to initialize the repository:

$ cd ~/android/system/
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1

Download the source code

[[comment_download-source-code-for-{{{devicename}}}|Add a comment to this section]]

To start the download of all the source code to your computer:

$ repo sync

The WOP manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e., don't add any options to sync). For reference, our current default values are -j4, and -c. The “-j4” part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j3 or -j2. “-c” will ask repo to pull in only the current branch, instead of the entire WOP history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from WebOS Ports Open webOS and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps

[[comment_get-prebuilt-apps-for-{{{devicename}}}|Add a comment to this section]]


$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won't see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

[[comment_prepare-the-specific-code-for-{{{devicename}}}|Add a comment to this section]]

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

<pre<noinclude></noinclude> style="color:green">$ source build/envsetup.sh

$ breakfast {{{device}}}

This will download the device specific configuration and kernel source for your device.


You MUST be using the newest version of repo or you will encounter errors with breakfast! Run repo selfupdate to update to the latest.

Helpful Tip

If you want to know more about what "$ source build/envsetup.sh" does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup_help page

Extract proprietary blobs

[[comment_extract-proprietary-blobs-for-{{{devicename}}}|Add a comment to this section]]

Now ensure that your {{{devicename}}} is connected to your computer via the USB cable and that you are in the ~/android/system/device/{{{vendor}}}/{{{device}}} directory (you can cd ~/android/system/device/{{{vendor}}}/{{{device}}} if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the right place in the vendor directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with "command not found" errors.


Your device should already be running the branch of WebOS Ports Open webOS you wish to build your own version of for the extract-files.sh script to function properly. If you are savvy enough to pull the files yourself off the device by examining the script, you may do that as well without flashing WebOS Ports Open webOS first.


It’s important that these proprietary files are properly extracted and moved to the vendor directory. Without them, WebOS Ports Open webOS will build without error, but you’ll be missing important functionality, such as the ability to see anything!

Turn on caching to speed up build

[[comment_turning-on-caching-for-{{{devicename}}}|Add a comment to this section]]

If you want to speed up subsequent builds after this one, type:

$ export USE_CCACHE=1

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot . To use this command, as with brunch, you must first do “. build/envsetup.sh” from ~/android/system. Notice there is a period and space (“. ”) in that command.

Start the build

[[comment_start-the-build-for-{{{devicename}}}|Add a comment to this section]]

Time to start building! So now type:

$ croot
$ brunch {{{device}}}</code;>

The build should begin.

Helpful Tip

If the build doesn't start, try lunch and choose your device from the menu. If that doesn't work, try breakfast and choose from the menu. The command make {{{device}}} should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot or brunch or lunch, be sure you’ve done the “ . build/envsetup.sh” command in this Terminal session from the ~/android/system directory.

If the build breaks...

[[comment_if-the-build-breaks-for-{{{devicename}}}|Add a comment to this section]]
  • If you experience this not-enough-memory-related error...
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/{{{device}}}/wop_{{{device}}}-ota-eng.root.zip] Error 1

...you may want to make the following change to:

$ system/build/tools/releasetools/common.py

Change: java -Xmx2048m to java -Xmx1024m or java -Xmx512m

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.