How to Compile Samsung GT-S5360’s Kernel on Windows OS

September 4, 2017

The sources uses for this article is this one:

https://github.com/percy-g2/GNU-kernel

But later on, this proves to be useless, as you can see near the end of this article

This is downloaded and placed in D:\Projects\AndroidKernel\Samsung\kernel

Rooting the device using:

https://forum.xda-developers.com/showthread.php?t=2085390

Install required Samsung USB driver SAMSUNG_USB_Driver_for_Mobile_Phones.zip.

First perform some file study on the ramdisk structure of existing device by transferring files from device to PC:

C:\Android\sdk\platform-tools>adb pull init.rc d:\z
adb: error: failed to copy ‘init.rc’ to ‘d:\z\init.rc’: remote Permission denied

So, it is a remote Permission denied. Let’s leave it for a while.

Install CWM to the device:

C:\Android\sdk\platform-tools>adb push D:\Projects\AndroidKernel\Samsung\cwm.zip
/sdcard
D:\Projects\AndroidKernel\Samsung\cwm….ed. 4.8 MB/s (1418804 bytes in 0.281s)

Install CWM and perform back up.

Later on, when I restart the phone, I’ve found that ADB functionality is disabled, which means that when I plug the USB cable to my PC, the phone only reacted with charging only.

After performing the factory reset, the ADB functionality is come back as expected. So I decided to investigate further.

When I connect the phone using USB cable, the device is registered as BCM21553-Thunderbird.

A question to my mind: does the driver is coming from Samsung USB driver I installed earlier, or is it coming from the phone itself ?

I unplugged the phone, and perform uninstall of the USB driver. There’s no Samsung driver now, I plug the USB cable. It registered as BCM21553-Thunderbird, and ready to use but the ADB command can not detect the device.

So, unplug, and re-install the USB driver, and re-plug, and see what happens now.

It tries to install the driver, and when I skip the windows update, the installation process brings out status as follows:

So, the Samsung USB driver is indeed required for ADB functionality. Now, let’s try to disable USB debugging in the phone and see what happens.

It reverts to USB storage. When I enable USB debugging and USB storage through the phone menu, both the ADB and file system in my PC can detect the files. Hmm, great !

So, what causes the failure in the ADB functionality ? Is it because I install CWM.zip recovery image ?

Unplug and re-install CWM (ClockworkMod Recovery v5.0.2.6) recovery, then perform re-boot, and see what happens. The ADB still detect the device. Hmm, strange. Maybe there are extra steps that I’ve done in recovery program that causes this. But let’s leave this for the moment.

Let’s empty the SD card leaving only update.zip (for rooting) and CWM.zip for recovery.

Unplug, entering to recovery mode and install CWM again. This time, I try to perform backup and see what files that gets created. One of interesting file is boot.img. Let’s examine it.

The carliv image kitchen failed to recognize this file, turns out the boot.img contains nothing only a series of 0xFF from start to the end of file.

The boot.img is important because it will be used as base line for the compiled kernel source. So, I have some options as follows: try to examine the CWM recovery source file or try to get the stock rom.

I decided to use custom rom for GT-S5360 from this site:

http://www.droidthunder.com/update-samsung-galaxy-y-s5360-to-android-5-0-lollipop/

By following the exact step, I get the working Android Lollipop themed on my Samsung GT-S5360 phone, with also a working USB storage and debugging for ADB command purposes.

Next, I try to identify objects inside the custom kernel’s (kernel_CM7_v4.0_totoro.zip) boot.img to find out what will be the requirements to get a workable kernel image.

D:\Projects\AndroidKernel\Samsung\carliv>carliv

This time carliv image kitchen works, and examining the result, the boot.image consists of the kernel and ramdisk.

Checking the root structure of the system verifies that it is indeed from ramdisk:

C:\Android\sdk\platform-tools>adb she
$ su
# ls -a
efs
config
cache
sd-ext
sdcard
acct
mnt
vendor
d
etc
ueventd.rc
ueventd.goldfish.rc
tmp
system
sys
sbin
res
recovery.rc
proc
lib
init.rc
init.goldfish.rc
init.charge.rc
init.bcm21553.rc
init
fota.rc
default.prop
data
root
dev
#
# pwd
/
#

Let’s check the log files whether it is exist, this is done by perform all backup to the sdcard, copying content to the PC for ease of searching and investigating. Searching for *log* yield no result whatsoever.

Try to search using *.txt find some interesting file called SYSTEM_BOOT@1293963501309.txt with content as follows:

Build: samsung/GT-S5360/GT-S5360:2.3.6/GINGERBREAD/XWKTN:user/release-keys
Hardware: totoro
Bootloader: unknown
Radio: unknown
Kernel: Linux version 2.6.35.7 (bieltv3@bieltv3) (gcc version 4.4.3 (GCC) ) #32 PREEMPT Fri Feb 14 16:33:03 CET 2014

From recovery_kernel_log.txt on back up of original ROM I also get information about the machine:

[ 0.000000] Machine: BCM21553 ThunderbirdEDN31 platform

Try to get more information about the kernel based on the above string information proves to be very difficult and vague, but later on, I’ve found that dmesg is useful to get kernel messages for this ROM.

In the adb shell:

$ su
# dmesg > sdcard/mymsg.txt

Then:

C:\Android\sdk\platform-tools>adb pull /sdcard/mymsg.txt d:\z
/sdcard/mymsg.txt: 1 file pulled. 5.4 MB/s (89066 bytes in 0.016s)

Let’s perform some queries of this Samsung devices:

# ls -s /proc
total 0
0 rfs
0 LinuStoreIII

# cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 5 (v6l)
BogoMIPS : 832.90
Features : swp half thumb fastmult vfp edsp java
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 5

Hardware : BCM21553 ThunderbirdEDN31 platform
Revision : 0000
Serial : 0000000000000000

# cat /proc/devices
Character devices:
1 mem
2 pty
3 ttyp
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
29 fb
89 i2c
90 mtd
108 ppp
116 alsa
128 ptm
136 pts
151 gememalloc
199 bcm_gps
200 bcm_cntin
201 bcm_kril
202 bcm_log
203 bcm_atc
204 bcm_fuse_ipc
205 bcm_rpc
206 bcm_alsa_pcg
207 bcm_audio_log
208 bcm_vsp
209 bcm_alsa_voip
210 hx170dec
211 h6270enc
212 bcm_kpdp
216 rfcomm
230 memalloc
243 lcd
246 camera
250 BrcmHeadset
251 v3d
252 ttyGS
253 cache-ops
254 rtc

Block devices:
1 ramdisk
259 blkext
7 loop
31 mtdblock
137 bml
138 stl
179 mmc
254 device-mapper
#

To verify the start up codes against the downloaded source, let’s extract the boot.img.

At the end of the boot process routines, I expected to find 0x1F and 0x8B for gzip signature, but I found none. It has 0x5D as the signature, and at the end of the kernel binary, there’s an interesting string: bad header. So, based on sources searching, it is found that this error message is uniquely found in D:\Projects\AndroidKernel\Samsung\kernel\common\lib\decompress_unlzma.c.

For a verification, I dissected the binary portion and placed it in test.lzma file using WinHex and try to decompress with 7-zip without any incidence.

Next, I try to load the extracted kernel into IDA Dissasembler to examine the routine and compared it with D:\Projects\AndroidKernel\Samsung\kernel\common\arch\arm\boot\compressed\head.S from downloaded kernel source.

The first statements until SVC 0x123456 is still consistent with the source code. But after instruction MSR CPSR_c, R2 there are two mysterious statement which consists of ANDEQ R0, R0, R0 twice, which is actually 0x00 bytes of 8 bytes size.

But later on, upon close examination, it is maybe inserted by the linker, as evidenced from comment of head.s source code: some architecture specific code can be inserted by the linker here, but it should preserve r7, r8, and r9 …

Statement after this is consistent. The downloaded source looks promising. So, let’s prepare for the compilation process.

Let’s test the basic logic of the make file:

D:\Projects\AndroidKernel\Samsung\kernel\common>make
make: /home/percy/sgy/arm-2009q3/bin/arm-none-eabi-gcc: Command not found
HOSTCC scripts/basic/fixdep
scripts/basic/fixdep.c:116:23: fatal error: arpa/inet.h: No such file or directo
ry
compilation terminated.
make[2]: *** [scripts/basic/fixdep] Error 1
make[1]: *** [scripts_basic] Error 2
make: *** No rule to make target `include/config/auto.conf’, needed by `include/
config/kernel.release’. Stop.

So, let’s try:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 ARCH=arm SUBARCH=arm CR
OSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm
-none-androideabi-
make: C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-none-
androideabi-gcc: Command not found
make -f /d/Projects/AndroidKernel/Samsung/kernel/common/Makefile silentoldconfig

make -f scripts/Makefile.build obj=scripts/basic
gcc -Wp,-MD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-protot
ypes -O2 -fomit-frame-pointer -o scripts/basic/fixdep scripts/basic/fixdep.c

scripts/basic/fixdep.c:116:23: fatal error: arpa/inet.h: No such file or directo
ry
compilation terminated.

Perform changes in the make file:

HOSTCC:=i686-pc-cygwin-gcc-4

Now I have:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 ARCH=arm SUBARCH=arm CR
OSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm
-none-androideabi-
make: C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-none-
androideabi-gcc: Command not found
make -f /d/Projects/AndroidKernel/Samsung/kernel/common/Makefile silentoldconfig

make -f scripts/Makefile.build obj=scripts/basic
i686-pc-cygwin-gcc-4 -Wp,-MD,scripts/basic/.fixdep.d -Wall -Wmissing-prototype
s -Wstrict-prototypes -O2 -fomit-frame-pointer -o scripts/basic/fixdep scrip
ts/basic/fixdep.c
scripts/basic/fixdep.c: In function `parse_config_file’:
scripts/basic/fixdep.c:242:4: warning: array subscript has type `char’
scripts/basic/fixdep.c: In function `parse_dep_file’:
scripts/basic/fixdep.c:323:4: warning: array subscript has type `char’
scripts/basic/fixdep: scripts/basic/fixdep: cannot execute binary file
make[2]: *** [scripts/basic/fixdep] Error 126
make[1]: *** [scripts_basic] Error 2
make: *** No rule to make target `include/config/auto.conf’, needed by `include/
config/kernel.release’. Stop.

Checking the files in location D:\Projects\AndroidKernel\Samsung\kernel\common\scripts\basic reveals there’s a fixdep file in ELF format. Remove it and the error is gone, but I have a crashed windows, hmm, interesting 🙂

But let’s focus to this error:

make: C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-none-
androideabi-gcc: Command not found

This is because the current NDK does not have arm-none-androideabi-gcc.exe binary. So, let’s change it to arm-linux-androideabi-gcc, which causes windows crashing as in previous incident:

To solve this problem, let’s use info command. Starting by:

$(info verbose is $(KBUILD_VERBOSE))

To check whether the script is already set to verbose mode, and the result is yes, it is already verbose. But still, there’s no verbose information leading to the clue to the cause of crashing.

After spending considerable time I’ve found the location of the cause of crashing is from D:\Projects\AndroidKernel\Samsung\kernel\common\scripts\Kbuild.include:

try-run = $(shell set -e; \
TMP=”$(TMPOUT).$$$$.tmp”; \
TMPO=”$(TMPOUT).$$$$.o”; \
if ($(1)) >/dev/null 2>&1; \
then echo “$(2)”; \
else echo “$(3)”; \
fi; \
rm -f “$$TMP” “$$TMPO”)

Revise the above script into:

MYTMP:=$$$$.tmp
MYTMPO:=$$$$.o
try-run = $(shell set -e; \
if ($(1)) >/dev/null 2>&1; \
then echo “$(2)”; \
else echo “$(3)”; \
fi; \
rm -f $(MYTMP) $(MYTMPO))

And change all the successive call to try-run using the above construct, for example:

cc-ldoption = $(call try-run,\
$(CC) $(1) -nostdlib -xc /dev/null -o “$$TMP”,$(1),$(2))

Become:

cc-ldoption = $(call try-run,\
$(CC) $(1) -nostdlib -xc /dev/null -o $(MYTMP),$(1),$(2))

Will solve the above initial crash problem.

Now I have not only crashing windows but also my command prompt gone by itself. Hmm, intriguing 🙂

After spending some time investigating this issue, the causes turns out to be trivial, i.e. there’s again some ELF file in the downloaded kernel that cause confusion in the OS.

Now I have:


scripts/kconfig/menu.c: In function `menu_add_prop’:
scripts/kconfig/menu.c:134:3: warning: array subscript has type `char’
scripts/kconfig/menu.c:136:4: warning: array subscript has type `char’
scripts/kconfig/conf: scripts/kconfig/conf: cannot execute binary file

Again I still have some windows crashes like the picture below:

But this time, after all of the issue of lingering ELF file already solved. And when I press the “Close the program”, my console window is gone also, and I have to start over and type the path to the kernel source location. This kind of error will cause a great sorrow and very discouraging.

I realized this is caused by the using of make command. So when I use this command line:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 ARCH=arm SUBARCH=arm CR
OSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm
-linux-androideabi-

The windows will crashes.

But using this one, by adding -p option for make debugging traces, there’s no crash:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 ARCH=arm SUBARCH=arm CR
OSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm
-linux-androideabi- -p > myTesting.txt

Maybe this is caused by the Cygwin compiler behaviour. And because the host command application already created, there’s no reason to keep creating it each time when doing the compilation process, so let’s remark this make script portion in D:\Projects\AndroidKernel\Samsung\kernel\common\Makefile:

#PHONY += scripts_basic
#scripts_basic:
# $(Q)$(MAKE) $(build)=scripts/basic
# $(Q)rm -f .tmp_quiet_recordmcount

The crash is gone, but now I have:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 ARCH=arm SUBARCH=arm CR
OSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm
-linux-androideabi-
build image is zImage
make -f /d/Projects/AndroidKernel/Samsung/kernel/common/Makefile silentoldconfig

make[1]: *** No rule to make target `silentoldconfig’. Stop.
make: *** No rule to make target `include/config/auto.conf’, needed by `include/
config/kernel.release’. Stop.

There are new target error here, so, let’s create a dummy target for script_basic:

PHONY += scripts_basic
scripts_basic:
@echo “Script Basic”

Now again I get crash, which is caused by another call to cygwin compiler. So, make combined with cygwin compiler will cause windows crash, but can be remedied by using -p options.

I decided to investigate it further, of why the exact nature of the crashing windows when it is using without -p options.

After spending some considerable time, I found the source of the problem, which is the present of extra hyphen or minus in one of the compiler checking script.

The script in question is located at D:\Projects\AndroidKernel\Samsung\kernel\common\scripts\kconfig\check.sh, which contains:

Please pay a close attention to the above script. I’ve marked the extra hyphen or minus sign in that script. And by removing that extra hyphen and try to call make again without -p option, the windows crashing is now gone, for a moment.

By perform global text searching, this kind of construct is also located in D:\Projects\AndroidKernel\Samsung\kernel\common\scripts\kconfig\lxdialog\check-lxdialog.sh. So, to prevent another frustration, it is also fixed.

This makes me wonder, why in Linux OS system do not crash, or is it some form of preventive measure from Linux community to thwart the Windows OS to get a successful compile ? Hmm, anyway it is an interesting phenomena.

Now I have:


arch/arm/Kconfig:1138: can’t open file “drivers/pci/Kconfig”
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf’, needed by `include/
config/kernel.release’. Stop.

First error:

arch/arm/Kconfig:1138: can’t open file “drivers/pci/Kconfig”

Can be resolved by create a blank Kconfig file in D:\Projects\AndroidKernel\Samsung\kernel\common\drivers\pci

Same for:

arch/arm/Kconfig:1140: can’t open file “drivers/pcmcia/Kconfig”
arch/arm/Kconfig:1632: can’t open file “drivers/cpuidle/Kconfig”
net/Kconfig:211: can’t open file “drivers/net/appletalk/Kconfig”

And after several hundreds of this kind of replacement, I came at:

make[1]: `include/generated/mach-types.h’ is up to date.
make -f scripts/Makefile.build obj=.
(cat /dev/null; ) > modules.order
./scripts/basic/hash: ./scripts/basic/hash: cannot execute binary file
./scripts/basic/hash: ./scripts/basic/hash: cannot execute binary file

fixdep:
: No such file or directory
make[1]: *** [kernel/bounds.s] Error 2
make: *** [prepare0] Error 2

Again the lingering ELF file for hash. Let’s try again after removing it.

The fixdep still has error. And based on my previous post about compiling goldfish kernel, there should be some small changes in the source file, so by copying it into this folder and re-compile fixdep, I have:

i686-pc-cygwin-gcc-4 -Wp,-MD,scripts/mod/.mk_elfconfig.d -Wall -Wmissing-proto
types -Wstrict-prototypes -O2 -fomit-frame-pointer -o scripts/mod/mk_elfconf
ig scripts/mod/mk_elfconfig.c
scripts/mod/mk_elfconfig scripts/mod/elfconfig.h
scripts/mod/mk_elfconfig: scripts/mod/mk_elfconfig: cannot execute binary file
make[2]: *** [scripts/mod/elfconfig.h] Error 126
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2

Oh boy, another lingering ELF, I suppose. Remove, and this time, I have another windows crashing.

Again after spending some time checking for this issue, it is found that this construct in D:\Projects\AndroidKernel\Samsung\kernel\common\scripts\mod\Makefile:

The green one which the original one will cause windows to crash. Apparently, simultaneously redirecting input and output can’t be handled by windows at this time.

So I have to modify it without output redirection, but using routines inside D:\Projects\AndroidKernel\Samsung\kernel\common\scripts\mod\mk_elfconfig.c to create the required output file.

Now I have:


usr/gen_init_cpio: usr/gen_init_cpio: cannot execute binary file
make[1]: *** [usr/initramfs_data.cpio] Error 126
make: *** [usr] Error 2

Remove the offending ELF file, after some compilation time, I have:

Let’s try:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 ARCH=arm bcm21553_totor
o_02B0_defconfig CROSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebu
ilt/windows/bin/arm-linux-androideabi-

Then:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 CROSS_COMPILE=C:/NDK/to
olchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi- 2
>myError1.txt

Checking on the result file:

In file included from arch/arm/plat-bcmap/include/plat/gpio.h:22:0,
from arch/arm/mach-bcm215xx/include/mach/gpio.h:16,
from d:/Projects/AndroidKernel/Samsung/kernel/common/arch/arm/include/asm/gpio.h:5,
from include/linux/gpio.h:7,
from arch/arm/mach-bcm215xx/include/mach/setup.h:24,
from arch/arm/mach-bcm215xx/board-totoro.c:36:
include/asm-generic/gpio.h: In function ‘gpio_get_value_cansleep’:
include/asm-generic/gpio.h:206:2: error: implicit declaration of function ‘gpio_get_value’ [-Werror=implicit-function-declaration]
return gpio_get_value(gpio);

Let’s try again with:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 ARCH=arm bcm21553_totor
o_02B0_defconfig CROSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebu
ilt/windows/bin/arm-linux-androideabi-

Then:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 CROSS_COMPILE=C:/NDK/to
olchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi- 2
>myError2.txt

But I still have:


In file included from arch/arm/plat-bcmap/include/plat/gpio.h:22:0,
from arch/arm/mach-bcm215xx/include/mach/gpio.h:16,
from d:/Projects/AndroidKernel/Samsung/kernel/common/arch/arm/include/asm/gpio.h:5,
from include/linux/gpio.h:7,
from arch/arm/mach-bcm215xx/include/mach/setup.h:24,
from arch/arm/mach-bcm215xx/board-totoro.c:36:
include/asm-generic/gpio.h: In function ‘gpio_get_value_cansleep’:
include/asm-generic/gpio.h:206:2: error: implicit declaration of function ‘gpio_get_value’ [-Werror=implicit-function-declaration]
return gpio_get_value(gpio);

No matter what combination of possible configs that I throw to the compiler, the result is always the same.

So, I decided to use the default auto.conf from original Percy’s github and copied to D:\Projects\AndroidKernel\Samsung\kernel\common\include\config\auto.conf.

Then I have to disable the conf.exe by modifying the source in D:\Projects\AndroidKernel\Samsung\kernel\common\scripts\kconfig\conf.c from action by just returning to the caller, so that the auto.conf do not get modified:

But this time I have:


init/do_mounts_rd.c: At top level:
init/do_mounts_rd.c:158:12: error: redefinition of ‘rd_load_image’
int __init rd_load_image(char *from)

Upon close examination, the cause of the above error is undefined variable called CONFIG_BLK_DEV_RAM in D:\Projects\AndroidKernel\Samsung\kernel\common\init\do_mounts.h, which causes compilation process goes to the else block:

By checking the parameter passed to the compiler, it is realized that this variable depends on D:\Projects\AndroidKernel\Samsung\kernel\common\include\generated\autoconf.h for the above definition.

Let’s copy this file content from the original github location to this one, and the previous compiler error at board-totoro.c is now gone, and after a significant progress in compiling process that takes considerable time, I have:


make -f scripts/Makefile.build obj=drivers
make -f scripts/Makefile.build obj=drivers/auxdisplay
scripts/Makefile.build:44: /d/Projects/AndroidKernel/Samsung/kernel/common/drive
rs/auxdisplay/Makefile: No such file or directory
make[2]: *** No rule to make target `/d/Projects/AndroidKernel/Samsung/kernel/co
mmon/drivers/auxdisplay/Makefile’. Stop.
make[1]: *** [drivers/auxdisplay] Error 2

Let’s try to use drivers inside:

https://github.com/broadcomCM/android_kernel_samsung_bcm21553-common

And copy the content of drivers into D:\Projects\AndroidKernel\Samsung\kernel\common\drivers. Re-compile, and I have:


scripts/conmakehash: scripts/conmakehash: cannot execute binary file
make[2]: *** [drivers/char/consolemap_deftbl.c] Error 126
make[1]: *** [drivers/char] Error 2
make: *** [drivers] Error 2

Delete the offending ELF file and after compiling process of considerable time, there’s an error, but the my windows console do not keep the earliest error location. So I have to recompile using this option:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 CROSS_COMPILE=C:/NDK/to
olchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi- 2
>myError.txt

This wlll trap any error into the file for further analysis.

And here is the earliest compiler error message:


drivers/staging/android/lowmemorykiller.c: In function ‘lowmem_shrink’:
drivers/staging/android/lowmemorykiller.c:275:27: error: ‘TIF_MM_RELEASED’ undeclared (first use in this function)

Checking to the source makes me question the validity of the copied folder from broadcomCM’s github source. So, I try to retrieve lowmemorykiller.c from:

https://android.googlesource.com/kernel/samsung/+/android-samsung-2.6.35-gingerbread/drivers

And it compiles without any error.

This lead me to replace the entire drivers folder by this one, to see what happens:


drivers/mmc/card/block.c: In function ‘mmc_blk_issue_rq’:
drivers/mmc/card/block.c:387:6: error: implicit declaration of function ‘mmc_card_adjust_cfg’ [-Werror=implicit-function-declaration]
mmc_card_adjust_cfg(card->host, READ);

Let’s revert back the drivers from broadcomCM, but this time, replace lowmemorykiller.c from android-samsung-2.6.35-gingerbread.

Now I have:

In file included from drivers/staging/bcm21553/drivers/char/brcm/fuse_at/atc_kernel.c:58:0:
drivers/staging/bcm21553/drivers/char/brcm/fuse_rpc/rpc_CIB/public/rpc_ipc.h:138:22: error: ‘IPC_PROPERTY_START_AP’ undeclared here (not in a function)
RPC_PROP_START_AP = IPC_PROPERTY_START_AP, ///make V=1 CROSS_COMPILE=C:/NDK/to
olchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi- d
rivers/staging/bcm21553/drivers/char/brcm/fuse_at/atc_kernel.o

Copy IPCProperties.h from broadcomCM github source to D:\Projects\AndroidKernel\Samsung\kernel\common\include\linux\broadcom\IPCProperties.h.

Perform quick re-compiling by invoking the above message, and although there are many warnings, the compiler managed to create atc_kernel.o.

Now, let’s perform a long compile again:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 CROSS_COMPILE=C:/NDK/to
olchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi- 2
>myError.txt

And I have:


drivers/staging/bcm21553/drivers/video/bmem/bmem.c:165:5: error: unknown field ‘GetFreeMemorySize’ specified in initializer
.GetFreeMemorySize = bmem_GetFreeMemorySize,

Copy the file to D:\Projects\AndroidKernel\Samsung\kernel\common\include\linux\broadcom\bmem_wrapper.h. And verify again by quick compiling, it is a success again.

So, copy the entire folder from broadcomCM github to D:\Projects\AndroidKernel\Samsung\kernel\common\include\linux\broadcom folder.

Now I have:


drivers/video/fbmem.c: In function ‘fb_mmap’:
drivers/video/fbmem.c:1360:2: error: implicit declaration of function ‘vm_iomap_memory’ [-Werror=implicit-function-declaration]
return vm_iomap_memory(vma, start, len);

Copy this file from broadcomCM github to:

D:\Projects\AndroidKernel\Samsung\kernel\include\linux\mm.h
D:\Projects\AndroidKernel\Samsung\kernel\mm\memory.c

Quick compile is a success now, let’s do long compile again. And we have:


mm/memory.c: In function ‘unmap_mapping_range’:
mm/memory.c:2679:21: error: ‘struct address_space’ has no member named ‘unmap_mutex’
mutex_lock(&mapping->unmap_mutex);

Replace:

D:\Projects\AndroidKernel\Samsung\kernel\fs\inode.c
D:\Projects\AndroidKernel\Samsung\kernel\include\linux\fs.h

And I have:

mm/mlock.c: At top level:
mm/mlock.c:139:19: error: redefinition of ‘vma_stack_continue’
static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr)

At this point, I believe this kind of compiler error will not be resolved till the end of time 🙂

So, I decided to get a kernel source tree version check, and I’ve found:

The one I try to compiled that do not have complete drivers folder, which cause drivers/auxdisplay make error:

D:\Projects\AndroidKernel\Samsung\kernel\common>make V=1 CROSS_COMPILE=C:/NDK/to
olchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi- k
ernelversion
2.6.35.7

The one from broadcomCM github that has the complete driver folder:

D:\Projects\AndroidKernel\Samsung\kernel2>make V=1 CROSS_COMPILE=C:/NDK/toolchai
ns/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi- kernelv
ersion
2.6.35.14

Let’s switch to the kernel from broadcomCM, and let’s see how far it can go with the compiling process. To do this, I’ve prepared the source base in:

D:\Projects\AndroidKernel\Samsung\kernel2

But copy the configuration info from the kernel I’ve try to compile and bypass the conf.exe checking, using tricks I’ve described above. This is necessary so that the auto.conf, .config and autoconf.h is intact without get modified by conf.exe. Also perform some necessary script revision and program patches as described above, then let’s compile:


drivers/built-in.o:silabs_f760_totoro.c:function silabs_ts_probe: error: undefin
ed reference to ‘Synaptics_Connected’
drivers/built-in.o:silabs_f760_totoro.c:function silabs_ts_init: error: undefine
d reference to ‘Synaptics_Connected’
make: *** [.tmp_vmlinux1] Error 1

This puts configuration data from percy-g2 into question. Let’s use another configuration by using this command. But first, I have to enable the conf.c to process the Kconfig to generate auto.conf instead of bypassing it.

Then use this configuration:

D:\Projects\AndroidKernel\Samsung\kernel2>make V=1 ARCH=arm bcm21553_totoro_05_d
efconfig CROSS_COMPILE=C:/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/wind
ows/bin/arm-linux-androideabi-

After that, perform re-compiling, but I have:


c:\NDK\toolchains\arm-linux-androideabi-4.8\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: arch/arm/boot/compressed/piggy.gzip.o: unknown CPU architecture
c:\NDK\toolchains\arm-linux-androideabi-4.8\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: arch/arm/boot/compressed/lib1funcs.o: unknown CPU architecture
make[2]: *** [arch/arm/boot/compressed/vmlinux] Error 1

This is the classic error and already resolved in my previous article about how to compile goldfish kernel, i.e by manually compiling the offending lib1funcs.S by deleting the -march=all switch.

Now, to get the information of the last steps that should be manually taken for creating the boot kernel, I have to re-compile using -p switch again.

These three should be compiled manually without -march=all option (piggy.gzip.S, head.S and lib1funcs.S):

D:\Projects\AndroidKernel\Samsung\kernel2>C:\NDK\toolchains\arm-linux-androideab
i-4.8\prebuilt\windows\bin\arm-linux-androideabi-gcc -Wp,-MD,arch\arm\boot\compr
essed\.lib1funcs.o.d -nostdinc -isystem c:\ndk\toolchains\arm-linux-androideabi
-4.8\prebuilt\windows\bin\..\lib\gcc\arm-linux-androideabi\4.8\include -Id:\Proj
ects\AndroidKernel\Samsung\kernel2\arch\arm\include -Iinclude -include include\
generated\autoconf.h -D__KERNEL__ -mlittle-endian -Iarch\arm\mach-bcm215xx\inclu
de -Iarch\arm\plat-bcmap\include -D__ASSEMBLY__ -mabi=aapcs-linux -mno-thumb-int
erwork -funwind-tables -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s –
include asm\unified.h -msoft-float -gdwarf-2 -Wa, -c -o arch\arm\boot\compre
ssed\lib1funcs.o arch\arm\boot\compressed\lib1funcs.S

D:\Projects\AndroidKernel\Samsung\kernel2>C:\NDK\toolchains\arm-linux-androideab
i-4.8\prebuilt\windows\bin\arm-linux-androideabi-gcc -Wp,-MD,arch\arm\boot\compr
essed\.head.o.d -nostdinc -isystem c:\ndk\toolchains\arm-linux-androideabi-4.8\
prebuilt\windows\bin\..\lib\gcc\arm-linux-androideabi\4.8\include -Id:\Projects\
AndroidKernel\Samsung\kernel2\arch\arm\include -Iinclude -include include\gener
ated\autoconf.h -D__KERNEL__ -mlittle-endian -Iarch\arm\mach-bcm215xx\include -I
arch\arm\plat-bcmap\include -D__ASSEMBLY__ -mabi=aapcs-linux -mno-thumb-interwor
k -funwind-tables -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s -inclu
de asm\unified.h -msoft-float -gdwarf-2 -Wa, -c -o arch\arm\boot\compressed\
head.o arch\arm\boot\compressed\head.S

D:\Projects\AndroidKernel\Samsung\kernel2>C:\NDK\toolchains\arm-linux-androideab
i-4.8\prebuilt\windows\bin\arm-linux-androideabi-gcc -Wp,-MD,arch\arm\boot\compr
essed\.piggy.gzip.o.d -nostdinc -isystem c:\ndk\toolchains\arm-linux-androideab
i-4.8\prebuilt\windows\bin\..\lib\gcc\arm-linux-androideabi\4.8\include -Id:\Pro
jects\AndroidKernel\Samsung\kernel2\arch\arm\include -Iinclude -include include
\generated\autoconf.h -D__KERNEL__ -mlittle-endian -Iarch\arm\mach-bcm215xx\incl
ude -Iarch\arm\plat-bcmap\include -D__ASSEMBLY__ -mabi=aapcs-linux -mno-thumb-in
terwork -funwind-tables -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s
-include asm\unified.h -msoft-float -gdwarf-2 -Wa, -c -o arch\arm\boot\comp
ressed\piggy.gzip.o arch\arm\boot\compressed\piggy.gzip.S

Then for final steps:

D:\Projects\AndroidKernel\Samsung\kernel2>C:\NDK\toolchains\arm-linux-androideab
i-4.8\prebuilt\windows\bin\arm-linux-androideabi-ld -EL –defsym zreladdr=0x8160
0000+0x8000 -p –no-undefined -X -T arch\arm\boot\compressed\vmlinux.lds arch\ar
m\boot\compressed\head.o arch\arm\boot\compressed\piggy.gzip.o arch\arm\boot\com
pressed\misc.o arch\arm\boot\compressed\decompress.o arch\arm\boot\compressed\li
b1funcs.o -o arch\arm\boot\compressed\vmlinux

And:

D:\Projects\AndroidKernel\Samsung\kernel2>C:/NDK/toolchains/arm-linux-androideab
i-4.8/prebuilt/windows/bin/arm-linux-androideabi-objcopy -O binary -R .note -R .
note.gnu.build-id -R .comment -S arch/arm/boot/compressed/vmlinux arch/arm/boot/
zImage

This image is the kernel and can be used to create boot.img using carliv image kitchen.

Advertisements

From boot.img to boot.img-dt to DTB and DTS in Windows OS

August 16, 2017

Uncompress boot.img using carliv_image_kitchen-v1.3-x86.zip:

Then execute this command in cmd:

D:\Projects\AndromaxQ\carliv>carliv

Executing carliv and we have boot.img-dt. Let’s see whether the utility called dtc can be use to decode this file.

The dtc utility should be compiled first from: D:\Projects\dtc. So, let’s compile:

D:\Projects\dtc>make
CHK version_gen.h
CC convert-dtsv0-lexer.lex.o
convert-dtsv0-lexer.l:42:21: fatal error: fnmatch.h: No such file or directory
compilation terminated.
make: *** [convert-dtsv0-lexer.lex.o] Error 1

To capture what command that causes this error, it is necessary to use procmon.exe, using this settings:

And then export to a command line using batch file.

After examining more closely, the causes is that MINGW is not supporting the fnmatch function, so it should use Cygwin’s compiler instead. This is done by changing CC variable in makefile:

CC:=i686-pc-cygwin-gcc-4

Now I have:

D:\Projects\dtc>make
CHK version_gen.h
CC srcpos.o
CC util.o
cc1: warnings being treated as errors
util.c: In function `util_is_printable_string’:
util.c:90:3: error: array subscript has type `char’
make: *** [util.o] Error 1

This is because the -Werror flag in the make file, remove it and I have:

D:\Projects\dtc>dir *.exe
Volume in drive D is Data
Volume Serial Number is EFCE-4830

Directory of D:\Projects\dtc

08/15/2017 03:50 PM 115,009 convert-dtsv0.exe
08/15/2017 03:50 PM 279,645 dtc.exe
08/15/2017 03:50 PM 78,242 fdtdump.exe
08/15/2017 03:50 PM 106,605 fdtget.exe
08/15/2017 03:50 PM 134,453 fdtput.exe

Let’s use it:

D:\Projects\AndromaxQ\carliv\boot>dtc -I dtb -O dts -o mydts.dts boot.img-dt
FATAL ERROR: Blob has incorrect magic number

Seems, that this file is not intended to be processed by dtc.

Obtain dtbTool from github and compile:

D:\Projects\dtbTool>make
i686-pc-cygwin-gcc-4 -O2 -g -Wall -c dtbtool.c
dtbtool.c: In function `getChipInfo’:
dtbtool.c:273:23: warning: `entryEndedST’ may be used uninitialized in this func
tion
dtbtool.c:273:51: warning: `entryEndedDT’ may be used uninitialized in this func
tion
dtbtool.c:273:79: warning: `entryEndedPT’ may be used uninitialized in this func
tion
i686-pc-cygwin-gcc-4 -g -o dtbtool dtbtool.o

But actually the dtbTools is used to create the dt.img from files of *.dtb.

But now let’s use this:

D:\Projects\dtbTool>gcc split-appended-dtb.c -o split-appended-dtb

Now executed it at:

D:\Projects\AndromaxQ\carliv\boot>split-appended-dtb boot.img-dt
Found 47 appended dtbs, please check the output.

D:\Projects\AndromaxQ\carliv\boot>dir *.dtb
Volume in drive D is Data
Volume Serial Number is EFCE-4830

Directory of D:\Projects\AndromaxQ\carliv\boot

08/15/2017 04:40 PM 178,176 dtbdump_1.dtb
08/15/2017 04:40 PM 163,840 dtbdump_10.dtb
08/15/2017 04:40 PM 163,840 dtbdump_11.dtb

Let’s try our dtc.exe again:

D:\Projects\AndromaxQ\carliv\boot>dtc -I dtb -O dts -o mydts.dts dtbdump_1.dtb

It runs without error this time. And I have a decompiled *.dts file here:

How to Compile and Run Open Whisper Systems’ Signal Server (TextSecure Server) (Part 2)

August 9, 2017

Last time, when I try to activate Signal Server, I got this:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
null

So, it exited the loop, and only giving a “null” as an error message. This is the most cryptic error I’ve ever get in debugging experieces.

Checking the exact source of exception reveals it is java.lang.NullPointerException.

So, the call stack can be easily obtained by breaking into NullPointerException in the java sources:

And I have:

Let’s perform of analysis of this class:

APNSender apnSender = new APNSender(accountsManager, config.getApnConfiguration());

private static PrivateKey initializePrivateKey(String pemKey)

Let’s see the content of pemKey:

lkajsdf

The content of pemKey appears to be obtained from:

Since I just create the same dummy variables for the above configuration variables, let’s differentiate it, and I have that pemKey is initialized using pushKey configuration item:

PEMReader reader = new PEMReader(new InputStreamReader(new ByteArrayInputStream(pemKey.getBytes())));

I assumed that to get the pushKey from Apple required some dollar involvement, so, let’s just create a dummy PEM Key just to make this class happy.

import org.bouncycastle.openssl.PEMReader

So, this is part of the utility created by bouncycastle, let’s get some information regarding this first. OK, so this is a PEM Certificate, let’s try to generate it:

C:\OpenSSL-Win32\bin>openssl genrsa -out rsa_1024_priv.pem 1024
Generating RSA private key, 1024 bit long modulus
………++++++
…..++++++
e is 65537 (0x10001)

Run the server, and I have:

D:\Projects\AndroidProgram\Signal\Server>java -Xdebug -Xrunjdwp:transport=dt_soc
ket,server=y,address=8880,suspend=y -jar target\TextSecureServer-1.65.jar serve
r config/textsecure.yml
Listening for transport dt_socket at address: 8880
—–END RSA PRIVATE KEY not found

No matter what I try to fiddle with the key, I got this same error message. I believe the format I’ve passed to the configuration is OK. But let’s see whether it is generated some exception again.

This time, I got java.io.IOException. Repeat the above procedure, I have:

But when I try to trap the IOException, there’s an interesting IOException just BEFORE this exception. So, let’s check it out first:

\C:\Program Files (x86)\Java\jdk1.8.0_131\jre\lib\sunrsasign.jar

Seems, it has some relation with RSA signing. From the findjar website, I’ve found that is already in rt.jar so, I think I’ll stop pursue this issue for the moment.

Let’s come back to the above rather persistent error message to understand what it try to process from the given private key.

Retrieve bouncycastle module sources from:

http://central.maven.org/maven2/org/bouncycastle/bcprov-jdk16/1.46

Which is the dependency currently used by my TextSecureServer java program at this moment.

But NetBeans complains as follows:

Not able to submit breakpoint LineBreakpoint PemReader.java : 54, reason: Line number information is missing in the class file org.bouncycastle.util.io.pem.PemReader.

Let’s verify:

This is the one that has line number information:

D:\temp\dw\io\dropwizard>javap -l application.class
Compiled from “Application.java”
public abstract class io.dropwizard.Application {
protected io.dropwizard.Application();
LineNumberTable:
line 25: 0
line 27: 4
line 28: 11

And indeed, the given class in the jar does not have line number information:

D:\temp\bc\org\bouncycastle\openssl>javap -l pemreader.class
public class org.bouncycastle.openssl.PEMReader extends org.bouncycastle.util.io
.pem.PemReader {
public org.bouncycastle.openssl.PEMReader(java.io.Reader);

public org.bouncycastle.openssl.PEMReader(java.io.Reader, org.bouncycastle.ope
nssl.PasswordFinder);

Try to find compatible environment for BouncyCastle’s version 1.46 compilation proves to be difficult. After perform some research, I decided to compile the version 1.57 instead.

D:\Projects\JavaProgram\BouncyCastle>gradlew build -x lint
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

This can be resolved by copying existing gradle folder in the usable projects into this project folder.

Now I have:

D:\Projects\JavaProgram\BouncyCastle>gradlew build -x lint
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reus
ed, use –status for details
0% CONFIGURING [42s]
> root project > Resolve dependencies :classpath > gradle-cobertura-plugin-2.2.

It failed to download the above package. So again, using proxy will alleviate the problem.

But the result of version 1.57 is somewhat vague, which has many JARs that is not compatible with the intended version.

So, I have to resort to create a customized gradle build system from older 1.46 sources in D:\Projects\JavaProgram\BouncyCastle2, and after a successful compile, I verify it that it is indeed it has line number information in it:

D:\temp>javap -l pemreader.class
Compiled from “PemReader.java”
public class org.bouncycastle.util.io.pem.PemReader extends java.io.BufferedRead
er {
public org.bouncycastle.util.io.pem.PemReader(java.io.Reader);
LineNumberTable:
line 19: 0
line 20: 5
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 this Lorg/bouncycastle/util/io/pem/PemReader;
0 6 1 reader Ljava/io/Reader;

So, now I try to replace the 1.46 version in my local maven repository and perform the recompiling.

But to my surprises, I found many errors.

This is strange, because the first time I try to compile it is a success. Why the second compilation process is not ?

First, I suspect maybe it is the cause of my replacing of BouncyCastle 1.46, so I revert back to the old jar and try to re-compile with exact same error message:


[ERROR] /D:/Projects/AndroidProgram/Signal/Server/src/main/java/java/util/function/LongUnaryOperator.java:[64,5] default methods are not supported in -source 1.7
(use -source 8 or higher to enable default methods)
[ERROR] /D:/Projects/AndroidProgram/Signal/Server/src/main/java/java/util/function/LongUnaryOperator.java:[66,25] lambda expressions are not supported in -source 1.7
(use -source 8 or higher to enable lambda expressions)
[ERROR] /D:/Projects/AndroidProgram/Signal/Server/src/main/java/java/util/function/LongUnaryOperator.java:[92,38] static interface methods are not supported in -source 1.7
(use -source 8 or higher to enable static interface methods)

Try to change the version as suggested by the error message, i.e change to 1.8 proves to be generated more cryptic errors. So I revert back to the old configuration, and I decided to compare the original sources to the one I try to re-compile, and I found mysterious java folder inside the sources I try to re-compile.

And suddenly I realized it is my mistake this time, because I accidentally use this source folder as a NetBeans debugging, and added unnecessary sources into the folder.

Next time I should place the debugging source files into another folder. After removing the offending folders, and try to recompile:

[INFO] ———————
[INFO] BUILD SUCCESS
[INFO] ———————

It is OK with the version 1.46 of BouncyCastle utility. So, let’s replace it now with one with line number information and see what happens when I try to re-compile, again it is a success.

To create a separate source, I created a new folder at D:\Projects\NetBeans\SignalServer to host the new location of NetBeans project.

After some studying of NetBeans to try to separate the sources for debugging and the actual program so that the above compiling error can be avoided, I realized, it is very difficult to achieve that condition.

Later on, I found that using “Remote Attach” to add new Source Root will solve the problem:

The Java and any other JARs that required source code debugging then can be placed into D:\Projects\NetBeans\Debug\src. Now, let’s start to analyze the BouncyCastle error.

First, I try to perform breakpoint at the PemReader’s loadObject, and here is the result:

The readLine function suddenly returning with null, so it end up with the —–END RSA PRIVATE KEY not found error. This indicated that the buffer is not received any of the data. Hmm, fishy.

After checking the readPemObject function of PemReader.java, I realized that the passed string should contain Carriage Return and Line Feed. But how to encode it into YAML object ?

Try to pass \r and \n proves to be futile, because readLine inside this function returns one line:

After some study of YAML using this format will solve the issue:

Now I have:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65.
jar server config/textsecure.yml
org/eclipse/jetty/alpn/ALPN$Provider

The cause of the above exit is java.lang.NoClassDefFoundError. Try to perform break point, I have:

at java.lang.NoClassDefFoundError.(NoClassDefFoundError.java:59)
at io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$1.(JdkAlpnApplicationProtocolNegotiator.java:26)
at io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator.(JdkAlpnApplicationProtocolNegotiator.java:24)
at io.netty.handler.ssl.JdkSslContext.toNegotiator(JdkSslContext.java:285)
at io.netty.handler.ssl.JdkSslClientContext.(JdkSslClientContext.java:261)
at io.netty.handler.ssl.SslContext.newClientContextInternal(SslContext.java:751)
at io.netty.handler.ssl.SslContextBuilder.build(SslContextBuilder.java:418)
at com.relayrides.pushy.apns.ApnsClientBuilder.build(ApnsClientBuilder.java:408)
at org.whispersystems.textsecuregcm.push.RetryingApnsClient.(RetryingApnsClient.java:63)
at org.whispersystems.textsecuregcm.push.APNSender.(APNSender.java:61)
at org.whispersystems.textsecuregcm.WhisperServerService.run(WhisperServerService.java:176)
at org.whispersystems.textsecuregcm.WhisperServerService.run(WhisperServerService.java:111)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
at io.dropwizard.cli.Cli.run(Cli.java:74)
at io.dropwizard.Application.run(Application.java:89)
at org.whispersystems.textsecuregcm.WhisperServerService.main(WhisperServerService.java:276)

The above exception is tripped by the statement:

if (!JdkAlpnSslEngine.isAvailable()) in JdkAlpnApplicationProtocolNegotiator.java, which is caused by un-initialized JdkAlpnSslEngine

But why it has connection to the above org/eclipse/jetty/alpn/ALPN$Provider ? Checking the source code of JdkAlpnSslEngine.java, it is indeed there’s reference to this class:

import org.eclipse.jetty.alpn.ALPN

Performing checking to the binary JARs also confirm the non-existent of this class.

Some statement from the web regarding this issue in https://stackoverflow.com/questions/39856972/http-2-java-8-jetty-and-alpn:

Jetty’s ALPN boot jar works with both OpenJDK and Oracle’s JDK (which is based on OpenJDK).

Jetty’s ALPN boot jar must be in the boot classpath, not the regular classpath, like the documentation you linked says.

As such, you must not declare it as a dependency in your pom.xml files (there is no need to, like there is no need for you to specify a dependency on the JDK classes).

JDK 9 will have ALPN support native, there is already some work in that direction.

For java version java version “1.8.0_131” requires 8.1.11.v20170118.

Configuring command line to:

java -Xbootclasspath/p:target\alpn-boot-8.1.11.v20170118.jar -jar target\TextSecureServer-1.65.jar server config/textsecure.yml

D:\Projects\AndroidProgram\Signal\Server>java -Xbootclasspath/p:target\alpn-boot
-8.1.11.v20170118.jar -jar target\TextSecureServer-1.65.jar server config/textse
cure.yml

Will solve this issue, but now the server is continuous loop. But seems there’s no information, logs or anything to indicate what is it that is doing. Using ProcMon to find out interesting files created reveals:

D:\tmp\textsecureshserver.log

Inside this file is a wealth of information regarding the server’s activities. Hmm, good job Open Whisper Systems. Although there’s some issue should be fixed, for example a more friendly error message and some initial information of where to search vital information such as log, etc.

But I think this is the way how open source community works.

After a while, the server stops by itself:

D:\Projects\AndroidProgram\Signal\Server>java -Xbootclasspath/p:target\alpn-boot
-8.1.11.v20170118.jar -jar target\TextSecureServer-1.65.jar server config/textse
cure.yml
Multiple exceptions

Hmm, interesting, but I will stop for the moment.

How to Compile and Run Open Whisper Systems’ Signal Server (TextSecure Server)

August 7, 2017

The readme.md content from https://github.com/WhisperSystems/Signal-Server do not give a slightest hint of how to build the source.

Reading some hints in http://debabhishek.com/writes/Installing-and-Running-TextSecure-Signal-Server-on-Windows/. It turns out it should be compiled using Maven.

So, let’s download maven first. Then perform some sanity check:

C:\Windows\System32>mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T02:39:0
6+07:00)
Maven home: C:\Maven\bin\..
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: C:\PROGRA~2\Java\jdk1.8.0_131\jre
Default locale: en_US, platform encoding: Cp1252
OS name: “windows 7”, version: “6.1”, arch: “x86”, family: “windows”

Now, let’s compile:

D:\Projects\AndroidProgram\Signal\Server>mvn clean install -DskipTests
[INFO] Scanning for projects…
[WARNING] The project org.whispersystems.textsecure:TextSecureServer:jar:1.65 us
es prerequisites which is only intended for maven-plugin projects but not for no
n maven-plugin projects. For such purposes you should use the maven-enforcer-plu
gin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.ht
ml
[INFO]
[INFO] ————————————————————————
[INFO] Building TextSecureServer 1.65
[INFO] ————————————————————————
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-source-plugin/2.2.1/maven-source-plugin-2.2.1.pom
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 22.536 s
[INFO] Finished at: 2017-08-03T09:51:24+07:00
[INFO] Final Memory: 7M/17M
[INFO] ————————————————————————
[ERROR] Plugin org.apache.maven.plugins:maven-source-plugin:2.2.1 or one of its
dependencies could not be resolved: Failed to read artifact descriptor for org.a
pache.maven.plugins:maven-source-plugin:jar:2.2.1: Could not transfer artifact o
rg.apache.maven.plugins:maven-source-plugin:pom:2.2.1 from/to central (https://r
epo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.a
pache.org/151.101.40.215] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException

D:\Projects\AndroidProgram\Signal\Server>

So, perform changes in the Maven’s settings.xml:

After some lengthy POM and JARs download, I have:

[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 24:57 min
[INFO] Finished at: 2017-08-03T11:06:09+07:00
[INFO] Final Memory: 30M/104M
[INFO] ————————————————————————

Let’s run it:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65.jar

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65.
jar
usage: java -jar TextSecureServer-1.65.jar
[-h] [-v]
{server,check,directory,vacuum,trim,stats,rmuser,accountdb,messagedb}

positional arguments:
{server,check,directory,vacuum,trim,stats,rmuser,accountdb,messagedb}
available commands

optional arguments:
-h, –help show this help message and exit
-v, –version show the application version and exit

Let’s run it using the configuration given from the above website:

java -jar target\TextSecureServer-1.65.jar server config/textsecure.yml

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has an error:
* Malformed YAML at line: 8, column: 3; while scanning a simple key
in ‘reader’, line 8, column 1:
+33756796138 #fake
^
could not find expected ‘:’
in ‘reader’, line 9, column 1:
localDomain: foo.org
^

at [Source: java.io.FileInputStream@9175d8; line: 7, column: 2]

So, let’s debug it:

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8880,suspend=y -jar target\TextSecureServer-1.65.jar server config/textsecure.yml

The command line result:

D:\Projects\AndroidProgram\Signal\Server>java -Xdebug -Xrunjdwp:transport=dt_soc
ket,server=y,address=8880,suspend=y -jar target\TextSecureServer-1.65.jar serve
r config/textsecure.yml
Listening for transport dt_socket at address: 8888
config/textsecure.yml has an error:
* Malformed YAML at line: 8, column: 3; while scanning a simple key
in ‘reader’, line 8, column 1:
+33756796138 #fake
^
could not find expected ‘:’
in ‘reader’, line 9, column 1:
localDomain: foo.org
^
at [Source: java.io.FileInputStream@f76a6; line: 7, column: 2]

There’s no more helpful information. So, let’s find at what routine or module that give the above error, i.e. the Malformed YAML error string. This is done by extracting files in the JAR and perform binary search into the files by using utilities, such as WinHex. It takes some time, but I think this is one of possible starting point.

But the search turns out … nothing, either by using ASCII or UNICODE format. Hmm, so what to do ?

Try to do googling regarding the error message, I realized that the error location could be somewhere at YamlConfigurationFactory class of io.dropwizard java class utility.

Let’s obtain this source, but first I have to consult the maven repository of the version being used in this java application, and it turns out using v1.1.0.

Try to obtain the source from http://central.maven.org/maven2/io/dropwizard/dropwizard-configuration/1.1.0/dropwizard-configuration-1.1.0-sources.jar proves to be diffcult because what I got is a connection reset error.

After the source code is obtained, and placed it in proper folder on the Netbeans project, I place the breakpoint to this routine:

It is a hit, but the Netbeans is hang when I try to view the call stack.

What I only got is some information like this:

But this should be enough. Upon restarting the Netbeans, turns out to be ok.

After importing proper source code and perform some step traces, I have:

Where the location of the error is at BaseConfigurationFactory.java in io.dropwizard class:

The reason that I do not find “Malformed YAML” error message is because error string is generated programmatically, where as when I try to search for string Malformed I find many instances in the binary files.

So, let’s examine more detail of this error, which is actually originated from MarkedYAMLException:

Checking further:

This is because the config I copied from given by above website is indeed malformed, the spaces is missing, and after fixing the TextSecure.yml config file:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has an error:
* Unrecognized field at: push.host
Did you mean?:
– queueSize

No matter what I modify in the file, I always get this constant message error, and there’s a mysterious suggestion of queueSize. So let’s fire our binary search again shall we ?

Binary search is suggested at BaseConfigurationFactory.java and the suggestion is retrieved using e.getKnownPropertyIds().stream().

OK now, let’s enter this property using blank value and remove the unknown property, and we have:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has an error:
* Unrecognized field at: websocket
Did you mean?:
– webSocket
– cache
– redphone
– server
– metrics
[16 more]

To retrieve complete properties, I have to resort to debugger which is:

s3,cache,federation,read_database,webSocket,testDevices, twilio, directory, gcm, httpClient, push, database, redphone, apn, metrics, messageStore, turn, logging, server

The above keyword should be the complete keyword for the root property configuration options. There’s typo in the given sample text secure configuration from the above website.

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has an error:
* Unrecognized field at: webSocket.enabled
Did you mean?:
– requestLog

At this point, I started to wonder the validity of the given configuration from the above website.

After browsing some of the codings, then I realized, that the purpose of the parser is to try to map the text in to the class, at the root class is named WhisperServerConfiguration.java.

After more fiddling with the TextSecure.yml, I finally get:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has the following errors:
* apn may not be null
* gcm may not be null
* turn may not be null
* webSocket.requestLog may not be null

Let’s first tackle the webSocket configuration issue by passing requestLog: abc, since I don’t know the purpose that option yet, and I have:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has an error:
* Failed to parse configuration at: webSocket.requestLog; Can not construct in
stance of io.dropwizard.request.logging.LogbackAccessRequestLogFactory: no Strin
g-argument constructor/factory method to deserialize from String value (‘abc’)
at [Source: N/A; line: -1, column: -1] (through reference chain: org.whispersys
tems.textsecuregcm.WhisperServerConfiguration[“webSocket”]->org.whispersystems.w
ebsocket.configuration.WebSocketConfiguration[“requestLog”])

After some head scratching and source code review, I realized, this must be configuration item from io.dropwizard utility and I found that using this:

Will stop the complain. But what if I purposely mistyped the type ? In this case, I have:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has an error:
* Failed to parse configuration at: webSocket.requestLog.appenders; Could not
resolve type id ‘consolex’ into a subtype of [simple type, class io.dropwizard.l
ogging.AppenderFactory]: known type ids
= [AppenderFactory, console, file, papertrail, syslog]
at [Source: N/A; line: -1, column: -1] (through reference chain: org.whispersys
tems.textsecuregcm.WhisperServerConfiguration[“webSocket”]->org.whispersystems.w
ebsocket.configuration.WebSocketConfiguration[“requestLog”]->io.dropwizard.reque
st.logging.LogbackAccessRequestLogFactory[“appenders”])

Hmm, interesting. There are indeed other types of requestLog option, but let’s revert it back to console, now I have:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
config/textsecure.yml has the following errors:
* apn may not be null
* gcm may not be null
* turn may not be null

After proper settings of dummy TextSecure.yml file I have:

D:\Projects\AndroidProgram\Signal\Server>java -jar target\TextSecureServer-1.65
.jar server config/textsecure.yml
null

No exceptions, anything whatsoever, just “null”. Well, I will stop here for a moment.

How the BBM Android Application Get the Incoming Message

June 30, 2017

The routine to process incoming and outgoing message resides in BbmCoreService.java. This is after the libbbmcore.so library is loaded and proper authentication process is done successfully.

After libbbmcore.so is loaded and functional, periodically it will call a method in BbmCoreService class called prv_msgFromService. This is the incoming messages, which has many types, including advertising messages. This in turn will call the callback and other necessary routines, such as notifications, etc.

Likewise, the outgoing message is constructed to suitable format before sending it via the native method called prv_msgToService, also in libbbmcore.so.

Hope this small burst of information can help 🙂

After more detailed examination, I can added that the routine to handle incoming message resides in libtransport.so native library. It is implemented using socket, connect, select and recv socket functions.

On the start up of this library (i.e. the libtransport.so), it tries to connect to one of the BBM server IP Addresses, which is from 74.82.64.0 to 74.82.95.255, using SOCK_DGRAM connection type.

The received data is in encrypted form, and it is decrypted locally using SSL_read combined with BIO_write function, after properly set up the link between BIO and SSL functions using SSL_set_bio.

After the received data is processed, the libtransport.so routine will perform write to the created write end point of the pipe from libbbmcore.so routines. This will trigger the necessary functions such as showing the Notification with is BBM tone, etc.

How to Compile Android Lollipop (5.1.1) Contacts onWindows OS

June 21, 2017

This is the modified build system to be used to compile existing APK from Android Lollipop 5.1.1 Framework. In this example it is used to compile Android’s Contacts.apk.

You can used it also to compile another Android packages.

The build system is taken from android-5.1.1_r38 source tree. Basically the compile error is not finding which module that is required, the slash or backslash problem and certain script code that is not supported by bash shell on Windows OS.

There’s also the problem when unzipping the download *.gz file from Android source repository. You should use the gzip and tar command line program from MSYS or GNUWIN32.

The build script is proven to be successfully run on windows version 7-6.1.7601-SP1.

The modified build scripts already uploaded to github:

https://github.com/surya-rakanta/AndroidBuildSystemOnWindows

Below is the log of compiling session from start to finish and how to solve each compiling issue one by one.

The script is checked and revised using the probe text such as until …, etc, so you will see some weird output such as until herexxy9aay2, etc, in the compiling session log below. Ignore it.

You can examine the final modified build system in the downloaded from github.

Retrieve the source from:

https://android.googlesource.com/platform/packages/apps/Contacts/+/android-5.1.1_r38

Put it into structures here:

D:\Projects\Lollipop\platform\packages\apps\Contacts

Download build system:

https://android.googlesource.com/platform/build/+/android-5.1.1_r38

Put it here:

D:\Projects\Lollipop\platform\build

Perform modification in envsetup.sh, but first copy this shell file into back up file

Execute envsetup.sh, and we have:

D:\Projects\Lollipop\platform\build>bash
bash-3.1$ ./envsetup.sh
./envsetup.sh: line 1134: unexpected argument `(‘ to conditional binary operator

./envsetup.sh: line 1134: syntax error near `(^’
./envsetup.sh: line 1134: ` if [[ $CPU_ABI =~ (^|,)arm64 ]]; then’

Remark it

We have:

bash-3.1$ ./envsetup.sh
./envsetup.sh: line 1184: unexpected argument `(‘ to conditional binary operator

./envsetup.sh: line 1184: syntax error near `(^’
./envsetup.sh: line 1184: ` if [[ $EXE =~ (^|/)(app_process|dalvikvm)(|32|64)$
]]; then’

Remark again:

We have:

bash-3.1$ ./envsetup.sh
./envsetup.sh: line 1279: unexpected argument `(‘ to conditional binary operator

./envsetup.sh: line 1279: syntax error near `(^’
./envsetup.sh: line 1279: ` if [[ $EXE =~ (^|/)(app_process|dalvikvm)(|32|
64)$ ]]; then’

Remark

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/envsetup.mk:67: *** Unable to determine HOST_OS from uname -sm: MINGW
32_NT-6.1 i686!. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets ####

Modify in D:\Projects\Lollipop\platform\build\core\envsetup.mk:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/envsetup.mk:94: *** Unable to determine HOST_ARCH from uname -sm: MIN
GW32_NT-6.1 i686!. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets ####

Modify in D:\Projects\Lollipop\platform\build\core\envsetup.mk:

HOST_ARCH := x86

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/config.mk:454: *** Error: could not find jdk tools.jar, please check
if your JDK was installed correctly. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (1 seconds) ####

Checking:

D:\Projects\Lollipop\platform>bash
bash-3.1$ build/core/find-jdk-tools-jar.sh
/c/Program Files (x86)/Java/jdk1.6.0_26/lib/tools.jar

Remark in D:\Projects\Lollipop\platform\build\core\config.mk:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
Checking build tools versions…
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: java version “1.8.0_131” Java(TM) SE Runtime Environment (build
1.8.0_131-b11) Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode, sharin
g).
The required version is: “1.7.x”

Please follow the machine setup instructions at
https://source.android.com/source/initializing.html
************************************************************
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/main.mk:167: *** stop. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (6 seconds) ####

bash-3.1$

Install jdk-7u79-windows-i586.exe, change windows path environment and verify:

C:\Windows\System32>java -version
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Client VM (build 24.79-b02, mixed mode, sharing)

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
Checking build tools versions…
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/main.mk:459: sdk/build/windows_sdk_whitelist.mk: No such file or dire
ctory
build/core/main.mk:460: development/build/windows_sdk_whitelist.mk: No such file
or directory
including build/tools/acp\Android.mk …

#### make failed to build some targets (32 seconds) ####

bash-3.1$

And the windows crash:

The cause of this crash is located at D:\Projects\Lollipop\platform\build\core\base_rules.mk:

gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)

Create a test make file called mktest.mk inside D:\Projects\Lollipop\platform with content as follows:

#SHELL := /bin/bash

###########################################################
## Scan through each directory of $(1) looking for files
## that match $(2) using $(wildcard). Useful for seeing if
## a given directory or one of its parents contains
## a particular file. Returns the first match found,
## starting furthest from the root.
###########################################################
$(info until herexxy9aa1)

define find-parent-file
$(strip \
$(eval _fpf := $(wildcard $(foreach f, $(2), $(strip $(1))/$(f)))) \
$(if $(_fpf),$(_fpf), \
$(if $(filter-out ./ .,$(1)), \
$(call find-parent-file,$(patsubst %/,%,$(dir $(1))),$(2)) \
) \
) \
)
endef

LOCAL_PATH := “build/tools/acp\”
$(info until $(LOCAL_PATH))

gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)

The cause of make program crash is present of unwanted backslash in build/tools/acp\

Remark by making gpl_license_file blank for the moment, we have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/main.mk:459: sdk/build/windows_sdk_whitelist.mk: No such file or dire
ctory
build/core/main.mk:460: development/build/windows_sdk_whitelist.mk: No such file
or directory
including build/tools/acp\Android.mk …
until herexxy9aay2
make: *** No rule to make target `development/build/windows_sdk_whitelist.mk’.
Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (13 seconds) ####

Retrieve sdk tree.

Place it in in local directory

Retrieve development tree from:

Place it in:

Change envsetup.sh script inside function make():

local start_time=$(date +”%s”)
#$(get_make_command) “$@”
command make -C /d/Projects/Lollipop/platform -f build/core/main.mk BUILD_MODULES_IN_PATHS=d:/Projects/Lollipop/platform/packages/apps/Contacts -p > myMake1.txt

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
/bin/bash: line 0: cd: development/appsBluetoothDebug : No such file or director
y
/bin/bash: line 0: cd: development/appsBuildWidget : No such file or directory
find: src: No such file or directory
build/core/java.mk:23: *** development/apps\BuildWidget\: Invalid LOCAL_SDK_VERS
ION ‘current’ Choices are: . Stop.

#### make failed to build some targets (11 seconds) ####

Checking the included sub directories in D:\Projects\Lollipop\platform\build\core\main.mk using info statement:

D:\Projects\Lollipop\platform\build\core\main.mk

We get the result:

the sub dirs external/openssl prebuilt prebuilts build/libs/host build/tools/z
ipalign dalvik/dexdump dalvik/libdex dalvik/tools/dmtracedump dalvik/tools/hprof
-conv development/host development/tools/etc1tool development/tools/line_endings
external/clang external/easymock external/expat external/gtest external/libcxx
external/libcxxabi external/compiler-rt external/libpng external/llvm external/s
qlite/dist external/zlib external/zopfli frameworks/base frameworks/compile fram
eworks/native frameworks/rs frameworks/tools system/core/adb system/core/fastboo
t system/core/libcutils system/core/liblog system/core/libsparse system/core/lib
ziparchive system/core/libzipfile system/core/libutils system/extras/ext4_utils
build/tools/signapk dalvik/dx libcore development/apps development/tools/mkstubs
frameworks/compile/libbcc packages build/tools/acp

Probing with:

$(info the sub dir make file $(subdir_makefiles))

We get:

the sub dir make file build/libs/host\Android.mk build/tools/acp\Android.mk buil
d/tools/signapk\Android.mk build/tools/zipalign\Android.mk development/apps\Blue
toothDebug\Android.mk development/apps\BuildWidget\Android.mk development/apps\C
ustomLocale\Android.mk development/apps\DevelopmentSettings\Android.mk developme
nt/apps\Development\Android.mk development/apps\Fallback\Android.mk development/
apps\GestureBuilder\Android.mk development/apps\NinePatchLab\Android.mk developm
ent/apps\OBJViewer\Android.mk development/apps\SdkSetup\Android.mk development/a
pps\SettingInjectorSample\Android.mk development/apps\WidgetPreview\Android.mk d
evelopment/apps\launchperf\Android.mk development/host\Android.mk development/to
ols/etc1tool\Android.mk development/tools/line_endings\Android.mk development/to
ols/mkstubs\Android.mk packages\apps\ContactsCommon\Android.mk packages\apps\Con
tacts\Android.mk

Most of the program is not needed, so just re-assign the subdir_makefiles in D:\Projects\Lollipop\platform\build\core\main.mk:

subdir_makefiles := packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk

Now we have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including packages/apps/ContactsCommon/Android.mk …
find: ../PhoneCommon/src: No such file or directory
including packages/apps/Contacts/Android.mk …
find: ../PhoneCommon/src: No such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `prebuilts/sdk/api/.txt’, needed by `out/target
/common/obj/PACKAGING/checkpublicapi-last-timestamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (14 seconds) ####

bash-3.1$

Retrieve PhoneCommon source tree from:

Place it in:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `prebuilts/sdk/api/.txt’, needed by `out/target
/common/obj/PACKAGING/checkpublicapi-last-timestamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (15 seconds) ####

bash-3.1$

Copy files from:

Place it in:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: *** No rule to make target `out/target/common/obj/PACKAGING/public_api.txt
‘, needed by `out/target/common/obj/PACKAGING/checkpublicapi-last-timestamp’. S
top.

#### make failed to build some targets (14 seconds) ####

out/target/common/obj/PACKAGING/checkpublicapi-last-timestamp: prebuilts/sdk/api/22.txt out/target/common/obj/PACKAGING/public_api.txt frameworks/base/api/removed.txt out/host/windows-x86/bin/apicheck.exe out/target/common/docs/api-stubs-timestamp
# Implicit rule search has not been done.
# File does not exist.
# File has not been updated.
# variable set hash-table stats:
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%
# commands to execute (from `build/core/tasks/apicheck.mk’, line 46):
@echo “Checking API:” checkpublicapi-last
@ ( out/host/windows-x86/bin/apicheck.exe -JXmx1024m -J”classpath /c/Program Files (x86)/Java/jdk1.7.0_79/lib/tools.jar:out/host/windows-x86/framework/doclava.jar:out/host/windows-x86/framework/jsilver.jar” -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 prebuilts/sdk/api/22.txt out/target/common/obj/PACKAGING/public_api.txt frameworks/base/api/removed.txt out/target/common/obj/PACKAGING/removed.txt || ( cat build/core/apicheck_msg_last.txt ; exit 38 ) )
@ mkdir -p $(dir $@)
@ touch $@

# INTERNAL_PLATFORM_API_FILE is the one build by droiddoc.
# Note that since INTERNAL_PLATFORM_API_FILE is the byproduct of api-stubs module,
# (See frameworks/base/Android.mk)
# we need to add api-stubs as additional dependency of the api check.

# Check that the API we’re building hasn’t broken the last-released
# SDK version.
$(eval $(call check-api, \
checkpublicapi-last, \
$(SRC_API_DIR)/$(last_released_sdk_version).txt, \
$(INTERNAL_PLATFORM_API_FILE), \
frameworks/base/api/removed.txt, \
$(INTERNAL_PLATFORM_REMOVED_API_FILE), \
-hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
-error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
-error 16 -error 17 -error 18 , \
cat $(BUILD_SYSTEM)/apicheck_msg_last.txt, \
check-public-api, \
$(call doc-timestamp-for,api-stubs) \
))

The out/target/common/obj/PACKAGING/public_api.txt is generated by the command:

update-public-api: out/target/common/obj/PACKAGING/public_api.txt | out/host/-x86/bin/acp
# Phony target (prerequisite of .PHONY).
# Implicit rule search has not been done.
# File does not exist.
# File has not been updated.
# commands to execute (from `build/core/tasks/apicheck.mk’, line 79):
@echo Copying current.txt
$(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) frameworks/base/api/current.txt
@echo Copying removed.txt
$(hide) $(ACP) $(INTERNAL_PLATFORM_REMOVED_API_FILE) frameworks/base/api/removed.txt

Retrieve source tree from:

Place it in:

But we still have:

make: *** No rule to make target `out/target/common/obj/PACKAGING/public_api.txt
‘, needed by `out/target/common/obj/PACKAGING/checkpublicapi-last-timestamp’. S
top.

Let’s try to build ACP first, but we have:

# ACP is always for the build OS, not for the host OS
ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)

BUILD_OUT_EXECUTABLES := out/host/-x86/bin

Which is:

BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin

Where as:

BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)

Modify in D:\Projects\Lollipop\platform\build\core\envsetup.mk:

Let’s revert to original one:

command make -C /d/Projects/Lollipop/platform -f build/core/main.mk all_modules BUILD_MODULES_IN_PATHS= build/d:/Projects/Lollipop/platform/packages/apps/Contacts -p > myMake2.txt

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including build/libs/host\Android.mk …
including build/tools/acp\Android.mk …
including build/tools/signapk\Android.mk …
including build/tools/zipalign\Android.mk …
including development/apps\BluetoothDebug\Android.mk …
/bin/bash: line 0: cd: development/appsBluetoothDebug : No such file or director
y
including development/apps\BuildWidget\Android.mk …
/bin/bash: line 0: cd: development/appsBuildWidget : No such file or directory
find: src: No such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** development/apps\BuildWidget\: Invalid LOCAL_SDK_VERS
ION ‘current’ Choices are: . Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (11 seconds) ####

bash-3.1$

Check environment variables:

Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))

# makefile (from `build/core/config.mk’, line 599)
TARGET_AVAILABLE_SDK_VERSIONS :=

TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))

HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk

Download from:

Place it in:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including build/libs/host\Android.mk …
including build/tools/acp\Android.mk …
including build/tools/signapk\Android.mk …
including build/tools/zipalign\Android.mk …
including development/apps\BluetoothDebug\Android.mk …
/bin/bash: line 0: cd: development/appsBluetoothDebug : No such file or director
y
including development/apps\BuildWidget\Android.mk …
/bin/bash: line 0: cd: development/appsBuildWidget : No such file or directory
find: src: No such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** development/apps\BuildWidget\: Invalid LOCAL_SDK_VERS
ION ‘current’ Choices are: 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (11 seconds) ####

bash-3.1$

Edit the subdir_makefiles to:

subdir_makefiles := build/libs/host\Android.mk build/tools/acp\Android.mk build/tools/signapk\Android.mk build/tools/zipalign\Android.mk development/apps/BluetoothDebug\Android.mk development/apps/BuildWidget\Android.mk development/apps/CustomLocale\Android.mk development/apps\DevelopmentSettings\Android.mk development/apps/Development\Android.mk development/apps/Fallback\Android.mk development/apps/GestureBuilder\Android.mk development/apps/NinePatchLab\Android.mk development/apps/OBJViewer\Android.mk development/apps/SdkSetup\Android.mk development/apps/SettingInjectorSample\Android.mk development/apps/WidgetPreview\Android.mk development/apps/launchperf\Android.mk development/host\Android.mk development/tools/etc1tool\Android.mk development/tools/line_endings\Android.mk development/tools/mkstubs\Android.mk packages/apps/ContactsCommon\Android.mk packages/apps/Contacts\Android.mk

And change the command inside function make():

command make -C /d/Projects/Lollipop/platform -f build/core/main.mk all_modules BUILD_MODULES_IN_PATHS= d:/Projects/Lollipop/platform/packages/apps/Contacts

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including build/libs/host\Android.mk …
including build/tools/acp\Android.mk …
including build/tools/signapk\Android.mk …
including build/tools/zipalign\Android.mk …
including development/apps/BluetoothDebug\Android.mk …
including development/apps/BuildWidget\Android.mk …
including development/apps/CustomLocale\Android.mk …
including development/apps\DevelopmentSettings\Android.mk …
including development/apps/Development\Android.mk …
including development/apps/Fallback\Android.mk …
including development/apps/GestureBuilder\Android.mk …
including development/apps/NinePatchLab\Android.mk …
including development/apps/OBJViewer\Android.mk …
including development/apps/SdkSetup\Android.mk …
including development/apps/SettingInjectorSample\Android.mk …
including development/apps/WidgetPreview\Android.mk …
including development/apps/launchperf\Android.mk …
including development/host\Android.mk …
including development/tools/etc1tool\Android.mk …
including development/tools/line_endings\Android.mk …
including development/tools/mkstubs\Android.mk …
including packages/apps/ContactsCommon\Android.mk …
including packages/apps/Contacts\Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
Import includes file: out/host/windows-x86/obj/STATIC_LIBRARIES/libhost_intermed
iates/import_includes
host C: libhost <= build/libs/host\/CopyFile.c
build/libs/host/CopyFile.c:1:0: warning: -fPIC ignored for target (all code is p
osition independent) [enabled by default]
gcc.exe: warning: out/host/windows-x86/obj/STATIC_LIBRARIES/libhost_intermediate
s: linker input file unused because linking not done
Export includes file: build/libs/hostAndroid.mk — out/host/windows-x86/obj/STAT
IC_LIBRARIES/libhost_intermediates/export_includes
host StaticLib: libhost (out/host/windows-x86/obj/STATIC_LIBRARIES/libhost_inter
mediates/libhost.a)
Import includes file: out/host/windows-x86/obj/EXECUTABLES/acp_intermediates/imp
ort_includes
host C: acp /dev/null))
subdirs += \
# external/ant-glob \
# external/eclipse-windowbuilder/propertysheet \
# external/hamcrest \
# external/junit \
# sdk/apkbuilder \
# sdk/eclipse/scripts/rcp \
# sdk/testutils

subdirs += \
prebuilt \
prebuilts \
build/libs/host \
build/tools/zipalign \
dalvik/dexdump \
dalvik/libdex \
dalvik/tools/dmtracedump \
dalvik/tools/hprof-conv \
development/host \
development/tools/etc1tool \
development/tools/line_endings \
external/clang \
external/easymock \
external/expat \
external/gtest \
external/libcxx \
external/libcxxabi \
external/compiler-rt \
external/libpng \
external/llvm \
external/sqlite/dist \
external/zlib \
external/zopfli \
frameworks/base \
frameworks/compile \
frameworks/native \
frameworks/rs \
frameworks/tools \
system/core/adb \
system/core/fastboot \
system/core/libcutils \
system/core/liblog \
system/core/libsparse \
system/core/libziparchive \
system/core/libzipfile \
system/core/libutils \
system/extras/ext4_utils

subdirs += \
build/tools/signapk \
dalvik/dx \
libcore \
development/apps \
development/tools/mkstubs \
frameworks/compile/libbcc \
packages

Building Contacts.apk:

command make -C /d/Projects/Lollipop/platform -f build/core/main.mk out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk

out/target/product/generic/system/priv-app/Contacts/Contacts.apk: out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk | out/host/windows-x86/bin/acp out/target/product/generic/obj/NOTICE_FILES/src//system/priv-app/Contacts/Contacts.apk.txt

make: *** No rule to make target `out/host/windows-x86/bin/aapt.exe’, needed by
`out/target/common/obj/APPS/Contacts_intermediates/src/R.stamp’. Stop.
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

Copy existing aapt.exe from latest Android tools sdk to the directory.

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
target R.java/Manifest.java: Contacts (out/target/common/obj/APPS/Contacts_inter
mediates/src/R.stamp)
ERROR: resource directory ‘frameworks\support\v7\cardview\res’ does not exist
make: *** [out/target/common/obj/APPS/Contacts_intermediates/src/R.stamp] Error
1
make: Leaving directory `/d/Projects/Lollipop/platform’
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

#### make failed to build some targets (17 seconds) ####

Copy from:

We have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/sdk_v21_i
ntermediates/classes.jar’, needed by `out/target/common/obj/APPS/Contacts_interm
ediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

full_java_lib_deps := out/target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/com.android.contacts.common.test_intermediates/javalib.jar out/target/common/obj/APPS/Contacts_intermediates/classes.jar

including build/libs/host\Android.mk …
the full java libx
including build/tools/acp\Android.mk …
the full java libx
including build/tools/signapk\Android.mk …
the full java libx
including build/tools/zipalign\Android.mk …
the full java libx out/host/common/obj/JAVA_LIBRARIES/bouncycastle-host_interm
ediates/javalib.jar out/host/common/obj/JAVA_LIBRARIES/bouncycastle-bcpkix-host
_intermediates/javalib.jar
including development/apps/BluetoothDebug\Android.mk …
the full java libx out/host/common/obj/JAVA_LIBRARIES/bouncycastle-host_interm
ediates/javalib.jar out/host/common/obj/JAVA_LIBRARIES/bouncycastle-bcpkix-host
_intermediates/javalib.jar
including development/apps/BuildWidget\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/CustomLocale\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps\DevelopmentSettings\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/Development\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/Fallback\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates
/classes.jar
including development/apps/GestureBuilder\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/NinePatchLab\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/OBJViewer\Android.mk …
including development/apps/SdkSetup\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/SettingInjectorSample\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/WidgetPreview\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/launchperf\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/host\Android.mk …
including development/tools/etc1tool\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar
including development/tools/line_endings\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar
including development/tools/mkstubs\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar
including packages/apps/ContactsCommon\Android.mk …
the full java libx out/host/common/obj/JAVA_LIBRARIES/asm-4.0_intermediates/ja
valib.jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.ja
r out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib
.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/java
lib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.
jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.ja
r out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib
.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/java
lib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.
jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.ja
r out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib
.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/java
lib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.
jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/c
lasses.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.ja
r out/target/common/obj/APPS/com.android.contacts.common_intermediates/classes
.jar
including packages/apps/Contacts\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar out/target/common/obj/JAVA_LIBRARIES/com.android.contacts.common.t
est_intermediates/javalib.jar out/target/common/obj/APPS/com.android.contacts.c
ommon_intermediates/classes.jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes
.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javali
b.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar out
/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v7-cardview_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v7-palette_int
ermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_
intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_i
ntermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_inte
rmediates/javalib.jar
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/sdk_v21_i
ntermediates/classes.jar’, needed by `out/target/common/obj/APPS/Contacts_interm
ediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

#### make failed to build some targets (17 seconds) ####

bash-3.1$

The sdk_v21 is the result of:

$(LOCAL_JAVA_LIBRARIES)

Which is from D:\Projects\Lollipop\platform\build\core\java.mk:

LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)

Try copy Android.mk and CleanSpec.mk from:

To:

markerxy core-libart conscrypt okhttp core-junit bouncycastle ext

We have:

============================================
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/APPS/framework-res_inter
mediates/src/R.stamp’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/src/R.stamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (30 seconds) ####

# makefile (from `build/core/package_internal.mk’, line 303)
framework_res_package_export_deps := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

Perform some changes inside D:\Projects\Lollipop\platform\build\core\package_internal.mk:

useful command:

$(info the localsdkresy $(LOCAL_SDK_RES_VERSION))

Now we have:

including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/core-juni
t_intermediates/classes.jar’, needed by `out/target/common/obj/APPS/com.android.
contacts.common_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

out/target/common/obj/APPS/com.android.contacts.common_intermediates/classes-full-debug.jar: out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.jar out/target/common/obj/APPS/com.android.contacts.common_intermediates/src/R.stamp

Copy the required junit from platform/external/junit:

We have:

including external/junit/Android.mk …
the full java libx2 out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_inter
mediates/javalib.jar
the full java libx2 out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_inter
mediates/javalib.jar
the full java libx2 out/host/common/obj/JAVA_LIBRARIES/core-junit-hostdex_interm
ediates/javalib.jar out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_inter
mediates/javalib.jar
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** external/junit: Invalid LOCAL_SDK_VERSION ‘4’ Choices
are: current 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (7 seconds) ####

Download version of 4 of local sdk, we have:

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/core-liba
rt_intermediates/classes.jar’, needed by `out/target/common/obj/JAVA_LIBRARIES/c
ore-junit_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Copy from:

We have:

including prebuilts/sdk/Android.mk …
make: *** No rule to make target `external/stlport/libstlport.mk’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

copy from:

https://android.googlesource.com/platform/external/stlport/+/android-5.1.1_r38

We have:

target Java: core-libart (out/target/common/obj/JAVA_LIBRARIES/core-libart_inter
mediates/classes)
cygwin warning:
MS-DOS style path detected: d:/Projects/Lollipop/platform
Preferred POSIX equivalent is: /cygdrive/d/Projects/Lollipop/platform
CYGWIN environment variable option “nodosfilewarning” turns off this warning.
Consult the user’s guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
sh: /cygdrive/c/Program Files (x86)/Java/jdk1.7.0_79/bin/javac: Argument list to
o long

Checking:

# makefile (from `build/core/definitions.mk’, line 1617)
define transform-java-to-classes.jar
@echo “target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))”
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
endef

target Java: core-libart (out/target/common/obj/JAVA_LIBRARIES/core-libart_inter
mediates/classes Compile with development/host/windows/prebuilt/javawrap.exe -J-
Xmx256m -source 1.7 -target 1.7 -Xmaxerrs 9999999 and parameter -bootclasspath o
ut/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar)
cygwin warning:

From command line we have:

D:\Projects\Lollipop\platform>bash
bash-3.1$ d:/Projects/Lollipop/platform/development/host/windows/prebuilt/javaw
rap.exe -J-Xmx256m -source 1.7 -target 1.7 -Xmaxerrs 9999999 -encoding UTF-8 -g
-bootclasspath out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/
classes.jar -extdirs “””” -d out/target/common/obj/JAVA_LIBRARIES/core-libart_i
ntermediates/classes -encoding UTF-8 -Xmaxwarns 9999999 @out/target/common/obj/
JAVA_LIBRARIES/core-libart_intermediates/classes/java-source-list-uniq
cygwin warning:
MS-DOS style path detected: d:/Projects/Lollipop/platform
Preferred POSIX equivalent is: /cygdrive/d/Projects/Lollipop/platform
CYGWIN environment variable option “nodosfilewarning” turns off this warning.
Consult the user’s guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
sh: /cygdrive/c/Program Files (x86)/Java/jdk1.7.0_79/bin/javac: Argument list to
o long

Uses javac.exe:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/ext_inter
mediates/classes.jar’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/classes-full-debug.jar’. Stop.

Problem starts at:

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar: out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/emma_out/lib/classes-jarjar.jar | out/host/windows-x86/bin/acp

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/emma_out/lib/classes-jarjar.jar: out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-jarjar.jar | out/host/windows-x86/bin/acp

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-jarjar.jar: out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-full-debug.jar | out/host/windows-x86/bin/acp

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-full-debug.jar: …

is generated via:

# commands to execute (from `build/core/java.mk’, line 345):
$(transform-java-to-classes.jar)

Where the classes.jar is malformed

But eventually changes inside D:\Projects\Lollipop\platform\build\core\definitions.mk:

Makes it work !

Remove the modifications LOCAL_SDK_RES_VERSION on D:\Projects\Lollipop\platform\build\core\package_internal.mk. And compile using:

subdir_makefiles := libcore/Android.mk external/junit/Android.mk frameworks/base/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

But we have:

/bin/bash: line 0: cd: frameworks/base/../../external/libphonenumber/java/src: N
o such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:267: *** frameworks/base: Target java module does not define
any source or resource files. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Which cause by this logic in D:\Projects\Lollipop\platform\build\core\java.mk:

Causes by blank in:

need_compile_java := $(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))

all_java_sources := $(subst ,, )

But let’s see if we try to resolve the find errors as in:

find: phone/java: No such file or directory
find: ../../external/apache-http/src/org/apache/http: No such file or directory
find: ../opt/telephony/src/java/android/provider: No such file or directory
find: ../opt/telephony/src/java/android/telephony: No such file or directory
find: ../opt/telephony/src/java/android/telephony/gsm: No such file or directory

find: ../opt/net/voip/src/java/android/net/rtp: No such file or directory
find: ../opt/net/voip/src/java/android/net/sip: No such file or directory
find: ../../external/apache-http/src/org/apache/http: No such file or directory
find: ../opt/telephony/src/java/android/provider: No such file or directory
find: ../opt/telephony/src/java/android/telephony: No such file or directory
find: ../opt/telephony/src/java/android/telephony/gsm: No such file or directory

find: ../opt/net/voip/src/java/android/net/rtp: No such file or directory
find: ../opt/net/voip/src/java/android/net/sip: No such file or directory
find: ../../frameworks/multidex/library/src: No such file or directory
find: ../../frameworks/multidex/instrumentation/src: No such file or directory
find: ../../external/apache-http/src/org/apache/http: No such file or directory
find: ../opt/telephony/src/java/android/provider: No such file or directory
find: ../opt/telephony/src/java/android/telephony: No such file or directory
find: ../opt/telephony/src/java/android/telephony/gsm: No such file or directory

find: ../opt/net/voip/src/java/android/net/rtp: No such file or directory
find: ../opt/net/voip/src/java/android/net/sip: No such file or directory
find: ../../external/nist-sip/java: No such file or directory
find: ../../external/apache-http/src: No such file or directory
find: ../../external/tagsoup/src: No such file or directory
find: ../../external/libphonenumber/java/src: No such file or directory
/bin/bash: line 0: cd: frameworks/base/../../external/libphonenumber/java/src: N
o such file or directory
the allx
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:267: *** frameworks/base: Target java module does not define
any source or resource files. Stop.

framework_docs_LOCAL_DROIDDOC_SOURCE_PATH := frameworks/base/core/java frameworks/base/graphics/java frameworks/base/location/java frameworks/base/media/java frameworks/base/media/mca/effect/java frameworks/base/media/mca/filterfw/java frameworks/base/media/mca/filterpacks/java frameworks/base/drm/java frameworks/base/opengl/java frameworks/base/sax/java frameworks/base/telecomm/java frameworks/base/telephony/java frameworks/base/phone/java frameworks/base/wifi/java frameworks/base/keystore/java frameworks/base/rs/java

FRAMEWORKS_BASE_SUBDIRS := core/java graphics/java location/java media/java media/mca/effect/java media/mca/filterfw/java media/mca/filterpacks/java drm/java opengl/java sax/java telecomm/java telephony/java phone/java wifi/java keystore/java rs/java

FRAMEWORKS_BASE_JAVA_SRC_DIRS := frameworks/base/core/java frameworks/base/graphics/java frameworks/base/location/java frameworks/base/media/java frameworks/base/media/mca/effect/java frameworks/base/media/mca/filterfw/java frameworks/base/media/mca/filterpacks/java frameworks/base/drm/java frameworks/base/opengl/java frameworks/base/sax/java frameworks/base/telecomm/java frameworks/base/telephony/java frameworks/base/phone/java frameworks/base/wifi/java frameworks/base/keystore/java frameworks/base/rs/java

Download from:

https://android.googlesource.com/platform/external/apache-http/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/opt/telephony/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/opt/net/voip/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/multidex/+/android-5.1.1_r38

https://android.googlesource.com/platform/external/nist-sip/+/android-5.1.1_r38

Now we have:

Clean step: rm -rf out/target/common/obj/JAVA_LIBRARIES/telephony-common_interme
diates
Clean step: rm -rf out/target/common/obj/JAVA_LIBRARIES/telephony-common_interme
diates
Clean step: rm -rf out/target/common/obj/JAVA_LIBRARIES/telephony-common_interme
diates
including frameworks/base/Android.mk …
find: ../../external/tagsoup/src: No such file or directory
find: ../../external/libphonenumber/java/src: No such file or directory
/bin/bash: line 0: cd: frameworks/base/../../external/libphonenumber/java/src: N
o such file or directory
including libcore/Android.mk …
including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/APPS/framework-res_inter
mediates/src/R.stamp’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/src/R.stamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/tagsoup/+/android-5.1.1_r38

https://android.googlesource.com/platform/external/libphonenumber/+/android-5.1.1_r38

But this time we still have:

including frameworks/base/Android.mk …
including libcore/Android.mk …
including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/APPS/framework-res_inter
mediates/src/R.stamp’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/src/R.stamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Checking:

out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# Not a target:
out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp:

# makefile (from `build/core/package_internal.mk’, line 305)
framework_res_package_export_deps := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# makefile (from `frameworks/base/Android.mk’, line 415)
framework_res_R_stamp := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# makefile (from `build/core/package_internal.mk’, line 313)
all_library_res_package_export_deps := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# makefile (from `frameworks/base/Android.mk’, line 27)
framework_res_source_path := APPS/framework-res_intermediates/src

curious one:
let’s check whether it is executed.

D:\Projects\Lollipop\platform\frameworks\base\core\res\Android.mk(20):LOCAL_PACKAGE_NAME := framework-res

Let’s dump again the subdirs this time:

the subdirsx build/libs/host\Android.mk build/tools/acp\Android.mk build/tools/s
ignapk\Android.mk build/tools/zipalign\Android.mk development/apps\BluetoothDebu
g\Android.mk development/apps\BuildWidget\Android.mk development/apps\CustomLoca
le\Android.mk development/apps\DevelopmentSettings\Android.mk development/apps\D
evelopment\Android.mk development/apps\Fallback\Android.mk development/apps\Gest
ureBuilder\Android.mk development/apps\NinePatchLab\Android.mk development/apps\
OBJViewer\Android.mk development/apps\SdkSetup\Android.mk development/apps\Setti
ngInjectorSample\Android.mk development/apps\WidgetPreview\Android.mk developmen
t/apps\launchperf\Android.mk development/host\Android.mk development/tools/etc1t
ool\Android.mk development/tools/line_endings\Android.mk development/tools/mkstu
bs\Android.mk frameworks/base\Android.mk libcore\Android.mk packages\apps\Contac
tsCommon\Android.mk packages\apps\Contacts\Android.mk packages\apps\PhoneCommon\
Android.mk prebuilts\sdk\Android.mk

Modify:

subdir_makefiles := frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Now we have:

including frameworks/base/core/res/Android.mk …
including frameworks/base/Android.mk …
including libcore/Android.mk …
including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
target Export Resources: framework-res (out/target/common/obj/APPS/framework-res
_intermediates/package-export.apk)
/bin/bash: zip: command not found
make: *** [out/target/common/obj/APPS/framework-res_intermediates/package-export
.apk] Error 127
make: *** Deleting file `out/target/common/obj/APPS/framework-res_intermediates/
package-export.apk’
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (39 seconds) ####

Checking:

# commands to execute (from `build/core/package_internal.mk’, line 265):
@echo “target Export Resources: $(PRIVATE_MODULE) ($@)”
$(create-empty-package)
$(add-assets-to-package)

Download zip.exe from gnuwin32.

There’s some long process of java compilation, and then we arrive at:

target Java: ext (out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes
Compile with development/host/windows/prebuilt/javawrap.exe -J-Xmx256m -source
1.7 -target 1.7 -Xmaxerrs 9999999 and parameter -bootclasspath out/target/common
/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar on out/target/common/o
bj/APPS/ContactsTests_intermediates/classes-full-debug.jar )
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Copying: out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes-jarjar.j
ar
Copying: out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/emma_out/lib/cla
sses-jarjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar
make: *** No rule to make target `out/host/windows-x86/bin/aidl.exe’, needed by
`out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/andr
oid/accessibilityservice/IAccessibilityServiceConnection.java’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

It’s easy, just copy the aidl.exe and it’s corresponding dlls from latest Android SDK’s build-tools to D:\Projects\Lollipop\platform\out\host\windows-x86\bin

Now we have:

logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/j
ava/android/content/EventLogTags.java <= frameworks/base/core/java/android/conte
nt/EventLogTags.logtags
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/j
ava/android/speech/tts/EventLogTags.java <= frameworks/base/core/java/android/sp
eech/tts/EventLogTags.logtags
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/j
ava/android/webkit/EventLogTags.java <= frameworks/base/core/java/android/webkit
/EventLogTags.logtags
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/bouncycas
tle_intermediates/classes.jar', needed by `out/target/common/obj/JAVA_LIBRARIES/
framework_intermediates/classes-full-debug.jar'. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

#### make failed to build some targets (1.:17. (mm:ss)) ####

Download from:

https://android.googlesource.com/platform/external/bouncycastle/+/android-5.1.1_r38

Revise:

subdir_makefiles := external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Now we have:

============================================
including external/bouncycastle/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform'
build/core/java.mk:23: *** external/bouncycastle: Invalid LOCAL_SDK_VERSION '9'
Choices are: current 4 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

#### make failed to build some targets (8 seconds) ####

Just give it what it wants:

Download from:

https://android.googlesource.com/platform/prebuilts/sdk/+/android-5.1.1_r38/9/

We have:

make: Entering directory `/d/Projects/Lollipop/platform'
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/conscrypt
_intermediates/classes.jar', needed by `out/target/common/obj/JAVA_LIBRARIES/bou
ncycastle_intermediates/classes-full-debug.jar'. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

Download from:

https://android.googlesource.com/platform/external/conscrypt/+/android-5.1.1_r38

we have:

make: *** No rule to make target `out/host/windows-x86/framework/jarjar.jar', ne
eded by `out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes-ja
rjar.jar'. Stop.

Checking:

out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes-jarjar.jar: out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes-full-debug.jar external/conscrypt/jarjar-rules.txt | out/host/windows-x86/framework/jarjar.jar

# makefile (from `build/core/config.mk', line 406)
JARJAR := out/host/windows-x86/framework/jarjar.jar

Curious file in:

D:\Projects\Lollipop\platform\build\core\host_dalvik_java_library.mk(34):full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar

Modify subdir:

subdir_makefiles := build/core/host_dalvik_java_library.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

But we have:

including build/core/host_dalvik_java_library.mk …
make: Entering directory `/d/Projects/Lollipop/platform'
build/core/host_java_library_common.mk:42: *** : LOCAL_MODULE not defined before
call to local-intermediates-dir. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

revert subdir:

subdir_makefiles := build/core/host_dalvik_java_library.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Modify subdir:

subdir_makefiles := libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Download from:

https://android.googlesource.com/platform/external/jarjar/+/android-5.1.1_r38

Modify subdir:

subdir_makefiles := external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

But we have compile errors:

^
symbol: variable super
location: class KeepProcessor
100 errors
make: *** [out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/javalib.jar]
Error 41

Checking:

# commands to execute (from `build/core/host_java_library.mk', line 84):
$(transform-host-java-to-package)

define transform-host-java-to-package
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
$(if $(PRIVATE_EXTRA_JAR_ARGS), $(call add-java-resources-to-package))
endef

out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/javalib.jar: external/jarjar/src/main/com/tonicsystems/jarjar/AbstractDepHandler.java

This is caused by unzip not found. But still we have the error.

Extracting the javac command line using procmon.exe we have:

javac.exe -encoding UTF-8 -g -classpath out/host/windows-x86/framework/jarjar-apache-ant.jar:out/host/windows-x86/framework/jarjar-maven-plugin-api.jar:out/host/common/obj/JAVA_LIBRARIES/jarjar-asm_intermediates/javalib.jar:out/host/common/obj/JAVA_LIBRARIES/jarjar-asm-commons_intermediates/javalib.jar -extdirs """" -d out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes @out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes/java-source-list-uniq

After detail checking, it is caused by invalid separator for -classpath in windows environment that should use:

javac.exe -encoding UTF-8 -g -classpath out/host/windows-x86/framework/jarjar-apache-ant.jar;out/host/windows-x86/framework/jarjar-maven-plugin-api.jar;out/host/common/obj/JAVA_LIBRARIES/jarjar-asm_intermediates/javalib.jar;out/host/common/obj/JAVA_LIBRARIES/jarjar-asm-commons_intermediates/javalib.jar -extdirs "" -d out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes @out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes/java-source-list-uniq

Now we have:

host Java: jarjar (out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/class
es)
/bin/bash: -c: line 1: syntax error: unexpected end of file
make: *** [out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/javalib.jar]
Error 2
make: Leaving directory `/d/Projects/Lollipop/platform'

Sample make command for testing:

define transform-host-java-to-packagex
$(hide) if [ -s myTest1.txt ] ; then \
javac -classpath out\a;out\b \
fi
endef

For semi colon problem:

define transform-host-java-to-packagex
$(hide) if [ -s myTest1.txt ] ; then \
javac -classpath out\a\;out\b; \
fi
endef

Original normalize-path:

###########################################################
## Convert "a b c" into "a:b:c"
###########################################################
define normalize-path-list
$(subst $(space),:,$(strip $(1)))
endef

This is caused by use of semi colon without escape character. The routine normalize-path-list should be:

###########################################################
## Convert "a b c" into "a:b:c"
#$(subst $(space),:,$(strip $(1)))
###########################################################
define normalize-path-list
$(subst $(space),\;,$(strip $(1)))
endef

But caution, because it will break in Linux environment.

Now. let's go !

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 errors
make: *** [out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/class
es-full-debug.jar] Error 41
make: Leaving directory `/d/Projects/Lollipop/platform'

After performing some checking, it is found that the tgz file unzip using 7-zip is causing the truncated file names:

Using the tar command will alleviate the problem:

Report bugs to .

D:\temp>tar -xf test.tar

Now we have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/okhttp_in
termediates/classes.jar’, needed by `out/target/common/obj/JAVA_LIBRARIES/framew
ork_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/okhttp/+/android-5.1.1_r38

Now we have:

Copying: out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/emma_out/lib/
classes-jarjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/classes.jar
make: *** No rule to make target `out/host/windows-x86/bin/rmtypedefs’, needed b
y `out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-deb
ug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Change the subdirs, now we have:

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/host/common/obj/JAVA_LIBRARIES/asm-tools_i
ntermediates/javalib.jar’, needed by `out/host/common/obj/JAVA_LIBRARIES/rmtyped
efs_intermediates/javalib.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/prebuilts/tools/+/android-5.1.1_r38/common/

Then modify:

subdir_makefiles := prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

After a rather long compilation process, we have:

Deleting out\target\common\obj\JAVA_LIBRARIES\framework_intermediates\classes\an
droid\widget\NumberPicker$OnScrollListener$ScrollState.class
Deleting out\target\common\obj\JAVA_LIBRARIES\framework_intermediates\classes\an
droid\widget\Toast$Duration.class
Copying: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-ja
rjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/emma_out/l
ib/classes-jarjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.ja
r
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/telephony
-common_intermediates/classes.jar’, needed by `out/target/common/obj/APPS/Contac
ts_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Compiled java program to be provided:

out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar
out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes.jar
out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v7-cardview_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v7-palette_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.jar

Revise subdir:

subdir_makefiles := frameworks/opt/telephony/Android.mk prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Download from:

https://android.googlesource.com/platform/frameworks/ex/+/android-5.1.1_r38

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
Aidl: telephony-common <= frameworks/opt/telephony/src/java/com/android/internal
/telephony/IIccPhoneBook.aidl
logtags: out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src
/src/java/com/android/internal/telephony/EventLogTags.java gzip -d test.tar.gz

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android-c
ommon_intermediates/javalib.jar’, needed by `out/target/common/obj/APPS/Contacts
_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/frameworks/ex/+/android-5.1.1_r38

We have:

including frameworks/ex/common/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** frameworks/ex/common: Invalid LOCAL_SDK_VERSION ‘8’ C
hoices are: current 4 9 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/prebuilts/sdk/+/android-5.1.1_r38/8/

D:\Projects\Lollipop\platform\prebuilts\sdk\8>gzip -d test.tar.gz

D:\Projects\Lollipop\platform\prebuilts\sdk\8>tar -xf test.tar

After a long compilation process we have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/guava_int
ermediates/javalib.jar’, needed by `out/target/common/obj/APPS/Contacts_intermed
iates/classes-full-debug.jar’. Stop.

Download from:

https://android.googlesource.com/platform/external/guava/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/support/+/android-5.1.1_r38/v13

https://android.googlesource.com/platform/frameworks/support/+/android-5.1.1_r38/v7/

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/jsr305_in
termediates/javalib.jar’, needed by `out/target/common/obj/JAVA_LIBRARIES/guava_
intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/jsr305/+/android-5.1.1_r38

We have:

============================================
including frameworks/support/v13/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** frameworks/support/v13: Invalid LOCAL_SDK_VERSION ’14
‘ Choices are: current 4 8 9 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download:

https://android.googlesource.com/platform/prebuilts/sdk/+/android-5.1.1_r38/14/

Download all of those sdk number.

We have now:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android_s
tubs_current_intermediates/classes.jar’, needed by `out/target/common/obj/JAVA_L
IBRARIES/android-support-v4-api22_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download:

https://android.googlesource.com/platform/external/doclava/+/android-5.1.1_r38

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/host/windows-x86/framework/antlr-runtime.j
ar’, needed by `out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/javalib
.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download:

https://android.googlesource.com/platform/external/antlr/+/android-5.1.1_r38

https://android.googlesource.com/platform/external/jsilver/+/android-5.1.1_r38

make: *** No rule to make target `out/host/common/obj/JAVA_LIBRARIES/tagsouplib_
intermediates/javalib.jar’, needed by `out/host/common/obj/JAVA_LIBRARIES/doclav
a_intermediates/javalib.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

external\doclava\src\com\google\doclava\ClassInfo.java:20: error: package com.sun.javadoc does not exist
import com.sun.javadoc.ClassDoc;

This is caused by malformed path to the tools.jar in java path. The command line should be like this:

javac.exe -encoding UTF-8 -g -classpath out/host/windows-x86/framework/antlr-runtime.jar;out/host/windows-x86/framework/guavalib.jar;out/host/windows-x86/framework/jsilver.jar;out/host/common/obj/JAVA_LIBRARIES/tagsouplib_intermediates/javalib.jar;c:\Progra~2\Java\jdk1.7.0_80\lib\tools.jar -extdirs “” -d out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/classes @out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/classes/java-source-list-uniq

Perform revision in:

D:\Projects\Lollipop\platform\build\core\config.mk

HOST_JDK_TOOLS_JAR:= c:/Progra~2/Java/jdk1.7.0_80/lib/tools.jar

We have:

Install: out/host/windows-x86/framework/doclava.jar
Aidl Preprocess: out/target/common/obj/framework.aidl
Docs droiddoc: out/target/common/docs/api-stubs

After some long compilation process, we have:

Install: out/host/windows-x86/framework/doclava.jar
Aidl Preprocess: out/target/common/obj/framework.aidl
Docs droiddoc: out/target/common/docs/api-stubs
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: Leaving directory `/d/Projects/Lollipop/platform’

Change inD:\Projects\Lollipop\platform\build\core\droiddoc.mk:

-J-Xmx512m

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
Docs droiddoc: out/target/common/docs/api-stubs
javadoc: error – Cannot find doclet class com.google.doclava.Doclava
1 error
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: Leaving directory `/d/Projects/Lollipop/platform’

This again, is caused by invalid separator as in:

javadoc.exe -encoding UTF-8 @out/target/common/obj/JAVA_LIBRARIES/api-stubs_intermediates/droiddoc-src-list -J-Xmx512m -XDignore.symbol.file -quiet -doclet com.google.doclava.Doclava -docletpath out/host/windows-x86/framework/jsilver.jar:out/host/windows-x86/framework/doclava.jar -templatedir build/tools/droiddoc/templates-sdk -htmldir frameworks/base/docs/html -bootclasspath out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar -classpath out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes.jar: -sourcepath frameworks/base/core/java;frameworks/base/graphics/java;frameworks/base/location/java;frameworks/base/media/java;frameworks/base/media/mca/effect/java;frameworks/base/media/mca/filterfw/java;frameworks/base/media/mca/filterpacks/java;frameworks/base/drm/java;frameworks/base/opengl/java;frameworks/base/sax/java;frameworks/base/telecomm/java;frameworks/base/telephony/java;frameworks/base/phone/java;frameworks/base/wifi/java;frameworks/base/keystore/java;frameworks/base/rs/java:out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes.jar: -d out/target/common/docs/api-stubs -hdf page.build LMY49M-eng..20170619.162734 -hdf page.now “”19 Jun 2017 16:29″” -knowntags ./frameworks/base/docs/knowntags.txt -hidePackage com.android.org.conscrypt -since prebuilts/sdk/api/1.xml 1 -since prebuilts/sdk/api/2.xml 2 -since prebuilts/sdk/api/3.xml 3 -since prebuilts/sdk/api/4.xml 4 -since prebuilts/sdk/api/5.xml 5 -since prebuilts/sdk/api/6.xml 6 -since prebuilts/sdk/api/7.xml 7 -since prebuilts/sdk/api/8.xml 8 -since prebuilts/sdk/api/9.xml 9 -since prebuilts/sdk/api/10.xml 10 -since prebuilts/sdk/api/11.xml 11 -since prebuilts/sdk/api/12.xml 12 -since prebuilts/sdk/api/13.xml 13 -since prebuilts/sdk/api/14.txt 14 -since prebuilts/sdk/api/15.txt 15 -since prebuilts/sdk/api/16.txt 16 -since prebuilts/sdk/api/17.txt 17 -since prebuilts/sdk/api/18.txt 18 -since prebuilts/sdk/api/19.txt 19 -since prebuilts/sdk/api/20.txt 20 -since prebuilts/sdk/api/21.txt 21 -werror -hide 111 -hide 113 -overview frameworks/base/core/java/overview.html -hdf sdk.version 4.4 -hdf sdk.rel.id 1 -hdf sdk.preview 0 -stubs out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src -api out/target/common/obj/PACKAGING/public_api.txt -removedApi out/target/common/obj/PACKAGING/removed.txt -nodocs

c:\Progra~2\Java\jdk1.7.0_80\bin\javadoc.exe -encoding UTF-8 @out/target/common/obj/JAVA_LIBRARIES/api-stubs_intermediates/droiddoc-src-list -J-Xmx512m -XDignore.symbol.file -quiet -doclet com.google.doclava.Doclava -docletpath out/host/windows-x86/framework/jsilver.jar

Perform necessary modifications in D:\Projects\Lollipop\platform\build\core\droiddoc.mk:

$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)\;$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_CLASSPATH := $(subst $(space),\;,$(full_java_libs))

But still we have:

Docs droiddoc: out/target/common/docs/api-stubs
javadoc: error – Cannot find doclet class com.google.doclava.Doclava
1 error
out/host/windows-x86/framework/doclava.jar: out/host/windows-x86/framework/docla
va.jar: cannot execute binary file
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (3.:57. (mm:ss)) ####

Perform some modifications to D:\Projects\Lollipop\platform\build\core\droiddoc.mk.

Now we have:

including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
Docs droiddoc: out/target/common/docs/api-stubs
DroidDoc took 17 sec. to write docs to out/target/common/docs/api-stubs
make: Leaving directory `/d/Projects/Lollipop/platform’

still we have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android_s
tubs_current_intermediates/classes.jar’, needed by `out/target/common/obj/JAVA_L
IBRARIES/android-support-v4-api22_intermediates/classes-full-debug.jar’. Stop.

android_stubs_current_intermediates

Revise subdir:

subdir_makefiles := development/build/Android.mk external/tagsoup/Android.mk external/antlr/Android.mk external/jsilver/Android.mk external/doclava/Android.mk frameworks/support/v13/Android.mk frameworks/support/v4/Android.mk frameworks/support/v7/cardview/Android.mk external/jsr305/Android.mk external/guava/Android.mk frameworks/ex/common/Android.mk frameworks/opt/vcard/Android.mk frameworks/opt/net/voip/Android.mk frameworks/opt/net/ims/Android.mk frameworks/opt/telephony/Android.mk prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Now we have:

make: Entering directory `/d/Projects/Lollipop/platform’
Compiling SDK Stubs: out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_
intermediates/classes.jar
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android-s
upport-annotations_intermediates/javalib.jar’, needed by `out/target/common/obj/
JAVA_LIBRARIES/android-support-v4-donut_intermediates/classes-full-debug.jar’.
Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

android-support-annotations

Modify subdir.

Now we have:

target Java: android-support-v4 (out/target/common/obj/JAVA_LIBRARIES/android-su
pport-v4_intermediates/classes Compile with javac -J-Xmx256m -source 1.7 -target
1.7 -Xmaxerrs 9999999 and parameter -bootclasspath out/target/common/obj/JAVA_L
IBRARIES/sdk_v4_intermediates/classes.jar on out/target/common/obj/APPS/Contacts
Tests_intermediates/classes-full-debug.jar )
frameworks\support\v4\java\android\support\v4\accessibilityservice\Accessibility
ServiceInfoCompat.java:106: error: cannot find symbol
return AccessibilityServiceInfoCompatJellyBeanMr2.getCapabilities(in
fo);
^
symbol: variable AccessibilityServiceInfoCompatJellyBeanMr2
location: class AccessibilityServiceInfoJellyBeanMr2
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
make: *** [out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates
/classes-full-debug.jar] Error 41
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (1.:26. (mm:ss)) ####

bash-3.1$

out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/classes-full-debug.jar

This is caused by malformed file name again:

redownload and extract with gzip and tar command line, we have:

target Static Jar: android-support-v7-cardview (out/target/common/obj/JAVA_LIBRA
RIES/android-support-v7-cardview_intermediates/javalib.jar)
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android-s
upport-v7-palette_intermediates/javalib.jar’, needed by `out/target/common/obj/A
PPS/Contacts_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

out/target/common/obj/JAVA_LIBRARIES/android-support-v7-palette_intermediates/javalib.jar

Revise subdir:

subdir_makefiles := frameworks/support/v7/palette/Android.mk frameworks/support/annotations/Android.mk development/build/Android.mk external/tagsoup/Android.mk external/antlr/Android.mk external/jsilver/Android.mk external/doclava/Android.mk frameworks/support/v13/Android.mk frameworks/support/v4/Android.mk frameworks/support/v7/cardview/Android.mk external/jsr305/Android.mk external/guava/Android.mk frameworks/ex/common/Android.mk frameworks/opt/vcard/Android.mk frameworks/opt/net/voip/Android.mk frameworks/opt/net/ims/Android.mk frameworks/opt/telephony/Android.mk prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

We have:

Copying: out/target/common/obj/APPS/Contacts_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Contacts_intermediates/emma_out/lib/classes-
jarjar.jar
Copying: out/target/common/obj/APPS/Contacts_intermediates/classes.jar
make: *** No rule to make target `external/proguard/bin/proguard.sh’, needed by
`out/target/common/obj/APPS/Contacts_intermediates/proguard.classes.jar’. Stop.

make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/proguard/+/android-5.1.1_r38

We have:

Proguard: out/target/common/obj/APPS/Contacts_intermediates/proguard.classes.jar

ProGuard, version 4.10
Reading input…
Reading program jar [D:\Projects\Lollipop\platform\out\target\common\obj\APPS\Co
ntacts_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\core-junit_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\core-libart_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\ext_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\framework_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\telephony-common_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\voip-common_intermediates\classes.jar]
Initializing…
Ignoring unused library classes…
Original number of library classes: 11333
Final number of library classes: 11333
Shrinking…
Removing unused program classes and class elements…
Original number of program classes: 3195
Final number of program classes: 1222
Writing output…
Preparing output jar [D:\Projects\Lollipop\platform\out\target\common\obj\APPS\C
ontacts_intermediates\proguard.classes.jar]
Copying resources from program jar [D:\Projects\Lollipop\platform\out\target\c
ommon\obj\APPS\Contacts_intermediates\classes.jar]
make: *** No rule to make target `out/host/windows-x86/bin/dx’, needed by `out/t
arget/common/obj/APPS/Contacts_intermediates/with-local/classes.dex’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (56 seconds) ####

bash-3.1$

Download from:

https://android.googlesource.com/platform/dalvik/+/android-5.1.1_r38

make: Entering directory `/d/Projects/Lollipop/platform’
host Java: dx (out/host/common/obj/JAVA_LIBRARIES/dx_intermediates/classes)
warning: [options] bootstrap class path not set in conjunction with -source 1.6
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
Install: out/host/windows-x86/framework/dx.jar
Copy: dx (out/host/windows-x86/obj/EXECUTABLES/dx_intermediates/dx)
Notice file: dalvik/dx/NOTICE — out/host/windows-x86/obj/NOTICE_FILES/src//bin/
dx.txt
Install: out/host/windows-x86/bin/dx
target Dex: Contacts
Copying: out/target/common/obj/APPS/Contacts_intermediates/classes.dex
make: *** No rule to make target `out/host/windows-x86/framework/signapk.jar’, n
eeded by `out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk
‘. Stop.

We have:

target Package: Contacts (out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk)
warning: string ‘add_field’ has no default translation.
warning: string ‘add_field’ is missing 87 required localizations: af_ZA am_ET ar
_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_AU en_C
A en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI fr_BE
fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT iw_IL ja
_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_MN mr_I
N ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU si_LK
sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ vi
_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘contact_detail_picture_description’ has no default translation.

warning: string ‘contact_detail_picture_description’ is missing 87 required loca
lizations: af_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_
DE de_LI el_GR en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE
eu_ES fa_IR fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID i
s_IS it_CH it_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_
LV mk_MK ml_IN mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT
rm_CH ro_RO ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH t
r_TR uk_UA ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘contactsAllLabel’ has no default translation.
warning: string ‘contactsAllLabel’ is missing 87 required localizations: af_ZA a
m_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_
AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI
fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT i
w_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_
MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU
si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK u
z_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘contactsGroupsLabel’ has no default translation.
warning: string ‘contactsGroupsLabel’ is missing 87 required localizations: af_Z
A am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR
en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi
_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_I
T iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN
mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru
_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_P
K uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘description_dial_phone_number’ has no default translation.
warning: string ‘description_dial_phone_number’ is missing 87 required localizat
ions: af_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de
_LI el_GR en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_E
S fa_IR fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS
it_CH it_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk
_MK ml_IN mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_C
H ro_RO ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR
uk_UA ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘description_send_message’ has no default translation.
warning: string ‘description_send_message’ is missing 87 required localizations:
af_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI e
l_GR en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_
IR fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH
it_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK m
l_IN mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_
RO ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA
ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘no_contact_details’ has no default translation.
warning: string ‘no_contact_details’ is missing 87 required localizations: af_ZA
am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR e
n_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_
FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT
iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN m
n_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_
RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK
uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘people’ has no default translation.
warning: string ‘people’ is missing 87 required localizations: af_ZA am_ET ar_EG
az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_AU en_CA e
n_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI fr_BE fr_
CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT iw_IL ja_JP
ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_MN mr_IN m
s_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU si_LK sk_
SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ vi_VN
zh_CN zh_HK zh_TW zu_ZA
warning: string ‘percentage’ has no default translation.
warning: string ‘percentage’ is missing 87 required localizations: af_ZA am_ET a
r_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_AU en_
CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI fr_BE
fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT iw_IL j
a_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_MN mr_
IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU si_LK
sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ v
i_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘use_photo_as_primary’ has no default translation.
warning: string ‘use_photo_as_primary’ is missing 87 required localizations: af_
ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR
en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR f
i_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_
IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN
mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO r
u_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_
PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘viewContactDesription’ has no default translation.
warning: string ‘viewContactDesription’ is missing 87 required localizations: af
_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_G
R en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR
fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it
_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_I
N mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO
ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur
_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
/bin/bash: /c/Progra~2/Java/jdk1.7.0_80/bin/jar: Bad file number
make: *** [out/target/product/generic/obj/APPS/Contacts_intermediates/package.ap
k] Error 126
make: *** Deleting file `out/target/product/generic/obj/APPS/Contacts_intermedia
tes/package.apk’
make: Leaving directory `/d/Projects/Lollipop/platform’

out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk:

Error is located at:

$(add-carried-java-resources)

The proper command is:

D:\Projects\Lollipop\platform>jar uf out/target/product/generic/obj/APPS/Contact
s_intermediates/package.apk out/target/product/generic/obj/APPS/Contacts_interme
diates/java_res_jar_flags

Modify D:\Projects\Lollipop\platform\build\core\definitions.mk

At last we have:

warning: string ‘viewContactDesription’ has no default translation.
warning: string ‘viewContactDesription’ is missing 87 required localizations: af
_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_G
R en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR
fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it
_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_I
N mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO
ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur
_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make completed successfully (59 seconds) ####

Bootstrap Dialog Table Look Up Example

May 10, 2017

Here is the table look up example in action. When the page is properly setup it will show one button as follows:

When the button is clicked it will show the look up dialog box:

The data is retrieved from the server using AJAX based on user action, such as a click on table header, etc. The table is actually the extension of the original jQuery.DataTable.js open source program.

The table can be dynamically built using SELECTOR keyword:

The programmer only responsible for performing the codes inside the server side ASPX handler for given selector keyword, such as table header definition, paging request and display data. This is included in the sample NewInquiry.aspx page.

User can hover to the table and perform selection by clicking on to the table, and it will show the alert box:

This sample program is created using ASP.NET, so if you are interested to see how this page in action, there are several pre-requisite as follows:

1. The data source is using SQL Server 2005
2. Windows Server 2003 or higher with Framework 4

Sample data is included in the “data” folder on the source package.

Source files and supporting executable as follows:

https://github.com/surya-rakanta/BootstrapLookUp.git

How to Decompile MultiCharts SEF File

March 21, 2017

This article will explore whether it is possible to perform decompilation of MultiCharts’ *.SEF file back to its original Power Language Script, a variant of Easy Language Script. This is one of trading applications just like TradeStation.

The *.SEF file is created by using the “Export Read Only” menu in MultiCharts Power Language Editor (PLEdit.exe). At first glance, the content of generated file consist some header information and the actual executable file.

Let’s find whether the editor is keeping the Intermediate code, or hopefully an encrypted source code just like TradeStation’s *.ELD file.

This is done by creating an increasing more complex script and see the changes inside the *.SEF file. So, after several steps of creating, compiling and examining the file content, I realized that the PLEdit program is in fact, do not try to preserve the intermediate code, let alone the encrypted source code.

The only information is the actual executable file that is located just after the header portion of the file which typically like this:

There’s a MZ signature that denotes that portion of the block to the end of *.SEF file is actually the executable file. Using the Hex Editor I can move out the block into separate file and try to dissasemble it:

This executable file is actually a form of a DLL file because it has some exported functions, one of which is called “Create”. When I try to execute the compiled script in MultiCharts program by using the “Insert Study …” menu, it will try to load the generated i_myTesting.dll.

The myTesting is the is the name that I declared when creating the script of type Indicator (hence the i_ prefix). This is evident by viewing the Load DLL output from WinDBG program:

When “Insert Study…” is executed for myTesting script, the program will call the DLL’s Create exported function.

So, I landed on a rather hopeless case of machine code that only the computer’s CPU and MultiCharts program can execute faithfully. At this point, I try to googling out for this issue. I found that certain website does actually stated that they can decompile manually from the machine code to the script source code.

I try to communicate with one of the support of this service, and get a positive response, that indeed, yes, they can decompile and it require about 3 or 4 weeks and some compensation.

How can they do that ? This let me pause and think, maybe I do not perform a more in depth analysis. Then I have another activities to perform, but the question remains in my head. It’s like they can provide something from nothing.

So, I decided to take a more close look, by try to identify how the PLEditor generate it’s DLL file from the script. I created the most simple Indicator script called myTesting and it’s content as follows:

Then I realized that the PLEditor.exe, actually compile it’s file by using the process called StudyServer.exe.

By examining the modules loaded by StudyServer.exe, I’ve found the curious file called GccWrapServer.dll. By examining more closely, it is revealed that it is actually a COM object and it has a methods called Compile and SetCompilerSettings method. This is evident by viewing its type library using OLE View program:

From the above picture, I can see that the Compile method accepts the CPP file name and generated DLL file name. By setting the breakpoint into the Compile method, what I get from these two parameter as follows:

From the above execution code, I can see that the ecx register contains the CPP file name:

Folder content as follows:

After the Compile finishes, the *.cpp file is removed, so I try to obtained it while the program is suspended by the debugger and the content of CPP file as follows:

There are many information revealed by this generated CPP and its corresponding *.o file, one is the parameter information. So the above Create export function calls can be identified as follows:

The above rather hopeless code starts to have some meaning, while it is just a start, then the decompilation of MultiChart’s *.SEF file suddenly become possible. Much works still to be done, it’s hard, but it is indeed possible 🙂

Open Office’s Open XML SDK Saving Issue

September 9, 2016

In one of the projects that involved using the Open XML SDK for manipulating the spreadsheet files, I stumbles across some strange issue, i.e. some of the modified worksheet cell items is not get saved into the document.

I’ve spend considerable amount time to investigate this, which involved obtaining the existing source of SDK, resolves compilation issue and examine the save routine.

By examining the workings of save method inside the SDK, I figured out, that although I’ve called PutXDocument and examine the XML result inside the sheets*.xml the data is already saved, but actually there’s another layer inside the Worksheet object that still contains old worksheet data.

So, when the Close method of SpreadsheetDocument is called, it is the layer of original worksheet data that get saved into the OpenXmlPart stream, not the stream that I already modified.

Try to call Worksheet.Save method proves to be useless, because the Close method is actually use the same method when try to save all Open Xml Parts.

So, how to trigger the data flow from the modified Xml data layer back to Worksheet object ? You can use Worksheet.Reload method. This call will cause your modified Xml part flows back into the Worksheet object.

So, at this time, when you try to call the Close method of the SpreadsheetDocument, your XML layer already get saved into the Worksheet object and your modified data inside the Worksheet object will take effect.

Resolving XAOS Post Compilation Issues

September 9, 2016

When I try to load the *.xpf file containing the user formula, my compiled application refuses to process it:

zp01

Seems that the previous complaint from configuration process at the compile time should be taken seriously.

Let’s now handle the importing of the GSL library. GSL stands for GNU Science Library, and it is in the form of source code and should be compiled first to obtain the library specific to the OS of the target machine.

zp02

Examining the content of the above include files that causes a problem reveal that it is created as symbolic link statement to the actual file. There is a statement inside makefile.am file configuration inside D:\Projects\Fractal\gsl\gsl folder as follows:

zp03

In configure file:

zp04

MSYS can’t handle the symlink, so the solution is revise the above script to use cp (copy command) instead of ln -s. Make sure it does so in the config.log file:

zp05

Now GSL source will continue to compile until it stops at this stage:

zp06

This is because:

zp07

Some stage of previous compilation process is not executed due to some unknown problem, just remove *.lo and recompile inside utils folder:

zp08

Now GNU GSL Library will compile just file. Let’s move on to re-compile XAOS source:

zp09

There is a problem inside the configuration file inside the XAOS source file that causes GSL_CONFIG to be blank when the script try to check and include the GSL library, so modify to:

zp10

Depending on the location of GSL library installation. Now we have:

zp11

Copy the include file from GNU gsl folder into src\include of the XAOS source code and also the corresponding libgsl.a and libgslcblas.a to C:\mingw\lib folder.

Open XAOS program and try to load *.xpf file that has formula in it and the program crashes 🙂

Further examination reveals that I’ve used the wrong GSL library for compiling GSL with XAOS. This is verified by creating the small program and examine the data, and it turns out the result is garbage, although it compiles right.

The compiled static library libgsl.a should be taken from .libs result in the GSL directory, not from lib folder.

Re-compile XAOS after the correct library is copied.

Now, user formula runs just fine 🙂