Add key in /res/keys - Android Software/Hacking General [Developers Only]

Hi,
I wan't to add a new key in /res/keys to be able to sign update.zip files that will be verified OK by the recovery.
It seems the utility dumpkeys.jar is done for this, but I don't currently have the environement to compile Android and cannot manage to compile the DumpPublicKey.java file alone.
Would any ROM makers post me the dumpkeys.jar (it's in system/core/libmincrypt/tools ) ?
Or any other utilities that can put the public key in good format...
Or any other way to achieve this (I don't wan't to change the boot loader except if there is no other solutions).
Thanks.

/res/keys in stock rom's initramfs and custom roms'
want to know how /res/keys is used in zImage and flashing
Thanks

http://forum.xda-developers.com/showthread.php?t=788251
sorry to post here as I don't have right to post there.
seem res/keys is required for custom zImage but how to replace or create. Guess it can't just copy from stock rom

found something related which may help
http://forum.xda-developers.com/showthread.php?t=581216
http://forum.xda-developers.com/showthread.php?t=471586&highlight=sign

found it!! the code which check /res/keys
<android source>/bootable/recovery/install.c
Code:
#include "install.h"
#include "mincrypt/rsa.h"
#include "minui/minui.h"
#include "minzip/SysUtil.h"
#include "minzip/Zip.h"
#include "mtdutils/mounts.h"
#include "mtdutils/mtdutils.h"
#include "roots.h"
#include "verifier.h"
#define ASSUMED_UPDATE_BINARY_NAME "META-INF/com/google/android/update-binary"
#define PUBLIC_KEYS_FILE "/res/keys"

Related

[HOWTO]Make cm kernel branch eclair booting on new Radio

Make cm kernel branch eclair booting on new Radio (6.35...)
I am a very beginner with this.The attachment is the diff between the
cm-kernel and modifications based on it.thx~!
Maybe helpful~
forgot to say for 32A
youngzi said:
Make cm kernel branch eclair booting on new Radio (6.35...)
I am a very beginner with this.The attachment is the diff between the
cm-kernel and modifications based on it.thx~!
Maybe helpful~
forgot to say for 32A
Click to expand...
Click to collapse
Are you saying you got the cm-kernel booting a 6.x radio using this patch?
Can you make a diff using
Code:
diff -urN
yes,i think so ; )
this is the diff file,but with local kernel project based on cm-kernel eclair
You 'think' so?
...
It would be nice to see new radio work with CM. Can you provide more details if you really got this to work?
youngzi said:
yes,i think so ; )
this is the diff file,but with local kernel project based on cm-kernel eclair
Click to expand...
Click to collapse
Can you do a
Code:
diff -urN
so that we can apply it using
Code:
patch -p0 < diff.txt
source code i modified for porting it to new Radio,please check it first.
i will send my source code tonight(Beijing Time,now daytime),because i am working in my office.
my english is no so good, sorry ~~
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/Kconfig Android_2.1/kernel/arch/arm/mach-msm/Kconfig
8a9
> default 6355 if MSM_AMSS_VERSION_6355
25a27,29
>
> config MSM_AMSS_VERSION_6355
> bool "6.3.55"
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/Makefile Android_2.1/kernel/arch/arm/mach-msm/Makefile
34a35,36
> obj-$(CONFIG_MACH_SAPPHIRE) += htc_battery.o
> obj-$(CONFIG_MACH_SAPPHIRE) += htc_akm_cal.o htc_wifi_nvs.o htc_acoustic.o
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/qdsp5/adsp.h Android_2.1/kernel/arch/arm/mach-msm/qdsp5/adsp.h
130a131
> /* < youngzi mod for new radio begin */
133a135,139
> #elif (CONFIG_MSM_AMSS_VERSION == 6355)
> #define RPC_ADSP_RTOS_ATOM_VERS 0x10001 /* 65537 */
> #define RPC_ADSP_RTOS_MTOA_VERS 0x20001 /* 131073 */
> #define MSM_ADSP_DRIVER_NAME "rs3000000a:00010001"
> /* youngzi mod for new radio end > */
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/qdsp5/audmgr.h Android_2.1/kernel/arch/arm/mach-msm/qdsp5/audmgr.h
21a22,25
> /* < youngzi mod for new Radio begin */
> #elif CONFIG_MSM_AMSS_VERSION==6355
> #include "audmgr_new.h"
> /* youngzi mod for new Radio end > */
23d26
<
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/qdsp5/audmgr_new.h Android_2.1/kernel/arch/arm/mach-msm/qdsp5/audmgr_new.h
149a150,153
> /* < youngzi mod for new Radio begin */
> #if CONFIG_MSM_AMSS_VERSION==6355
> #define AUDMGR_VERS MSM_RPC_VERS(1,2)
> #else //CONFIG_MSM_AMSS_VERSION
150a155,156
> #endif //CONFIG_MSM_AMSS_VERSION
> /* youngzi mod for new Radio end > */
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/qdsp5/Makefile Android_2.1/kernel/arch/arm/mach-msm/qdsp5/Makefile
2c2,3
< ifeq ($(CONFIG_MSM_AMSS_VERSION_6350),y)
---
>
> ifeq ($(CONFIG_MSM_AMSS_VERSION_6355),y)
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/qdsp5/snd.c Android_2.1/kernel/arch/arm/mach-msm/qdsp5/snd.c
48a49,52
> /* < youngzi mod for new Radio begin */
> #elif CONFIG_MSM_AMSS_VERSION == 6355
> #define RPC_SND_VERS MSM_RPC_VERS(1,1)
> /* youngzi mod for new Radio end > */
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/rpc_server_dog_keepalive.c Android_2.1/kernel/arch/arm/mach-msm/rpc_server_dog_keepalive.c
32a33,37
> /* < youngzi mod for new Radio begin */
> #elif CONFIG_MSM_AMSS_VERSION==6355
> #define DOG_KEEPALIVE_VERS 0x10001 /* 65537 */
> #define RPC_DOG_KEEPALIVE_BEACON 2
> /* youngzi mod for new Radio end > */
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/rpc_server_time_remote.c Android_2.1/kernel/arch/arm/mach-msm/rpc_server_time_remote.c
29a30,33
> /* < youngzi mod for new Radio begin */
> #elif CONFIG_MSM_AMSS_VERSION==6355
> #define TIME_REMOTE_MTOA_VERS 0x00010001
> /* youngzi mod for new Radio end > */
diff -r cyanogen-cm-kernel-de672b7/arch/arm/mach-msm/smd_private.h Android_2.1/kernel/arch/arm/mach-msm/smd_private.h
70a71,80
> /* < youngzi mod for new Radio begin */
> #if CONFIG_MSM_AMSS_VERSION == 6355
> #define SMSM_MAX_PORT_NAME_LEN 20
> uint32_t aArm_rpc_prog;
> uint32_t aArm_rpc_proc;
> char aArm_smd_port_name[SMSM_MAX_PORT_NAME_LEN];
> /* If the wakeup reason is GPIO then send the gpio info */
> uint32_t aArm_gpio_info;
> #endif
> /* youngzi mod for new Radio end > */
diff -r cyanogen-cm-kernel-de672b7/drivers/rtc/rtc-msm7x00a.c Android_2.1/kernel/drivers/rtc/rtc-msm7x00a.c
33c33,37
< #if CONFIG_MSM_AMSS_VERSION >= 6350
---
> /* < youngzi mod for new Radio begin */
> #if (CONFIG_MSM_AMSS_VERSION == 6355)
> #define APP_TIMEREMOTE_PDEV_NAME "rs30000048:00010001"
> #elif CONFIG_MSM_AMSS_VERSION >= 6350
> /* youngzi mod for new Radio end > */
When you create that diff file, instead of using 'diff -r ' can you use 'diff -urN'
Also, have you tried booting this?
i never worked on cm-kernel, but i think your patch will make your phone boot. but for the new radio, only these modification could not make the android layer working properly.
and i think you should not use cm-kernel as your start or base. Cyanogen didn't do much thing special at the kernel level, you could know this by viewing his git log or by a diff. and the modification and patches Cyanogen applied will become obstruction when you would do some serious work.
all the patches or modification Cyanogen applied to cm-kernel can be applied after we make a clean kernel good enough.
official source code is a better start. if you could work on official sources, we could work together since I have made a kernel .29 which can support aosp ROM, and working on kernel .32 and prepare to add some supports for HTC specified functions now.
i use android 2.1 using my boot.img with kernel i built and sanpei's system.img.
i just want to post some source code for who want to build the kernel for new radio,not
test too much. And i just make the cm-kernel boot up with new Radio,not do too much.
thx!
I have said now i can not post the diff. for I am in office,i'll post it when i am home.OK?
youngzi said:
i use android 2.1 using my boot.img with kernel i built and sanpei's system.img.
i just want to post some source code for who want to build the kernel for new radio,not
test too much. And i just make the cm-kernel boot up with new Radio,not do too much.
thx!
I have said now i can not post the diff. for I am in office,i'll post it when i am home.OK?
Click to expand...
Click to collapse
Sorry, I didnt see that you couldn't post the diff. Thanks youngzi.
I send the diff.patch between my source code and CM-kernel ,but i do not sure this can help you to do the work.hope this useful.thx~~
i send the diff user diff -urN, you can get it. but i do not know whether i do it in right way.~
youngzi said:
i send the diff user diff -urN, you can get it. but i do not know whether i do it in right way.~
Click to expand...
Click to collapse
That diff was good, thanks.
Can you attach your .config?
my .config just the g2_defconfig in the diff.patch
you can get it from the patch
youngzi said:
my .config just the g2_defconfig in the diff.patch
you can get it from the patch
Click to expand...
Click to collapse
Perfect. Thanks.
u r welcome : )
Could you post a working kernel? Just a boot.img-kernel would be fine...thanks
If you guys have a 6.x compatible CM kernel ready for testing, please alert me as I am willing to upgrade and have a go at testing it. if there are specific list of stuff i need to test, please include a list.
str4vag said:
If you guys have a 6.x compatible CM kernel ready for testing, please alert me as I am willing to upgrade and have a go at testing it. if there are specific list of stuff i need to test, please include a list.
Click to expand...
Click to collapse
Will do. I have tried a few and they have all failed.
bcrook said:
Will do. I have tried a few and they have all failed.
Click to expand...
Click to collapse
i send the kernel i built. u can try to make bootimage use this kernel
and this is very very unstable.

Getting BFS Scheduler working?

Im so sorry if this is in the wrong place but im a developer working on my first kernel and my question is only going to get some help by the most elite ROM dev's out there.
Ok so i got the BFS patch for the kernel im currently working on which is 2.6.32.9. Of course the patch is meant for a mainline kernel and not an Android kernel so i went through the patch file and applied the patch by hand, it was a pretty smooth process the diffs in the bfs patch were all the same code just wouldn't apply because all the line numbers were off. My first attempt bombed so i must have made some mistakes it was my first time patching by hand! Anyways took another crack and recompiled the kernel after every file patched so i could basically debug compiling problems well it all went smooth.
Heres the problem though, kernel compiles fine with out bfs checked, with it checked it compile a hell of alot of the kernel, but it eventually fails and it make no seance after my investigation of things. Here is my error
Code:
drivers/built-in.o: In function `mmc_wait_for_req':
lowmemorykiller.c:(.text+0xd2b3c): undefined reference to `wait_for_completion_io'
make: *** [.tmp_vmlinux1] Error 1
I found the decleration for wait_for_completion_io in kernel/sched.c the only thing i changed in sched.c was to at line 1 and it was basically to include sched_bfs.c, if the scheduler was seleted in the config, heres the patch stuff for sched, all i did was add the three lines to check if bfs was set in the config and then added the #endif at the bottom
Code:
*/
Index: linux-2.6.32-ck2/kernel/sched.c
===================================================================
--- linux-2.6.32-ck2.orig/kernel/sched.c 2009-12-03 21:02:30.565685697 +1100
+++ linux-2.6.32-ck2/kernel/sched.c 2009-12-29 10:15:00.820070753 +1100
@@ -1,3 +1,6 @@
+#ifdef CONFIG_SCHED_BFS
+#include "sched_bfs.c"
+#else
/*
* kernel/sched.c
*
@@ -10909,3 +10912,4 @@ void synchronize_sched_expedited(void)
EXPORT_SYMBOL_GPL(synchronize_sched_expedited);
#endif /* #else #ifndef CONFIG_SMP */
+#endif /* CONFIG_SCHED_BFS */
\ No newline at end of file
.
At the end of sched.c it starts exporting the functions and wait!!!! the first function it exports looks like this!
Code:
/**
* wait_for_completion: - waits for completion of a task
* @x: holds the state of this particular completion
*
* This waits to be signaled for completion of a specific task. It is NOT
* interruptible and there is no timeout.
*
* See also similar routines (i.e. wait_for_completion_timeout()) with timeout
* and interrupt capability. Also see complete().
*/
void __sched wait_for_completion(struct completion *x)
{
wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(wait_for_completion);
So maybe sched isnt exporting any functions anymore after the inclusion of sched_bfs.c into it? i dont know all i know it i didnt touch lowmemmory.c and im sooo close to getting BFS but this is boggling me!! Maybe there is a conflict in kernel options im not aware of? I turned off all c groups and the default scheduler.
I wont paste my .config here nothing annoys me more than that, heres a link to a gist of it on github (just like pastbin for thos not in the know lol) bfs enabled .config and here is my sched.c and my lowmemmorykiller.c! Any help would be awesome there are so many people patching bfs into there androif kernel so im hoping this is a common type of problem
EDIT if i remove the mmc drivers it finishes the compile, but i kind of need these have to sleep now ill experiment more, if neone has any ideas about what the heck is goin on id love to know
did you ever fix this? i ran into the same error. a quick google search got me this and it seems to be working. ill post later if it actually works.
edit: succesfully built tdm's gingerkernel with -ck patchset with this. working on bobzhome's kernel now
Sorry this is way late man!! I have been doing alot of hardware hacking as of late, my android stuff especially kernel modding has been pushed to the the side.
Anyways how did BFS turn out any speed improvements? Maybe ill see if I can patch it into cm9 if theres and good reason for that
I am getting this same error after adding bfs to my kernel.. the link you gave is 404. Any one who worked with bfs that can provide some insight, that would be greatly appreciated. Thanks
arch/arm/mach-msm/built-in.o:shooter-panel.c:function msm_dmov_exec_cmd: error: undefined reference to 'wait_for_completion_io'
drivers/built-in.o:clkdev.c:function mmc_wait_for_req: error: undefined reference to 'wait_for_completion_io'
drivers/built-in.o:clkdev.c:function mmc_wait_for_cmd: error: undefined reference to 'wait_for_completion_io'
drivers/built-in.o:clkdev.c:function mmc_erase: error: undefined reference to 'wait_for_completion_io'
make: *** [.tmp_vmlinux1] Error 1
You can get BFS working adding these lines in <kernel-path>/kernel/sched_bfs.c
Code:
/**
* wait_for_completion_io: - waits for completion of a task
* @x: holds the state of this particular completion
*
* This waits for completion of a specific task to be signaled. Treats any
* sleeping as waiting for IO for the purposes of process accounting.
*/
void __sched wait_for_completion_io(struct completion *x)
{
wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE);
}
EXPORT_SYMBOL(wait_for_completion_io);
After this line:
Code:
EXPORT_SYMBOL(wait_for_completion);

[Q] Compiling Kernel Module in ICS

Hi All,
I am currently trying to compile kernel module for a local echo driver in ICS. I got success while trying the same in GB but doing so in ICS the echo driver is not get compiled to KO object
I got below errors while compiling
make circular .so - .so dependency dropped in android
#build/core/main.mk:537: *** Some files have been added to ALL_PREBUILT.
#build/core/main.mk:538: *
#build/core/main.mk:539: * ALL_PREBUILT is a deprecated mechanism that
#build/core/main.mk:540: * should not be used for new files.
#build/core/main.mk:541: * As an alternative, use PRODUCT_COPY_FILES in
#build/core/main.mk:542: * the appropriate product definition.
#build/core/main.mk:543: * build/target/product/core.mk is the product
#build/core/main.mk:544: * definition used in all products.
#build/core/main.mk:545: *
#build/core/main.mk:546: * unexpected circular-char.ko in ALL_PREBUILT
#build/core/main.mk:547: *
#build/core/main.mk:548: *** ALL_PREBUILT contains unexpected files. Stop.
I know that the problem is in Android.mk of the echo driver source, So please guide me on making make file in ICS
Looking forward for your guidlines....
Regards
Venkatraman

[Q] Trying to build CWM, stuck with no rule to make target kernel

Hi all,
Today I've decided to build CM11 for my DIFRNCE DIT1010 tablet.
I'm trying to get started by building CWM first, since I'm new at this, and also because I figured I'll need that to flash CM in the end.
I know there's the clockworkmod builder website, I've tried that, but it apparently gave me a CWM for loganrelte aka Galaxy Ace 3.
And I also thought I wouldn't learn much by using that website. (sorry, I don't mean to slack off that great tool)
So I've been following the guide on xda-university, ran into some problems which I've been able to fix so far, but now I need help.
Running make -j4 recoveryimage starts off with: (I've translated this from Dutch)
Code:
/home/harm/bin/out/target/product/DIT1010/obj/APPS/SignatureTest_intermediates
find: ‘src’: no such file or directory
PRODUCT_COPY_FILES device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml ignored.
No private recovery resources for TARGET_DEVICE DIT1010
build/core/tasks/kernel.mk:63: ***************************************************************
build/core/tasks/kernel.mk:64: * Using prebuilt kernel binary instead of source *
build/core/tasks/kernel.mk:65: * THIS IS DEPRECATED, AND WILL BE DISCONTINUED *
build/core/tasks/kernel.mk:66: * Please configure your device to download the kernel *
build/core/tasks/kernel.mk:67: * source repository to kernel/DIFRNCE/DIT1010
build/core/tasks/kernel.mk:68: * See http://wiki.cyanogenmod.org/w/Doc:_integrated_kernel_building
build/core/tasks/kernel.mk:69: * for more information *
build/core/tasks/kernel.mk:70: ***************************************************************
build/core/tasks/kernel.mk:198: warning: overriding commands for target '/home/harm/bin/out/target/product/DIT1010/kernel'
build/core/Makefile:44: warning: ignoring old commands for target '/home/harm/bin/out/target/product/DIT1010/kernel'
... and ends with:
Code:
make: *** No rule to make target 'device/DIFRNCE/DIT1010/kernel', needed by '/home/harm/bin/out/target/product/DIT1010/kernel'. Stop.
make: *** Waiting for unfinished jobs...
So I followed the link it gave me there, which tells me to "Follow the CM Build Guides for your device with the change explained below."
I've searched, but there are no build guides for my device.
Can anyone help me fixing my problem?
Thanks in advance.
Okay, so I've downloaded my kernel from http://crewrktablets.arctablet.com/?wpfb_dl=1473,
extracted it, and I've put the kernel.img in /home/harm/bin/device/DIFRNCE/DIT1010.
Now I get a different output:
Code:
build/core/tasks/kernel.mk:91: **********************************************************
build/core/tasks/kernel.mk:92: * Kernel source found, but no configuration was defined *
build/core/tasks/kernel.mk:93: * Please add the TARGET_KERNEL_CONFIG variable to your *
build/core/tasks/kernel.mk:94: * BoardConfig.mk file *
build/core/tasks/kernel.mk:95: **********************************************************
What's the TARGET_KERNEL_CONFIG variable? I believe it's a path to somewhere, but I don't know where to point it to?

[Q] Extracting kernel image from a rom image

I am trying to build some kernel modules for a Tronsmart MK808ii but Tronsmart have not provided the config (No proc/config.gz) after some messing about I have managed to get some kernel modules to load (I have the Init and Exit pointers in the right place). My first aim is to allow the device to read usb cdroms and iso files for which I need to load isofs.ko cdrom.ko and sr_mod.ko
Actually things go pretty well except there appears to be a misalignment between struct gendisk in the module and kernel. when the genhd driver dereferences gendisk->part0 i get an oops. Looking at the code the only definable length object before part0 seems to be disk_name
In order to be more precise about what's happening and to determine the relative alignment of structures between my kernel and the supplied one I need to be able to disassemble the original kernel which I've extracted from the eeprom - ony problem is that neither file nor objdump know what to do with this image, so I'm presupposing it has some sort of header on it so the bootloader can find the image. The Image starts with KRNL$
Does anyone have an idea of how vmlinux image can be extracted from this rom image?
int major; /* major number of driver */
int first_minor;
int minors; /* maximum number of minors, =1 for
* disks that can't be partitioned. */
char disk_name[DISK_NAME_LEN]; /* name of major driver */
char *(*devnode)(struct gendisk *gd, mode_t *mode);
unsigned int events; /* supported events */
unsigned int async_events; /* async events, subset of all */
/* Array of pointers to partitions indexed by partno.
* Protected with matching bdev lock but stat and other
* non-critical accesses use RCU. Always access through
* helpers.
*/
struct disk_part_tbl __rcu *part_tbl;
struct hd_struct part0;

Categories

Resources