How to build an ubuntu VM that compiles B2G

1. Download Virtual Box and install it: https://www.virtualbox.org/wiki/Downloads
2. Download the 12.04 image:
http://sourceforge.net/projects/virtualboximage/files/Ubuntu%20Linux/12.04/ubuntu_12.04-x86.7z/download
3. “C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” modifyhd ubuntu_12.04.vdi –resize 524288
Note: 524288 for 512 gigs of space.

4. Launch Virtual Box
5. Create New
6. select : B2G, Type: Linux, Version: Ubuntu
7. Select the 12.04 image and create the image
8. Set the CD/DVD player to be live
9. use a ubuntu image to boot off.
10. Use gparted tool off a Ubuntu CD to repartition the space ( see : http://connection.rnascimento.com/2011/01/25/expanding-virtual-box-hard-disk-ubuntu-guest-os/ )

11. launch image: Active user account(s) (username/password): ubuntu/reverse

Note: If you want to share your Desktop, make sure the image is selected, then go to settings-> Shared Folders and select the “+” folder icon to the right.
Once you do that put in the folder path and the folder name and select the checkbox on how you want to set that folder.

12. install java : https://help.ubuntu.com/community/Java ,
13. install android sdk : http://developer.android.com/sdk/index.html
14. devices set : http://developer.android.com/tools/device.html
15. update android sdk

16. setup prereq: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Firefox_OS_build_prerequisites
17. sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git ia32-libs-multiarch:i386 libncurses5-dev:i386 zlib1g-dev:i386 libgl1-mesa-dev libx11-dev make zip

18. set ccache
19. shutdown the VM, setup the USB so that the device can be seen through the Virtual machine
20. leave the device plugged into the machine.  Make sure that the device can be adb pulled from.

21. Do a git clone from mozilla-b2g/B2G.git
git clone https://github.com/mozilla-b2g/B2G.git B2G

22. run ./config.sh <target device>
note: if you’re wanting to make v1-train run: BRANCH=v1-train ./config.sh <target device>

23 run ./repo sync
24. run ./build.sh

Troubleshoot any issues.  chances are that you may have issues do to the device pull.
here are steps to resolve that:
a) rm -rf backup-<devicename>
b) go to the folder that contains extract-device.sh ie devices/<whatever, whatever>/<device name>/extract-device.sh
c) run adb root
d) run adb remount
e) sudo ./extract-device.sh

then build again

25. run ./flash.sh to flash the device.

Note: su might not hold the environment.  It’s because there’s a feature to use secure paths: http://stackoverflow.com/questions/257616/sudo-changes-path-why

you can change this by : sudo visudo

Advertisements

About shizen008

Breaking things and getting in trouble for it since '74. Disclaimer: I am not responsible if I make your head explode reading this blog! The writings here are my own expression and not of any companies. I currently work on being a QA for B2G aka Firefox OS
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to How to build an ubuntu VM that compiles B2G

  1. gaso lin says:

    I’m writing a project that auto-configure FirefoxOS Build Environment in a VM via vagrant https://github.com/gasolin/foxbox . It might saves new contributors burden. It will be nice if you could take a look and give some advices.

  2. shizen008 says:

    Oh interesting. Thanks Gaso lin. I’ll see if I can find some time to look at it.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s