[KERNEL] Stock Kernel (no write protection)

Search This thread

flar2

Recognized Developer
Jun 11, 2012
18,894
87,865
Southwestern Ontario
elementalx.org
Last edited:

AlxMAX

Senior Member
Sep 30, 2007
560
138
Bucharest
On my side, I had some problems. I have tried to compile the kernel, but I went a little bit further with the modifications:
  • disabled the /system write protection.
  • integrated the prima_wlan source tree in drivers/staging. The sources were downloaded from the codeaurora.org site and the driver version was 3.1.7.16 (I have specifically chosen this version because it was the closest to the 3.1.7.0 version that exists in the stock ROM).
  • compressed the vmlinux image with LZMA instead of gzip (this is an option in the configuration) to obtain the zImage file.
  • compressed the ramdisk image with LZMA instead of gzip (in the configuration file, I have seen 3 enabled options: gzip, LZMA and XZ and I thought recompressing the ramdisk might not hurt).
The toolchain I have used was downloaded from android.googlesource.com. Then I have unpacked the original boot.img like this: trimmed the first 128 bytes from the file (up to the ANDROID magic label), then used the unpackbootimg tool (this was a tool I have found in a Gingerbread source tree). Then, I have used the new zImg, the LZMA compressed ramdisk and mkbootimg (this was also picked from the same Gingebread source tree) to build a new boot.img. I have booted in the recovery, flashed the new modules, then booted in fastboot mode and flashed the boot.img. The result was an annoying boot loop and it wasn't very easy to put the phone in fastboot mode again.
  • I have some questions about what I have done so far. Could you, please, tell me if there was a wrong manoeuvre/setting/thingie? I suspect the unpacking process has not produced the proper data (command line, base address ...). What tool have you used to unpack the original boot.img file? I also suspect the packing process. Is a new mkbootimg required?
  • And some questions about your work. What prima_wlan driver have you used in your boot.img? Have you modified the suffix added to the 3.4.10 version when you have configured the kernel in order to make it work?
 
Last edited:

Zarboz

Known Scammer
Mar 5, 2009
145
9,339
Denver
On my side, I had some problems. I have tried to compile the kernel, but I went a little bit further with the modifications:
  • disabled the /system write protection.
  • integrated the prima_wlan source tree in drivers/staging. The sources were downloaded from the codeaurora.org site and the driver version was 3.1.7.16 (I have specifically chosen this version because it was the closest to the 3.1.7.0 version that exists in the stock ROM).
  • compressed the vmlinux image with LZMA instead of gzip (this is an option in the configuration) to obtain the zImage file.
  • compressed the ramdisk image with LZMA instead of gzip (in the configuration file, I have seen 3 enabled options: gzip, LZMA and XZ and I thought recompressing the ramdisk might not hurt).
The toolchain I have used was downloaded from android.googlesource.com. Then I have unpacked the original boot.img like this: trimmed the first 128 bytes from the file (up to the ANDROID magic label), then used the unpackbootimg tool (this was a tool I have found in a Gingerbread source tree). Then, I have used the new zImg, the LZMA compressed ramdisk and mkbootimg (this was also picked from the same Gingebread source tree) to build a new boot.img. I have booted in the recovery, flashed the new modules, then booted in fastboot mode and flashed the boot.img. The result was an annoying boot loop and it wasn't very easy to put the phone in fastboot mode again.
  • I have some questions about what I have done so far. Could you, please, tell me if there was a wrong manoeuvre/setting/thingie? I suspect the unpacking process has not produced the proper data (command line, base address ...). What tool have you used to unpack the original boot.img file? I also suspect the packing process. Is a new mkbootimg required?
  • And some questions about your work. What prima_wlan driver have you used in your boot.img? Have you modified the suffix added to the 3.4.10 version when you have configured the kernel in order to make it work?

use dsi xda kitchen to pack the boot.img for easy use

or

use this

unpackbootimg -i boot.img -o /directoryfordump
mkbootimg --cmdline 'console=ttyHSL0,115200,n8' --kernel zImage --ramdisk ramdisknew.gz --base 80400000 --ramdiskaddr 81900000 -o newboot.img
 
  • Like
Reactions: AlxMAX

AlxMAX

Senior Member
Sep 30, 2007
560
138
Bucharest
Where have you got that ramdisk address from? unpackbootimg doesn't report it.
mkbootimg --cmdline 'console=ttyHSL0,115200,n8' --kernel zImage --ramdisk ramdisknew.gz --base 80400000 --ramdiskaddr 81900000 -o newboot.img

Edit: I have done some research on mkbootimg and unpackbootimg and their usage is a little bit confusing. The boot image header contains a kernel address, a ramdisk address and some other data (including the command line provided to the kernel by the bootloader). The mkbootimg tool like it is in the Android repository uses more measures: a base address, a kernel offset, a ramdisk offset etc. The kernel address is base + kernel offset and so on. When unpacking the boot image with unpackbootimg, one must suppose one of the parameters fixed, usually the kernel offset (0x00008000). Consequently, the base address is computed as the kernel address - the kernel offset. To conclude, the command line to use should be:
Code:
mkbootimg --cmdline 'console=ttyHSL0,115200,n8' --base 80400000 --ramdisk_offset 1408000 --kernel boot.img-zImage --ramdisk boot.img-ramdisk.gz -o boot-2.img
This produces the same boot.img as the one posted by flar2, except for the command line.

Edit 2: I have recompiled the kernel, disabled the /system protection, used the mkbootimg command line right above and now my phone boots and runs well. The prima_wlan.ko that I have compiled together with the kernel (3.1.7.16 from codeaurora source repository) doesn't work. It might be a matter of wi-fi firmware. Fortunately, the stock prima_wlan.ko (proprietary 3.1.7.0) module works well.
 
Last edited:
  • Like
Reactions: Zarboz

Zarboz

Known Scammer
Mar 5, 2009
145
9,339
Denver
Where have you got that ramdisk address from? unpackbootimg doesn't report it.

Edit: I have done some research on mkbootimg and unpackbootimg and their usage is a little bit confusing. The boot image header contains a kernel address, a ramdisk address and some other data (including the command line provided to the kernel by the bootloader). The mkbootimg tool like it is in the Android repository uses more measures: a base address, a kernel offset, a ramdisk offset etc. The kernel address is base + kernel offset and so on. When unpacking the boot image with unpackbootimg, one must suppose one of the parameters fixed, usually the kernel offset (0x00008000). Consequently, the base address is computed as the kernel address - the kernel offset. To conclude, the command line to use should be:
Code:
mkbootimg --cmdline 'console=ttyHSL0,115200,n8' --base 80400000 --ramdisk_offset 1408000 --kernel boot.img-zImage --ramdisk boot.img-ramdisk.gz -o boot-2.img
This produces the same boot.img as the one posted by flar2, except for the command line.

Edit 2: I have recompiled the kernel, disabled the /system protection, used the mkbootimg command line right above and now my phone boots and runs well. The prima_wlan.ko that I have compiled together with the kernel (3.1.7.16 from codeaurora source repository) doesn't work. It might be a matter of wi-fi firmware. Fortunately, the stock prima_wlan.ko (proprietary 3.1.7.0) module works well.

you have to do some haxxing to get the CAF prima to load up
 

AlxMAX

Senior Member
Sep 30, 2007
560
138
Bucharest
There isn't any I have found just trial and error
If you are referring to the code enclosed by #ifdef CONFIG_HTC_WIFI_NVS ... #endif in wlan_hdd_main.c, then it is not simple trial and error. Have you picked the code from somewhere else and integrated into the prima sources or have you found the prima sources containing already that piece of code?
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    This is the stock kernel without system write protection. Completely stock configuration, completely stock ramdisk. The only difference is it allows write to system

    Uses Telstra 3.17.841.2 source from htcdev.com:
    http://dl4.htc.com/RomCode/Source_and_Binaries/evitaul-jb-crc-3.4.10-240d4d5.zip



    Devs who need a vanilla kernel are free to modify or include with ROMs

    installer: http://goo.gl/64HJc

    boot.img: http://goo.gl/IRZ9m
    1
    On my side, I had some problems. I have tried to compile the kernel, but I went a little bit further with the modifications:
    • disabled the /system write protection.
    • integrated the prima_wlan source tree in drivers/staging. The sources were downloaded from the codeaurora.org site and the driver version was 3.1.7.16 (I have specifically chosen this version because it was the closest to the 3.1.7.0 version that exists in the stock ROM).
    • compressed the vmlinux image with LZMA instead of gzip (this is an option in the configuration) to obtain the zImage file.
    • compressed the ramdisk image with LZMA instead of gzip (in the configuration file, I have seen 3 enabled options: gzip, LZMA and XZ and I thought recompressing the ramdisk might not hurt).
    The toolchain I have used was downloaded from android.googlesource.com. Then I have unpacked the original boot.img like this: trimmed the first 128 bytes from the file (up to the ANDROID magic label), then used the unpackbootimg tool (this was a tool I have found in a Gingerbread source tree). Then, I have used the new zImg, the LZMA compressed ramdisk and mkbootimg (this was also picked from the same Gingebread source tree) to build a new boot.img. I have booted in the recovery, flashed the new modules, then booted in fastboot mode and flashed the boot.img. The result was an annoying boot loop and it wasn't very easy to put the phone in fastboot mode again.
    • I have some questions about what I have done so far. Could you, please, tell me if there was a wrong manoeuvre/setting/thingie? I suspect the unpacking process has not produced the proper data (command line, base address ...). What tool have you used to unpack the original boot.img file? I also suspect the packing process. Is a new mkbootimg required?
    • And some questions about your work. What prima_wlan driver have you used in your boot.img? Have you modified the suffix added to the 3.4.10 version when you have configured the kernel in order to make it work?

    use dsi xda kitchen to pack the boot.img for easy use

    or

    use this

    unpackbootimg -i boot.img -o /directoryfordump
    mkbootimg --cmdline 'console=ttyHSL0,115200,n8' --kernel zImage --ramdisk ramdisknew.gz --base 80400000 --ramdiskaddr 81900000 -o newboot.img
    1
    Where have you got that ramdisk address from? unpackbootimg doesn't report it.
    mkbootimg --cmdline 'console=ttyHSL0,115200,n8' --kernel zImage --ramdisk ramdisknew.gz --base 80400000 --ramdiskaddr 81900000 -o newboot.img

    Edit: I have done some research on mkbootimg and unpackbootimg and their usage is a little bit confusing. The boot image header contains a kernel address, a ramdisk address and some other data (including the command line provided to the kernel by the bootloader). The mkbootimg tool like it is in the Android repository uses more measures: a base address, a kernel offset, a ramdisk offset etc. The kernel address is base + kernel offset and so on. When unpacking the boot image with unpackbootimg, one must suppose one of the parameters fixed, usually the kernel offset (0x00008000). Consequently, the base address is computed as the kernel address - the kernel offset. To conclude, the command line to use should be:
    Code:
    mkbootimg --cmdline 'console=ttyHSL0,115200,n8' --base 80400000 --ramdisk_offset 1408000 --kernel boot.img-zImage --ramdisk boot.img-ramdisk.gz -o boot-2.img
    This produces the same boot.img as the one posted by flar2, except for the command line.

    Edit 2: I have recompiled the kernel, disabled the /system protection, used the mkbootimg command line right above and now my phone boots and runs well. The prima_wlan.ko that I have compiled together with the kernel (3.1.7.16 from codeaurora source repository) doesn't work. It might be a matter of wi-fi firmware. Fortunately, the stock prima_wlan.ko (proprietary 3.1.7.0) module works well.