forked from mozilla-b2g/B2G
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f62d87e
Showing
10 changed files
with
1,084 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Boot to Gecko (B2G) | ||
|
||
Boot to Gecko aims to create a complete, standalone operating system for the open web. | ||
|
||
You can read more about B2G here: | ||
|
||
http://wiki.mozilla.org/B2G | ||
|
||
follow us on twitter: @Boot2Gecko | ||
|
||
http://twitter.com/Boot2Gecko | ||
|
||
join the Mozilla Platform mailing list: | ||
|
||
http://groups.google.com/group/mozilla.dev.platform | ||
|
||
and talk to us on IRC: | ||
|
||
#B2G on irc.mozilla.org | ||
|
||
## Prerequisites | ||
|
||
### Linux | ||
|
||
* A 64 bit linux distro | ||
* See http://source.android.com/source/initializing.html on configuring USB access. | ||
* 20GB of free disk space | ||
* autoconf-2.13 | ||
* git | ||
* ccache | ||
* gcc/g++ | ||
* bison | ||
* 32bit ncurses | ||
* make | ||
|
||
### OSX | ||
|
||
* XCode | ||
* 20GB of free space on a case sensitive filesystem | ||
* See http://source.android.com/source/initializing.html on creating a case sensitive disk image. | ||
* homebrew | ||
* git | ||
* gpg | ||
* ccache | ||
* autoconf-2.13 - brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb | ||
|
||
## Configuration | ||
|
||
Run config.sh to get a list of supported devices: | ||
|
||
./config.sh | ||
|
||
And then run config.sh for the device you want to build for: | ||
|
||
./config.sh [device name] | ||
|
||
## Build | ||
|
||
Run build.sh or bld.sh to build B2G. | ||
|
||
./build.sh | ||
|
||
If you want to just build gecko or some other project, just specify it: | ||
|
||
./build.sh gecko | ||
|
||
## Flash/Install | ||
|
||
Make sure your phone is plugged in with usb debugging enabled. | ||
|
||
To flash everything on your phone: | ||
|
||
./flash.sh | ||
|
||
To flash system/userdata/boot partitions on fastboot phones: | ||
|
||
./flash.sh system | ||
./flash.sh boot | ||
./flash.sh user | ||
|
||
To update gecko: | ||
|
||
./flash.sh gecko | ||
|
||
To update gaia: | ||
|
||
./flash.sh gaia | ||
|
||
## Debug | ||
|
||
To restart B2G and run B2G under gdb: | ||
|
||
./run-gdb.sh | ||
|
||
To attach gdb to a running B2G process: | ||
|
||
./run-gdb.sh attach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
. setup.sh && | ||
time nice -n19 make $MAKE_FLAGS $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
|
||
REPO=./repo | ||
|
||
install_blobs() { | ||
mkdir -p download-$1 && | ||
for BLOB in $2 ; do | ||
curl https://dl.google.com/dl/android/aosp/$BLOB -o download-$1/$BLOB -z download-$1/$BLOB && | ||
tar xvfz download-$1/$BLOB -C download-$1 | ||
done && | ||
for BLOB_SH in download-$1/extract-*.sh ; do | ||
BASH_ENV=extract.rc bash $BLOB_SH | ||
done | ||
} | ||
|
||
repo_sync() { | ||
rm -rf .repo/manifest* && | ||
$REPO init -u git://github.com/mozilla-b2g/b2g-manifest -b $1 && | ||
$REPO sync | ||
} | ||
|
||
case `uname` in | ||
"Darwin") | ||
CORE_COUNT=`system_profiler SPHardwareDataType | grep "Cores:" | sed -e 's/[ a-zA-Z:]*\([0-9]*\)/\1/'` | ||
;; | ||
"Linux") | ||
CORE_COUNT=`grep processor /proc/cpuinfo | wc -l` | ||
;; | ||
*) | ||
echo Unsupported platform: `uname` | ||
exit -1 | ||
esac | ||
|
||
case "$1" in | ||
"galaxy-s2") | ||
echo DEVICE=galaxys2 > .config && | ||
repo_sync galaxy-s2 && | ||
(cd device/samsung/galaxys2 && ./extract-files.sh) | ||
;; | ||
|
||
"galaxy-nexus") | ||
MAGURO_BLOBS="broadcom-maguro-imm76d-4ee51a8d.tgz | ||
imgtec-maguro-imm76d-0f59ea74.tgz | ||
samsung-maguro-imm76d-d16591cf.tgz" | ||
echo DEVICE=maguro > .config && | ||
install_blobs galaxy-nexus "$MAGURO_BLOBS" && | ||
repo_sync maguro | ||
;; | ||
|
||
"nexus-s") | ||
CRESPO_BLOBS="akm-crespo-imm76d-8314bd5a.tgz | ||
broadcom-crespo-imm76d-a794e660.tgz | ||
imgtec-crespo-imm76d-d381b3bf.tgz | ||
nxp-crespo-imm76d-d3862877.tgz | ||
samsung-crespo-imm76d-d2d82200.tgz" | ||
echo DEVICE=crespo > .config && | ||
install_blobs nexus-s "$CRESPO_BLOBS" && | ||
repo_sync crespo | ||
;; | ||
|
||
"emulator") | ||
echo DEVICE=generic > .config && | ||
repo_sync master | ||
;; | ||
|
||
*) | ||
echo Usage: $0 \(device name\) | ||
echo | ||
echo Valid devices to configure are: | ||
echo - galaxy-s2 | ||
echo - galaxy-nexus | ||
echo - nexus-s | ||
echo - emulator | ||
exit -1 | ||
;; | ||
esac | ||
|
||
if [ $? -ne 0 ]; then | ||
echo Configuration failed | ||
exit -1 | ||
fi | ||
|
||
echo MAKE_FLAGS=-j$((CORE_COUNT + 1)) >> .config | ||
echo GECKO_OBJDIR=$PWD/objdir-gecko >> .config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
more() { | ||
return 0 | ||
} | ||
|
||
read() { | ||
typed="I ACCEPT" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/bin/bash | ||
|
||
. .config | ||
if [ $? -ne 0 ]; then | ||
echo Could not load .config. Did you run config.sh? | ||
exit -1 | ||
fi | ||
|
||
ADB=${ADB:-adb} | ||
FASTBOOT=${FASTBOOT:-fastboot} | ||
HEIMDALL=${HEIMDALL:-heimdall} | ||
|
||
if [ ! -f "`which \"$ADB\"`" ]; then | ||
ADB=out/host/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/bin/adb | ||
fi | ||
if [ ! -f "`which \"$FASTBOOT\"`" ]; then | ||
FASTBOOT=out/host/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/bin/fastboot | ||
fi | ||
|
||
flash_fastboot() | ||
{ | ||
$ADB reboot bootloader ; | ||
$FASTBOOT devices && | ||
( $FASTBOOT oem unlock || true ) | ||
|
||
if [ $? -ne 0 ]; then | ||
echo Couldn\'t setup fastboot | ||
return -1 | ||
fi | ||
case $1 in | ||
"system" | "boot" | "userdata") | ||
$FASTBOOT flash $1 out/target/product/$DEVICE/$1.img && | ||
$FASTBOOT reboot | ||
;; | ||
|
||
*) | ||
$FASTBOOT erase cache && | ||
$FASTBOOT erase userdata && | ||
$FASTBOOT flash userdata out/target/product/$DEVICE/userdata.img && | ||
$FASTBOOT flash boot out/target/product/$DEVICE/boot.img && | ||
$FASTBOOT flash system out/target/product/$DEVICE/system.img && | ||
$FASTBOOT reboot | ||
;; | ||
esac | ||
} | ||
|
||
flash_heimdall() | ||
{ | ||
if [ ! -f "`which \"$HEIMDALL\"`" ]; then | ||
echo Couldn\'t find heimdall. | ||
exit -1 | ||
fi | ||
|
||
$ADB reboot download || echo Couldn\'t reboot into download mode. Hope you\'re already in download mode | ||
sleep 8 | ||
|
||
case $1 in | ||
"system") | ||
$HEIMDALL flash --factoryfs out/target/product/$DEVICE/$1.img | ||
;; | ||
|
||
"kernel") | ||
$HEIMDALL flash --kernel device/samsung/$DEVICE/kernel | ||
;; | ||
|
||
*) | ||
$HEIMDALL flash --factoryfs out/target/product/$DEVICE/system.img --kernel device/samsung/$DEVICE/kernel | ||
;; | ||
esac | ||
} | ||
|
||
update_time() | ||
{ | ||
echo Attempting to set the time on the device | ||
$ADB wait-for-device && | ||
$ADB shell toolbox date `date +%s` && | ||
$ADB shell setprop persist.sys.timezone `date +%Z%:::z|tr +- -+` | ||
} | ||
|
||
case "$1" in | ||
"gecko") | ||
$ADB remount && | ||
$ADB push $GECKO_OBJDIR/dist/b2g /system/b2g | ||
exit $? | ||
;; | ||
|
||
"gaia") | ||
make -C gaia install-gaia | ||
exit $? | ||
;; | ||
esac | ||
|
||
case "$DEVICE" in | ||
"maguro") | ||
flash_fastboot $1 && | ||
update_time | ||
;; | ||
|
||
"crespo") | ||
flash_fastboot $1 && | ||
update_time | ||
;; | ||
|
||
"galaxys2") | ||
flash_heimdall $1 | ||
;; | ||
|
||
*) | ||
echo Unsupported device \"$DEVICE\", can\'t flash | ||
exit -1 | ||
;; | ||
esac |
Oops, something went wrong.