Question about compiling from source... - EVO 4G Q&A, Help & Troubleshooting

Ok, finally got the build environment finished, got a successful 'generic' Gingerbread build done.
Now what the hell do I do with the files? I've got a ramdisk.img / system.img / userdata.img in my 'OUT' directory.
I'm figuring I just flash them to the phone and see what happens...

Doward said:
Ok, finally got the build environment finished, got a successful 'generic' Gingerbread build done.
Now what the hell do I do with the files? I've got a ramdisk.img / system.img / userdata.img in my 'OUT' directory.
I'm figuring I just flash them to the phone and see what happens...
Click to expand...
Click to collapse
after make did you try a make -j{whatever} otapackage?

Doing so now... what's this going to do? Set it up as a flashable zip file?
*EDIT*
make-3.81: *** No rule to make target `otapackage'. Stop.
Yeah, I had to recompile make 3.81 from scratch, then stuck it in my /bin as make-3.81

Anyone mind helping a fellow noob out on some steps on how to build a gingerbread rom?

digitalrurouni said:
Anyone mind helping a fellow noob out on some steps on how to build a gingerbread rom?
Click to expand...
Click to collapse
I'm trying to work out how to at least attempt to load the image in the Emulator, before testing it on my phone...

Well, copying system.img into my android 2.2 and 2.3 AVD directories yields - boots 2.3 no problem, 2.2 does not boot.
My first reaction is that the 2.2 kernel's not compatible with the 2.3 system.img, but isn't the kernel included in system.img?

Doward said:
Well, copying system.img into my android 2.2 and 2.3 AVD directories yields - boots 2.3 no problem, 2.2 does not boot.
My first reaction is that the 2.2 kernel's not compatible with the 2.3 system.img, but isn't the kernel included in system.img?
Click to expand...
Click to collapse
The kernel is packed in to the boot.img

xHausx said:
The kernel is packed in to the boot.img
Click to expand...
Click to collapse
When you compile Android from source, where is boot.img located?
Under out/target/product/generic, I have ramdisk.img, system.img, and userdata.img - no boot.img.

Doward said:
When you compile Android from source, where is boot.img located?
Under out/target/product/generic, I have ramdisk.img, system.img, and userdata.img - no boot.img.
Click to expand...
Click to collapse
The boot.img is made from the kernel and ramdisk. See below
HOWTO: Unpack, Edit and Repack Boot Images

error while loading new compiled Linux kernel image into the android emulator
I have successfully compiled Linux kernel for android:
[email protected]:~/common# ARCH=arm CROSS_COMPILE=~/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
.
.
.
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
CHK include/linux/compile.h
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 157 modules
[email protected]:~/common#
but i get the following error while loading this images in the emulator:
[email protected]:~/android-sdk-linux_x86/tools# ./emulator -avd avd1.5 -kernel ~/common/arch/arm/boot/zImage -show-kernel -verbose
emulator: found SDK root at /home/preetam/android-sdk-linux_x86
emulator: root virtual device file at /home/preetam/.android/avd/avd1.5.ini
.
.
.
yaffs_read_super: isCheckpointed 0
sh: can't access tty; job control turned off
# init: cannot find '/system/bin/playmp3', disabling 'bootsound'
init: cannot find '/system/bin/dbus-daemon', disabling 'dbus'
eth0: link up
init: untracked pid 578 exited
init: untracked pid 579 exited
warning: `rild' uses 32-bit capabilities (legacy support in use)
init: untracked pid 601 exited
init: untracked pid 592 exited
init: untracked pid 605 exited
init: untracked pid 602 exited
init: untracked pid 609 exited
init: untracked pid 606 exited
init: critical process 'servicemanager' exited 4 times in 4 minutes; rebooting into recovery mode
save exit: isCheckpointed 1
save exit: isCheckpointed 1
Restarting system with command 'recovery'.
Reboot failed -- System halted
and the emulator didn't start with the new kernel image(emulator didn't reboot). what is the problem here..?? and how can i replace my emulator's image with newly compiled Linux permanently??
please help. thank you!

Was this ever resolved because I'm having the same issue. .

Related

Latest zImage...

Hello!
Cuz Dzo doesnt update zImage after every code change I decided to help us and compile fresh zImage after every patch
Attachment including "support for nordic keyboard" and "revert port BT II drivers from 2.6.32" patches too.
Info needed
Hi,
Can any one please tell me how to create a nbh file form zImage? I would like to flash my own kernel in Kaiser. I have tried to search for this info on the net but couldnt find any thing useful.
Thanks in advance.
Instructions for building nbh's are in the sticky at the top of the forum : http://forum.xda-developers.com/showthread.php?t=621001
pentagramII said:
Hello!
Cuz Dzo doesnt update zImage after every code change I decided to help us and compile fresh zImage after every patch
Attachment including "support for nordic keyboard" and "revert port BT II drivers from 2.6.32" patches too.
Click to expand...
Click to collapse
No need to do this by hand . My server runs a kernel compliation service, you can get a fresh zImage there (updated hourly): http://84.23.71.227/kerneloftheday/
It has a few patches for nike, but it should work on kaiser/vogue/polaris too. If anyone has problems with it send me a pm (can also add a vanilla kernel).
If it wouldn't be too tough, I would certainly appreciate an auto-compiled version of the vanilla zImage.
mblaster said:
No need to do this by hand . My server runs a kernel compliation service, you can get a fresh zImage there (updated hourly): http://84.23.71.227/kerneloftheday/
It has a few patches for nike, but it should work on kaiser/vogue/polaris too. If anyone has problems with it send me a pm (can also add a vanilla kernel).
Click to expand...
Click to collapse
Is it ok for WarmDonut also?
Its working with donut too Thats the same zimage like Dzo but it has also a few another patches for nike.
Alamei said:
If it wouldn't be too tough, I would certainly appreciate an auto-compiled version of the vanilla zImage.
Click to expand...
Click to collapse
OK, I will include it later.
The kernel works with both, eclair and donut. For eclair just add hw3d.version=1 to dafault.txt.
BTW: Yes, it is DZOs kernel, so credits go to him of course
error while loading new compiled Linux kernel image into the android emulator
I have successfully compiled Linux kernel for android:
[email protected]:~/common# ARCH=arm CROSS_COMPILE=~/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
.
.
.
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
CHK include/linux/compile.h
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 157 modules
[email protected]:~/common#
but i get the following error while loading this images in the emulator:
[email protected]:~/android-sdk-linux_x86/tools# ./emulator -avd avd1.5 -kernel ~/common/arch/arm/boot/zImage -show-kernel -verbose
emulator: found SDK root at /home/preetam/android-sdk-linux_x86
emulator: root virtual device file at /home/preetam/.android/avd/avd1.5.ini
.
.
.
yaffs_read_super: isCheckpointed 0
sh: can't access tty; job control turned off
# init: cannot find '/system/bin/playmp3', disabling 'bootsound'
init: cannot find '/system/bin/dbus-daemon', disabling 'dbus'
eth0: link up
init: untracked pid 578 exited
init: untracked pid 579 exited
warning: `rild' uses 32-bit capabilities (legacy support in use)
init: untracked pid 601 exited
init: untracked pid 592 exited
init: untracked pid 605 exited
init: untracked pid 602 exited
init: untracked pid 609 exited
init: untracked pid 606 exited
init: critical process 'servicemanager' exited 4 times in 4 minutes; rebooting into recovery mode
save exit: isCheckpointed 1
save exit: isCheckpointed 1
Restarting system with command 'recovery'.
Reboot failed -- System halted
and the emulator didn't start with the new kernel image(emulator didn't reboot). what is the problem here..?? and how can i replace my emulator's image with newly compiled Linux permanently??
please help, i am stuck here from many days. thank you!
It's a bad idea release the code from git because developers up many "problematic code" and test it before release a kernel...
I release the kernel after testing on the link in my signaure and also dzo stopped working on from several weeks :-(

[Q] Compiling Kernel from Source?

Hey devs,
I'm in training of possibly becoming a future dev to xda, with the help of Magnus.
I need a guide or actually some pointers in how to compile a kernel from a source. or even building. Doesn't matter, as long as i can get a great kernel up and running, gonna try make a decent rom without just visual mods.
SO, if you have a inside-tip or maybe came across a link to a guide, i would really appreciate it. Learning to build for me evo. Maybe even help others with there current roms. Thanks XDA.
NEEDS to be for EVO though. Again thanks.
http://developer.htc.com/
http://developer.android.com/
Please post questions in relevant forums. ie, this should've probably gone to General Android Q&A, not EVO Android Development.
Thanks. I was contiplating which one it went to...but i just stuck it here. Thanks though
Sent from my PC36100 using XDA App
Moved to Q&A with redirect, as question regarding development
Here's a guide i used for the hero that worked. You can most likely skip the second step because your gonna want to download the source code yourself. Just some help.
http://forum.xda-developers.com/showpost.php?p=5447589
Here's a question for any devs out there....I have been able to compile kernels on ubuntu but anyone compiled on a mac? Any guildes out there?
I'd recommend these instructions as they are ubber detailed:
http://forum.androidcentral.com/htc...how-build-your-own-kernel-package-source.html
Alright thanks so much for the guides. will check them all out.
david279 said:
Here's a guide i used for the hero that worked. You can most likely skip the second step because your gonna want to download the source code yourself. Just some help.
http://forum.xda-developers.com/showpost.php?p=5447589
Click to expand...
Click to collapse
Thanks man great link I will try that out this weekend..
spiicytuna said:
I'd recommend these instructions as they are ubber detailed:
http://forum.androidcentral.com/htc...how-build-your-own-kernel-package-source.html
Click to expand...
Click to collapse
Thanks, two is always better than one.
spiicytuna said:
I'd recommend these instructions as they are ubber detailed:
http://forum.androidcentral.com/htc...how-build-your-own-kernel-package-source.html
Click to expand...
Click to collapse
I love this guide. Its very depictive. Gonna run the compiling process tonight. Just by reading it, i feel like i can already see it working.....hqha
error while loading new compiled Linux kernel image into the android emulator
I have successfully compiled Linux kernel for android:
[email protected]:~/common# ARCH=arm CROSS_COMPILE=~/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
.
.
.
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
CHK include/linux/compile.h
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 157 modules
[email protected]:~/common#
but i get the following error while loading this images in the emulator:
[email protected]:~/android-sdk-linux_x86/tools# ./emulator -avd avd1.5 -kernel ~/common/arch/arm/boot/zImage -show-kernel -verbose
emulator: found SDK root at /home/preetam/android-sdk-linux_x86
emulator: root virtual device file at /home/preetam/.android/avd/avd1.5.ini
.
.
.
yaffs_read_super: isCheckpointed 0
sh: can't access tty; job control turned off
# init: cannot find '/system/bin/playmp3', disabling 'bootsound'
init: cannot find '/system/bin/dbus-daemon', disabling 'dbus'
eth0: link up
init: untracked pid 578 exited
init: untracked pid 579 exited
warning: `rild' uses 32-bit capabilities (legacy support in use)
init: untracked pid 601 exited
init: untracked pid 592 exited
init: untracked pid 605 exited
init: untracked pid 602 exited
init: untracked pid 609 exited
init: untracked pid 606 exited
init: critical process 'servicemanager' exited 4 times in 4 minutes; rebooting into recovery mode
save exit: isCheckpointed 1
save exit: isCheckpointed 1
Restarting system with command 'recovery'.
Reboot failed -- System halted
and the emulator didn't start with the new kernel image(emulator didn't reboot). what is the problem here..?? and how can i replace my emulator's image with newly compiled Linux permanently??
please help. thank you!

[SOLVED] 4.0.3 AOSP build stuck at google logo. Kernel problem?

Hey guys,
i have a problem when building 4.0.3 from source. When i flash the fresh compiled
OTA package to my device, the device ends in a bootloop stuck at the google logo.
Logcat says:
Code:
I/SystemServer( 238): Power Manager
I/SystemServer( 238): Activity Manager
I/ActivityManager( 238): Memory class: 64
I/SurfaceFlinger( 251): SurfaceFlinger is starting
I/SurfaceFlinger( 251): SurfaceFlinger's main thread ready to run. Initializing graphics H/W...
E/IMGSRV ( 251): :0: PVRSRVBridgeCall: Failed to access device. Function ID:3223086860 (Bad address).
E/IMGSRV ( 251): :0: OpenServices: PVRSRVBridgeCall failed.
E/IMGSRV ( 251): :0: PVRSRVConnect: Unable to open connection.
E/IMGSRV ( 251): :0: OpenPVRServices: Failed to open services connection
E/IMGSRV ( 251): :0: hal_init: Failed to open services (err=-14)
E/IMGSRV ( 251): :0: hal_open: Graphics HAL not initialized
E/FramebufferNativeWindow( 251): couldn't open framebuffer HAL (Not a typewriter)
E/IMGSRV ( 251): :0: hal_open: Graphics HAL not initialized
E/FramebufferNativeWindow( 251): couldn't open gralloc HAL (Not a typewriter)
E/SurfaceFlinger( 251): Display subsystem failed to initialize. check logs. exiting...
I/ServiceManager( 109): service 'sensorservice' died
I/ServiceManager( 109): service 'power' died
I/ServiceManager( 109): service 'entropy' died
D/AndroidRuntime( 259):
D/AndroidRuntime( 259): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
D/AndroidRuntime( 259): CheckJNI is OFF
I don't know whats going wrong. Can it be a kernel problem? I have tried different 4.0.3 kernels from the dev section, but the result is the same.
The device is a GSM device with PRIMEKK15 unlocked bootloader and I9250XXKK6 baseband.
After pulling the latest 4.0.3 sources with repo and setting up the proprietary files i'have compiled the system without errors:
Code:
~/android/4.0.3$ . build/envsetup.sh
~/android/4.0.3$ lunch full_maguro-userdebug
~/android/4.0.3$ make -j4 otapackage
I really don't understand what i am doing wrong ...
Thanks for any suggestions or answers.
i got this problem when I updated my phone using fastboot.
for me, it was an application installed from market. after wipe everything and redo the flash procedure, everything was fine.
don't know if it is the same problem here.
Did you pull in the proprietary files needed for the build?
At least you've got to the boot animation, my ROM fails at the flashing with a status 7 error mentioning the boot.img
PaulW21781 said:
Did you pull in the proprietary files needed for the build?
Click to expand...
Click to collapse
with ./extract-files.sh .correct?
PaulW21781 said:
Did you pull in the proprietary files needed for the build?
Click to expand...
Click to collapse
Yes, the files are pulled from the device ( if you mean the extract_files.sh from the device folder), compilation finishes without errors.
No boot animation, nothing...
Sent from my Galaxy Nexus using XDA App
Now at this point too, bootloops all the time. I think the code is ****ed
Ok, dmesg gave me this:
Code:
<6>[ 5.367248] PVR: Installing MISR with cookie c0833f74
<6>[ 5.367828] PVR: Installing device LISR SGX ISR on IRQ 53 with cookie c79f5700
<6>[ 5.368255] PVR: OSUnMapPhysToLin: unmapping 65535 bytes from c8be0000
<6>[ 5.368469] PVR: SysFinalise: Version string: SGX revision = 1.2.0
<6>[ 5.369171] PVR_K: (FAIL) SGXInit: Incompatible driver DDK revision (785978)/device DDK revision (780209).
<6>[ 5.369537] PVR_K:(Error): PVRSRVFinaliseSystem: Failed PVRSRVDevInitCompatCheck call (device index: 0) [449, drivers/gpu/pvr/pvrsrv.c]
<6>[ 5.370025] PVR_K:(Error): BridgedDispatchKM: Initialisation failed. Driver unusable. [4812, drivers/gpu/pvr/bridged_pvr_bridge.c]
<6>[ 5.552337] max17040 4-0036: online = 1 vcell = 4007500 soc = 77 status = 1 health = 1 temp = 340 charger status = 0
<3>[ 5.643005] init: sys_prop: permission denied uid:1001 name:net.rmnet1.dns1
<3>[ 5.643737] init: sys_prop: permission denied uid:1001 name:net.rmnet1.dns2
<3>[ 5.644287] init: sys_prop: permission denied uid:1001 name:net.rmnet1.gw
<3>[ 5.645263] init: sys_prop: permission denied uid:1001 name:net.rmnet2.dns1
<3>[ 5.645812] init: sys_prop: permission denied uid:1001 name:net.rmnet2.dns2
<3>[ 5.646484] init: sys_prop: permission denied uid:1001 name:net.rmnet2.gw
<6>[ 5.707031] [MODEM_IF] misc_open : umts_boot0
<6>[ 5.707153] omap_hsi omap_hsi.0: HSI clock is now 96000000
<6>[ 5.723510] omap_hsi omap_hsi.0: Entering RX wakeup in 3 wires mode (no CAWAKE)
<6>[ 5.723602] [MODEM_IF] xmm6260_off()
<6>[ 5.723724] [MODEM_IF] xmm6260_on()
<6>[ 5.724456] [MODEM_IF] PA EVENT : reset =0, pa=1
<6>[ 5.724548] [MODEM_IF] umts_ipc0 state changed: OFFLINE
<6>[ 5.835540] [MODEM_IF] PA EVENT : reset =1, pa=0
<6>[ 5.979125] virtio_rpmsg_bus virtio1: creating channel rpmsg-omx addr 0x3c
<6>[ 5.980194] rpmsg_omx rpmsg-omx1: new OMX connection srv channel: 1024 -> 60!
<6>[ 6.087188] PVR_K:(Error): BridgedDispatchKM: Initialisation failed. Driver unusable. [4812, drivers/gpu/pvr/bridged_pvr_bridge.c]
<3>[ 6.094604] init: untracked pid 118 exited
Anyone knows how to fix this issue?
Try reflashing the boot.img created by your build..
Did you also install the binaries from the google http://code.google.com/android/nexus/drivers.html#maguro into your AOSP source before building?
I built my own AOSP rom too, but haven't tried it yet.
also
Cleaning up when adding proprietary binaries
In order to make sure that the newly installed binaries are properly taken into account after being extracted, the existing output of any previous build needs to be deleted with
$ make clobber
Click to expand...
Click to collapse
http://source.android.com/source/building-devices.html
sorry if you did all this - I'm a noob to ASOP building
Did you wipe the device before installing the rom and kernel?
Luxferro said:
Did you also install the binaries from the google http://code.google.com/android/nexus/drivers.html#maguro into your AOSP source before building?
Click to expand...
Click to collapse
Hey man, that was the problem! Thank you very much... I didn't knew that such libraries exist for 4.0.3.
After installing the binaries and recompiling the phone boots up. Thanks again, also to all the people who tried to help me.
m0rph3us said:
Hey man, that was the problem! Thank you very much... I didn't knew that such libraries exist for 4.0.3.
After installing the binaries and recompiling the phone boots up. Thanks again, also to all the people who tried to help me.
Click to expand...
Click to collapse
No problem. Glad I can help
I guess that hopefully means my build would work too if I ever tried it. Was hoping official 4.0.3 OTA would be out by now. I might just have to try my build too.
Sent from my Galaxy Nexus using Tapatalk
I ran the script under /device/samsung/toro/
is that the correct place to run it, or should I be running it somewhere else?
Nevermind, I'm dumb. I read the post and got it now lol
I'm having the same issue, except for the toro (CDMA/LTE) galaxy nexus. Are these steps in the right order?
step 0: make clobber, step 1: run the extract-imgtec-toro.sh and make clobber, step 2: extract-files.sh, step 3: build/envsetup.sh, step 4: make?
jab416171 said:
I'm having the same issue, except for the toro (CDMA/LTE) galaxy nexus. Are these steps in the right order?
step 0: make clobber, step 1: run the extract-imgtec-toro.sh and make clobber, step 2: extract-files.sh, step 3: build/envsetup.sh, step 4: make?
Click to expand...
Click to collapse
you don't need to excessively run make clobber. all it really does is delete the out/ directory.
Here's how I was able to get a fully functional build ($ANDROID_SOURCE is your build dir):
0) make clobber; # just for the initial cleansing
1) cd $ANDROID_SOURCE/device/samsung/toro && ./extract-files.sh
2) run extract-imgtec-toro.sh OUTSIDE of your build directory (in a temporary location)
3) copy the contents of $TEMPDIR/vendor/imgtec/toro/proprietary/* into $ANDROID_SOURCE/vendor/samsung/toro/proprietary/
4) cd $ANDROID_SOURCE; . build/envsetup.sh
5) lunch #pick your desired toro build. Probably full_toro-userdebug
6) make
The reality is that extract-files.sh does everything well, except it doesn't include the gpu drivers (so we copy them manually). The make files that extract-files.sh creates DOES reference the gpu drivers, they're just not extracted by the script.
Messing with extract-imgtec-toro.sh will give you make files that don't reference any of the other binaries. Your image will boot, but won't have much else working.
Good luck!
Thanks for the quick reply. Here's my script, let me know if you see any errors.
The reason I did make clobber after the extract-imgtec-toro was because the documentation on google's site recommended doing that.
export TOP=/home/jab416171/android/dev/aosp
export GNEXTEMP=/home/jab416171/gnexproprietaryfiles
cd $TOP
repo sync
make clobber
adb wait-for-device
cd $TOP/device/samsung/toro && ./extract-files.sh
cd $GNEXTEMP && ./extract-imgtec-toro.sh
cp $GNEXTEMP/vendor/imgtec/toro/proprietary $TOP/vendor/samsung/toro/proprietary/
cd $TOP
source build/envsetup.sh
lunch full_toro-userdebug
make -j5
jab416171 said:
Thanks for the quick reply. Here's my script, let me know if you see any errors.
The reason I did make clobber after the extract-imgtec-toro was because the documentation on google's site recommended doing that.
export TOP=/home/jab416171/android/dev/aosp
export GNEXTEMP=/home/jab416171/gnexproprietaryfiles
cd $TOP
repo sync
make clobber
adb wait-for-device
cd $TOP/device/samsung/toro && ./extract-files.sh
cd $GNEXTEMP && ./extract-imgtec-toro.sh
cp $GNEXTEMP/vendor/imgtec/toro/proprietary $TOP/vendor/samsung/toro/proprietary/
cd $TOP
source build/envsetup.sh
lunch full_toro-userdebug
make -j5
Click to expand...
Click to collapse
I think your cp needs a '/*' after the first proprietary. The object is to copy the contents of one proprietary directory into the proprietary directory of another. Unless I'm mistaken, your cp will copy the proprietary source folder into the proprietary destination folder resulting in a $TOP/vendor/samsung/toro/proprietary/proprietary. Either that or error out because you specified to cp a dir without a -R.
You should certainly run a make clobber after extracting new binaries if you have files from a previous build still lying around. if you've already cleaned it out, then its just redundant (and not hurting anything).
Otherwise it looks good to me! Good luck!
Makes sense on the cp command. I haven't actually run the script yet, and thanks for taking your time to overlook it.
And do I need to run extract-files and extract-imgtec-toro *every time* I want to do a build, or can I just extract them once, and copy them from another location on my drive, or will the files they extract just stay in the repository?
jab416171 said:
Makes sense on the cp command. I haven't actually run the script yet, and thanks for taking your time to overlook it.
And do I need to run extract-files and extract-imgtec-toro *every time* I want to do a build, or can I just extract them once, and copy them from another location on my drive, or will the files they extract just stay in the repository?
Click to expand...
Click to collapse
Just once. I usually just tar up my vendor/samsung/toro directory and keep the tar in a safe location. No more extractions once you have it.

[DEV] Building a custom kernel and kernel modules for stock kernel

Since fire phone doesn't have a bootloader unlock at the moment. There is no point in building a custom kernel. But By building a kernel we can build kernel modules which work on the stock kernel. And yes you can load unsigned kernel modules without a problem since fire phone doesn't use tz apps to verify kernel modules like Samsung does.
Setup
Source
Download the fire phone sources for firmware 4.6.1 from here. And extract the platfrom.tar inside the archive to somewhere(KERNEL_DIR).
toolchain
You can use the android ndk from google, But it requires some setup. I'm using linaro toolchain from here. You can use compiler version 4.7, 4.8 or 4.9. Kernel I'm using (Firmware 4.6.3 - Linux 3.4-perf-g280c96c) is built with gcc-4.7. But I'm using this gcc-4.9. Download it, extract is somewhere(TOOLCHAIN_DIR) and add the $TOOLCHAIN_DIR/bin to your PATH. Theoretically you would be able to build the kernel on windows using Cygwin or MSYS tools but using Linux is better.
config
Connect your phone trough adb and run
Code:
adb pull /proc/config.gz
zcat config.gz > $KERNEL_DIR/kernel/qcom/3.4/.config
With this config you will run into some problems because of a missing "trapz_generated_kernel.h". I don't know if this is an auto generated file when they build android as a whole or amazon removed this explicitly(can they do that without violating GPL?). Anyway It looks trapz is some low level kernel debugging function(comment here if you know more about it). We can safely disable it. Open $KERNEL_DIR/kernel/qcom/3.4/.config in a text editor and change the lines
Code:
CONFIG_TRAPZ=y
CONFIG_TRAPZ_TP=y
CONFIG_TRAPZ_TRIGGER=y
CONFIG_HAVOK=y
to
Code:
#CONFIG_TRAPZ=y
#CONFIG_TRAPZ_TP=y
#CONFIG_TRAPZ_TRIGGER=y
#CONFIG_HAVOK=y
building
Now edit the $KERNEL_DIR/kernel/qcom/3.4/Makefile and add this changes
Code:
EXTRAVERSION = -perf-g280c96c
This is at the top of the makefile. If we don't add this, vermagic for the modules will differ from stock kernel and they won't load.
ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf-
Click to expand...
Click to collapse
Here arm-linux-gnueabihf- is my cross compiler frefix. Look in $TOOLCHAIN_DIR/bin/ to find it.
Now cd into $KERNEL_DIR/kernel/qcom/3.4/ and do
Code:
make
The build will fail a few times complaining about missing headers. Most of the time it's just
Code:
#include <myheader.h>
instead of
Code:
#include "myheader.h"
Edit the source file where the build fails and change <>s to ""s. (maybe android ndk ignores the difference and include the headers anyway)
After kernel compiles, we are good to go. We can use this kernel sources to build kernel modules for stock kernel.
Kernel modules
To build the kernel modules, we basically need two things. An approximate kernel source and the Module.symvers file from the original kernel. We can get the Module.symvers file by building the complete kernel as explained above or Just extract it from our stock kernel.
To extract the Module.symvers from the stock kernel, extract the boot.img file from firmware update image. Get mkbootimg tools from here compile it and run
Code:
unmkbootimg --kernel zImage ---ramdisk ramdisk.cpio.gz -i boot.img
After you get the zImage. Download extract-symvers script from here and run
Code:
python2 extract-symvers.py -B 0xc0008000 zImage > Module.symvers
place this file in $KERNEL_DIR/kernel/qcom/3.4/ (You still have to do the changes mentioned above in kernel config and building section run make in the $KERNEL_DIR/kernel/qcom/3.4 and intrupt it after few seconds)
Now you can build loadable modules against this source. Here is a hello world kernel module.
Code:
//hello.c
#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/init.h>
static int __init hello_start(void)
{
printk("hello to the world from module");
return 0;
}
static void __exit hello_end(void)
{
printk("heloo exit");
}
module_init(hello_start);
module_exit(hello_end);
Code:
#Makefile
KERNEL_DIR=<your kernel dir>/kernel/qcom/3.4
obj-m := hello.o
PWD := $(shell pwd)
default:
$(MAKE) ARCH=arm CROSS_COMPILE=armeb-linux-gnueabi- -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
Put this files in a folder and run make in it. Change the paths and cross compiler prefix according to your setup. and run make.
After the build push the hello.ko to the phone.
Code:
adb push hello.ko /sdcard/
adb shell
su
cd sdcard
insmod hello.ko
run dmesg and you'll see the message.
I'm currently trying to build kexec module from hashcode's sources and USB OTG modules.
I'm attaching a few thing helped me do this.
since they have released this version of the fire os they have to provide the source code
see
http://www.gnu.org/licenses/gpl-faq.html#GPLRequireSourcePostedPublic
you have just shown that the source code they releases for the kernel does not match the one used to build the kernel. This means it is a clear violation of the gpl and amazon is in breach and can be sued.
on another note.
are the drivers for the nfc and camera compiled as a module or into the kernel?
They have yet to provide 4.6.3 and 4.6.4 kernel sources too.
I don't know exactly but in order for NFC and camera to work drivers are required and they are in fact compiled into the kernel.
The problem we currently have with NFC and camera is proprietary hal (hardware abstraction libraries) They are a part of Android and does not subject to GPL. Amazon changed the original android way how hal works and didn't release the sources!
by looking at the kernel drivers maybe we would be able to implement hal from scratch. But I don't see that intense dev support for fire phone. If you are up for it camera sources are at $KERNEL_DIR/kernel/qcom/3.4/drivers/media/platform/msm/camera_v2/
Major MAJOR respect for all of you making the Fire Phone even better!
@madushan1000
Could we do something like this to install a custom boot.img?
http://forum.xda-developers.com/optimus-l9/general/guide-install-custom-roms-locked-t3249828
I don't own this device but has anyone tried to see if kexec works?
spudowiar said:
I don't own this device but has anyone tried to see if kexec works?
Click to expand...
Click to collapse
Nope, I was working on it. But then I got a job. It will be sometime before I can start working on it again.
Could someone please provide the config extracted from /proc/config.gz?
I can't find this on CM11 rom for some reason.
Building the kernel now.
Some bugs are in the code and -Wall and gcc-wrapper.py escalate the warnings.
I wonder if those errors are there on purpose XD
helloworld.ko loaded successfully
I was able to execute kexec without anything. Just the binary.
Will keep you posted - this hacking might take a while to figure it all out.
I already have 3.4 kernel from the amazon sources.
I have the kexec userland program.
What is left is a loadable kexec kernel module (if that is possible at all).
removed
Okarin said:
Are we even sure those Amazon Kernel Sources are correct?
Those errors caught by the wrapper scripts are giving me the creeps.
Git the kexec_load.ko build.
Currently hands on insmod.
Phone doesn't do a reboot any longer:
insmod kexec_load.ko
init_module(0xb6e6c008, 408241, "") = -1 ENOENT (No such file or directory)
write(2, "insmod: init_module '/sdcard/kex"..., 79insmod: init_module '/sdcard/kexec_load.ko' failed (No such file or directory)
) = 79
munmap(0xb6e6c000, 409600) = 0
mprotect(0xb6f8c000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0xb6f8c000, 4096, PROT_READ) = 0
close(0) = 0
close(1) = 0
close(2) = 0
futex(0xb6f6cd74, FUTEX_WAKE_PRIVATE, 2147483647) = 0
munmap(0xb6f8c000, 4096) = 0
exit_group(-1) = ?
First goal is to get module loaded.
Goal reached:
kexec_load 27813 0 - Live 0x00000000 (O)
procfs_rw 12770 0 - Live 0x00000000 (O)
wlan 3793980 0 - Live 0x00000000 (O)
Shouldn't be functional at all..
I disabled some function calls just to get the module loaded.
The missing symbols are:
soft_restart
arch_kexec
machine_shutdown
And the version I use does some insane function hooking ..
More rework is needed.
[email protected]:/data/local # ./kexec /sdcard/vmlinux
kernel: 0xaf12d008 kernel_size: 7e1354c
unrecoverable error: could not scan "/proc/device-tree/": No such file or directory
<6>[ 97.681256] Kexec_load: Replacement... :
<6>[ 97.681344] kexec_load : my_syscall_table : c0106244
<6>[ 97.681405] kexec_load : kexec_load before replacement : c01b346c
<6>[ 97.681480] kexec_load : kexec_load after replacement : bf3a5650
<6>[ 97.681546] kexec_load : reboot before replacement : c01a83f0
<6>[ 97.681616] kexec_load : reboot after replacement : bf3a6348
<6>[ 97.681675] Kexec_load: End replacement... :
<6>[ 202.694691] Kexec: - Starting kexec_load...
<6>[ 202.694849] Kexec: - ---- kexec_load - result : '0'
It gets better:
255|[email protected]:/data/local # ./kexec --dtb=/sdcard/zImage-dtb /sdcard/vmlinux
kernel: 0xaf1b1008 kernel_size: 7e1354c
kexec-zImage-arm : dtb.img BEFORE CUT : Start : '0xae66f008' - Length : '0xb411e9' - End : '0xaf1b01f1'
Segmentation fault
More tomorrow.
Click to expand...
Click to collapse
Where are you getting your kexec module sources from? BTW try using the original amazon kernal binary the phone is shipped with (we are sure it works). Don't use the custom kernel for the kexec tests (We don't know the custom kernel actually works)
madushan1000 said:
Where are you getting your kexec module sources from? BTW try using the original amazon kernal binary the phone is shipped with (we are sure it works). Don't use the custom kernel for the kexec tests (We don't know the custom kernel actually works)
Click to expand...
Click to collapse
Here is the thread I used as a starting point.
I will put up my "fork" on github after I get permission to do that
The userland part build like a charm once I took the compiler you recommended.
The kernel-module was tricky because the whole thing is modded like hell.
To be able to load I had to comment out some hard coded addresses and the calls to unresolvable symbols.
removed
Okay the kernel gets loaded.
But
kexec -e shuts off the device.
strace doesn't help.
On the plus side:
Devices are shutdown
Look promising
I need a way to tail dmesg ...
Okay a lot of digging around and I found out that the reboot syscall doesn't work properly..
It doesn't look like it hits the kexec_module it looks more like it hits the actualy sys_reboot
Okay reboot syscall hits my reboot-hook.
But the softreboot doesn't work now.
Okay there is some kind of watchdog runnig which doesn't like my kexec.
I need to kill it - that should happen tomorrow.
removed
I hit the same wall when I tried to isolate the kexec code from the kernel itself to a module. I stopped working on it because I lacked the time. BTW the error you are facing now
<3>[ 80.580644] BUG: scheduling while atomic: kexec/4067/0x00000002
Click to expand...
Click to collapse
is because memory allocator is trying to switch threads while you are in a syscall. it's because of lines like this
image = kzalloc(sizeof(*image), GFP_KERNEL);
Click to expand...
Click to collapse
Try changing GFP_KERNEL to GFP_ATOMIC. Other than that, I have another suggestion. Try to get the kernel to run in a single core mode before running kexec code. This might simplify things. I don't know how to do this though.
madushan1000 said:
I hit the same wall when I tried to isolate the kexec code from the kernel itself to a module. I stopped working on it because I lacked the time. BTW the error you are facing now
is because memory allocator is trying to switch threads while you are in a syscall. it's because of lines like this
Try changing GFP_KERNEL to GFP_ATOMIC. Other than that, I have another suggestion. Try to get the kernel to run in a single core mode before running kexec code. This might simplify things. I don't know how to do this though.
Click to expand...
Click to collapse
The atmic error is gone now. It went away after I disabled the watchtog.
smp_disable() is what you are looking for - but this causes the system to hard_reboot ATM XD
what happens if you kill every userlevel program before smp_disable()?
removed
#define tomorrow
Okay .. I worked out the preemption thing.
At least it does something.
Still a black screen and the MSM_WATCHDOG is a ***** again.
It needs to be suspended .. at least that what I get from the code I read here.
If I remove the driver too early the output in /proc/kmsg stops ..
If I try to remove it too late ... well it causes a resched while atomic.

Build ResurrectionRemix V5.8.0 - Nougat for D855

Hi everyone !
I try to build RR from myself for the D855. The nougat version : V5.8.0 !
I followed the guide in RR android_manifest github : https://github.com/ResurrectionRemix/platform_manifest.
I build with Archlinux.
The process fail because of the prebuid package Gello. I don't know why, maven cannot download the apk.
Code:
FAILED: /home/julian/android/RR/out/target/common/obj/APPS/Gello_intermediates/org.cyanogenmod.gello-40.apk
/bin/bash -c "(mvn -q org.apache.maven.plugins:maven-dependency-plugin:2.10:get org.apache.maven.plugins:maven-dependency-plugin:2.10:copy -DremoteRepositories=central::::https://maven.cyanogenmod.org/artifactory/gello_prebuilds -Dartifact=org.cyanogenmod:gello:40:apk -Dmdep.prependGroupId=true -Dmdep.overWriteSnapshots=true -Dmdep.overWriteReleases=true -Dtransitive=false -DoutputDirectory=/home/julian/android/RR/out/target/common/obj/APPS/Gello_intermediates/ )"
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:get (default-cli) on project standalone-pom: Couldn't download artifact: Could not transfer artifact org.cyanogenmod:gello:apk:40 from/to central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[ERROR] org.cyanogenmod:gello:apk:40
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false),
[ERROR] central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds, releases=true, snapshots=true)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ 52% 17961/34013] target Package: Eleven (/home/julian/android/RR/out/target/product/d855/obj/APPS/Eleven_intermediates/package.apk)
Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines versionName (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
[ 52% 17961/34013] Building with Jack: /home/julian/android/RR/out/target/common/obj/APPS/Exchange2_intermediates/with-local/classes.dex
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/home/julian/android/RR'
[COLOR="Red"]#### make failed to build some targets (19:06 (mm:ss)) ####[/COLOR]
Why are there some prebuild packages ?
How can I build them from source ? Or how can I remove then from my build ?
I did not find information on cynogenmod wiki (archive.org). Maybe because of the cyanogen shutdown, there is no way to build CM.
Thanks !
Julian

Categories

Resources