# Custom Kernel Help



## patrick (Jul 25, 2011)

Hey everyone/anyone willing to help!

I've been working on compiling my own custom kernel for the HTC Evo View 4G, and lately, I've been having some serious trouble. I followed OhHeyItsLou's tutorial (Thanks Lou, it was very helpful and informative!) and compiled the kernel very easily with no problems. I wanted my first one to be completely stock without any customization whatsoever, so the only change I made in the config file was to append a version name so I could see that it flashed.

Then I got Koush's AnyKernel tool from his GitHub, replaced the zImage with mine, and added the WiFi module into the correct place. After that, I zipped the package up in a terminal, and pushed it to the device for flashing.

At first, I was getting an error in Clockwork Mod:

```
<br />
mount() expects 4 args, got 3<br />
```
But then after some searching around, I _think_ I fixed it with a modification to the updater-script. Here's what the updater-script normally looks like:

```
<br />
ui_print("AnyKernel Updater by Koush.");<br />
ui_print("Extracting System Files...");<br />
set_progress(1.000000);<br />
mount("MTD", "system", "/system");<br />
package_extract_dir("system", "/system");<br />
unmount("/system");<br />
ui_print("Extracting Kernel files...");<br />
package_extract_dir("kernel", "/tmp");<br />
ui_print("Installing kernel...");<br />
set_perm(0, 0, 0777, "/tmp/dump_image");<br />
set_perm(0, 0, 0777, "/tmp/mkbootimg.sh");<br />
set_perm(0, 0, 0777, "/tmp/mkbootimg");<br />
set_perm(0, 0, 0777, "/tmp/unpackbootimg");<br />
run_program("/tmp/dump_image", "boot", "/tmp/boot.img");<br />
run_program("/tmp/unpackbootimg", "/tmp/boot.img", "/tmp/");<br />
run_program("/tmp/mkbootimg.sh");<br />
write_raw_image("/tmp/newboot.img", "boot");<br />
ui_print("Done!");<br />
```
I changed this line

```
mount("MTD", "system", "/system");
```
 to this

```
mount("ext4", "MTD", "system", "/system");
```
Now when I flash the zip, it goes through the whole process without giving me any errors, but when I go to the about section of the tablet and check what the kernel version is, it still says

```
2.6.35.10-g238a0bf<br />
[email protected] #1<br />
Tue Dec 6 16:01:31 CST 2011
```
I'm now struggling to get it to flash, but I have no idea what's wrong so I don't know what to try and fix... If anyone can see what I'm doing wrong, PLEASE help me! If you don't understand something I'd be glad to clarify what I can! I'm also open to your suggestions!


----------



## blueharford (Sep 9, 2011)

try


```
<br />
ui_print("AnyKernel Updater by Koush.");<br />
ui_print("Extracting System Files...");<br />
set_progress(1.000000);<br />
mount("MTD", "system", "/system");<br />
package_extract_dir("system", "/system");<br />
unmount("/system");<br />
ui_print("Extracting Kernel files...");<br />
package_extract_dir("kernel", "/tmp");<br />
ui_print("Installing kernel...");<br />
set_perm(0, 0, 0777, "/tmp/dump_image");<br />
set_perm(0, 0, 0777, "/tmp/mkbootimg.sh");<br />
set_perm(0, 0, 0777, "/tmp/mkbootimg");<br />
set_perm(0, 0, 0777, "/tmp/unpackbootimg");<br />
run_program("/tmp/dump_image", "boot", "/tmp/boot.img");<br />
run_program("/tmp/unpackbootimg", "-i", "/tmp/boot.img", "-o", "/tmp/");<br />
run_program("/tmp/mkbootimg.sh");<br />
run_program("/tmp/newboot.img", "boot");<br />
```


----------



## patrick (Jul 25, 2011)

blueharford said:


> try
> 
> ```
> ui_print("AnyKernel Updater by Koush."); ui_print("Extracting System Files..."); set_progress(1.000000); mount("MTD", "system", "/system"); package_extract_dir("system", "/system"); unmount("/system"); ui_print("Extracting Kernel files..."); package_extract_dir("kernel", "/tmp"); ui_print("Installing kernel..."); set_perm(0, 0, 0777, "/tmp/dump_image"); set_perm(0, 0, 0777, "/tmp/mkbootimg.sh"); set_perm(0, 0, 0777, "/tmp/mkbootimg"); set_perm(0, 0, 0777, "/tmp/unpackbootimg"); run_program("/tmp/dump_image", "boot", "/tmp/boot.img"); run_program("/tmp/unpackbootimg", "-i", "/tmp/boot.img", "-o", "/tmp/"); run_program("/tmp/mkbootimg.sh"); run_program("/tmp/newboot.img", "boot");
> ```


I tried that script, but got the same mount error, so I changed it to mount("ext4", "MTD", "system", "/system");

Now it goes through the whole process, but the kernel version still hasn't changed. On the bright side, the WiFi's broken, which means that it's at least doing SOMETHING...


----------



## imnuts (Jun 9, 2011)

Look at /cache/recovery/log while in recovery to see if any errors show up from the mkbootimg.sh script, or any other step. I would guess that something is failing in that part to cause the issue.


----------



## patrick (Jul 25, 2011)

imnuts said:


> Look at /cache/recovery/log while in recovery to see if any errors show up from the mkbootimg.sh script, or any other step. I would guess that something is failing in that part to cause the issue.




```
<br />
Starting recovery on Fri Mar  9 02:09:16 2012<br />
can't open /dev/tty0: No such file or directory<br />
framebuffer: fd 3 (1024 x 600)<br />
ioctl(): blank: Invalid argument<br />
ioctl(): blank: Invalid argument<br />
ClockworkMod Recovery v5.8.1.5<br />
recovery filesystem table<br />
=========================<br />
  0 /tmp ramdisk (null) (null) 0<br />
  1 /recovery emmc /dev/block/mmcblk0p21 (null) 0<br />
  2 /boot emmc /dev/block/mmcblk0p22 (null) 0<br />
  3 /system ext4 /dev/block/mmcblk0p26 (null) 0<br />
  4 /misc ext4 /dev/block/mmcblk0p29 (null) 0<br />
  5 /data ext4 /dev/block/mmcblk0p30 (null) 0<br />
  6 /cache ext4 /dev/block/mmcblk0p31 (null) 0<br />
  7 /sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 0<br />
  8 /emmc vfat /dev/block/mmcblk0p36 (null) 0<br />
[URL=W:Unable]W:Unable[/URL] to get recovery.fstab info for /datadata during fstab generation!<br />
[URL=W:Unable]W:Unable[/URL] to get recovery.fstab info for /sd-ext during fstab generation!<br />
[URL=I:Completed]I:Completed[/URL] outputting fstab.<br />
[URL=I:Processing]I:Processing[/URL] arguments.<br />
[URL=E:unknown]E:unknown[/URL] misc partition fs_type "ext4"<br />
[URL=I:Checking]I:Checking[/URL] arguments.<br />
I:device_recovery_start()<br />
Command: "/sbin/recovery"<br />
ro.secure=1<br />
ro.allow.mock.location=0<br />
ro.debuggable=1<br />
persist.sys.usb.config=adb<br />
ro.build.id=MR1<br />
ro.build.display.id=full_express-userdebug 4.0.3 MR1 eng.koush.20120205.152652 test-keys<br />
ro.build.version.incremental=eng.koush.20120205.152652<br />
ro.build.version.sdk=15<br />
ro.build.version.codename=REL<br />
ro.build.version.release=4.0.3<br />
ro.build.date=Sun Feb  5 15:27:21 PST 2012<br />
ro.build.date.utc=0<br />
ro.build.type=userdebug<br />
ro.build.user=koush<br />
ro.build.host=Koushik-Lion.local<br />
ro.build.tags=test-keys<br />
ro.product.model=Full Android on Emulator<br />
ro.product.brand=Android<br />
ro.product.name=full_express<br />
ro.product.device=express<br />
ro.product.board=express<br />
ro.product.cpu.abi=armeabi-v7a<br />
ro.product.cpu.abi2=armeabi<br />
ro.product.manufacturer=unknown<br />
ro.product.locale.language=en<br />
ro.product.locale.region=US<br />
ro.wifi.channels=<br />
ro.board.platform=msm-7x30<br />
ro.build.product=express<br />
ro.build.description=full_express-userdebug 4.0.3 MR1 eng.koush.20120205.152652 test-keys<br />
ro.build.fingerprint=Android/full_express/express:4.0.3/MR1/eng.koush.20120205.152652:userdebug/test-keys<br />
ro.build.characteristics=default<br />
ro.cm.device=express<br />
keyguard.no_require_sim=true<br />
ro.com.android.dateformat=MM-dd-yyyy<br />
ro.config.ringtone=Ring_Synth_04.ogg<br />
ro.config.notification_sound=pixiedust.ogg<br />
ro.config.alarm_alert=Alarm_Classic.ogg<br />
ro.ril.hsxpa=1<br />
ro.ril.gprsclass=10<br />
dalvik.vm.lockprof.threshold=500<br />
net.bt.name=Android<br />
net.change=net.bt.name<br />
dalvik.vm.stack-trace-file=/data/anr/traces.txt<br />
ro.factorytest=0<br />
ro.serialno=HT16THY01495<br />
ro.bootmode=recovery<br />
ro.baseband=1.05.01.1006_3<br />
ro.carrier=COMMON<br />
ro.bootloader=1.14.0005<br />
ro.hardware=express<br />
ro.revision=0<br />
ro.emmc=1<br />
init.svc.recovery=running<br />
service.adb.root=1<br />
init.svc.adbd=running<br />
[URL=I:Checking]I:Checking[/URL] for extendedcommand...<br />
[URL=I:Running]I:Running[/URL] extendedcommand...<br />
Waiting for SD Card to mount (20s)<br />
SD Card mounted...<br />
Verifying SD Card marker...<br />
f3d1f5ad47bcb74cd201451911bf5d1a<br />
[URL=I:Running]I:Running[/URL] script:<br />
I:<br />
ui_print("ROM Manager Version 5.0.0.6");<br />
ui_print("March 8, 2012");<br />
ui_print("Preparing to install ROM...");<br />
assert(install_zip("/sdcard/test17.zip"));<br />
parse returned 0; 0 errors encountered<br />
ROM Manager Version 5.0.0.6<br />
March 8, 2012<br />
Preparing to install ROM...<br />
-- Installing: /sdcard/test17.zip<br />
Finding update package...<br />
[URL=I:Update]I:Update[/URL] location: /sdcard/test17.zip<br />
Opening update package...<br />
Installing update...<br />
AnyKernel Updater by Koush.mount: no mtd partition named "system"minzip: Extracted file "/system/lib/modules/bcm4329.ko"<br />
unmount of /system failed; no such volume<br />
minzip: Extracted file "/tmp/dump_image"<br />
minzip: Extracted file "/tmp/mkbootimg"<br />
minzip: Extracted file "/tmp/mkbootimg.sh"<br />
minzip: Extracted file "/tmp/unpackbootimg"<br />
Extracting System Files...<br />
minzip: Extracted file "/tmp/zImage"<br />
about to run program [/tmp/dump_image] with 3 args<br />
Extracting Kernel files...<br />
about to run program [/tmp/unpackbootimg] with 5 args<br />
Usage:<br />
unpackbootimg <boot.img><br />
unpackbootimg <boot.img> <output_directory><br />
about to run program [/tmp/mkbootimg.sh] with 1 args<br />
cat: can't open '/tmp/boot.img-cmdline': No such file or directory<br />
cat: can't open '/tmp/boot.img-base': No such file or directory<br />
Installing kernel...usage: mkbootimg<br />
	   --kernel <filename><br />
	   --ramdisk <filename><br />
	   [ --second <2ndbootloader-filename> ]<br />
	   [ --cmdline <kernel-commandline> ]<br />
	   [ --board <boardname> ]<br />
	   [ --base <address> ]<br />
	   -o|--output <filename><br />
run_program: child exited with status 1<br />
about to run program [/tmp/newboot.img] with 2 args<br />
run_program: execv failed: No such file or directory<br />
run_program: child exited with status 1<br />
script result was [Done!]<br />
Done!<br />
Install from sdcard complete.<br />
result is []<br />
```
I got that, hopefully you're better at reading this than I am...


----------



## Racing19969 (Dec 1, 2011)

AnyKernel Updater by Koush.mount: no mtd partition named "system"minzip: Extracted file "/system/lib/modules/bcm4329.ko"
unmount of /system failed; no such volume

This is where your error is. you system is not mtd format. Try using ext4 instead of MTD and see if that fixes your problem.


----------



## patrick (Jul 25, 2011)

Racing19969 said:


> AnyKernel Updater by Koush.mount: no mtd partition named "system"minzip: Extracted file "/system/lib/modules/bcm4329.ko"
> unmount of /system failed; no such volume
> 
> This is where your error is. you system is not mtd format. Try using ext4 instead of MTD and see if that fixes your problem.


I changed mount to this "mount("ext4", "EMMC", "system", "/system");

Now the output of the log is this:

```
<br />
-- Installing: /emmc/test21.zip<br />
Finding update package...<br />
[URL=I:Update]I:Update[/URL] location: /emmc/test21.zip<br />
Opening update package...<br />
Installing update...<br />
mount: failed to mount system at /system: Block device required<br />
AnyKernel Updater by Koush.minzip: Extracted file "/system/lib/modules/bcm4329.ko"<br />
unmount of /system failed; no such volume<br />
minzip: Extracted file "/tmp/dump_image"<br />
minzip: Extracted file "/tmp/mkbootimg"<br />
minzip: Extracted file "/tmp/mkbootimg.sh"<br />
minzip: Extracted file "/tmp/unpackbootimg"<br />
minzip: Extracted file "/tmp/zImage"<br />
about to run program [/tmp/dump_image] with 3 args<br />
Extracting System Files...<br />
Extracting Kernel files...about to run program [/tmp/unpackbootimg] with 5 args<br />
Usage:<br />
unpackbootimg <boot.img><br />
unpackbootimg <boot.img> <output_directory><br />
about to run program [/tmp/mkbootimg.sh] with 1 args<br />
cat: can't open '/tmp/boot.img-cmdline': No such file or directory<br />
cat: can't open '/tmp/boot.img-base': No such file or directory<br />
usage: mkbootimg<br />
	   --kernel <filename><br />
	   --ramdisk <filename><br />
	   [ --second <2ndbootloader-filename> ]<br />
	   [ --cmdline <kernel-commandline> ]<br />
	   [ --board <boardname> ]<br />
	   [ --base <address> ]<br />
	   -o|--output <filename><br />
run_program: child exited with status 1<br />
about to run program [/tmp/newboot.img] with 2 args<br />
run_program: execv failed: No such file or directory<br />
run_program: child exited with status 1<br />
script result was [Done!]<br />
Installing kernel...<br />
Done!<br />
Install from sdcard complete.<br />
result is []<br />
```


----------



## imnuts (Jun 9, 2011)

Remove the following from your mkbootimg.sh script on line 3 and try again

```
--cmdline \"$(cat /tmp/boot.img-cmdline)\" --base $(cat /tmp/boot.img-base)
```


----------



## patrick (Jul 25, 2011)

imnuts said:


> Remove the following from your mkbootimg.sh script on line 3 and try again
> 
> ```
> --cmdline \"$(cat /tmp/boot.img-cmdline)\" --base $(cat /tmp/boot.img-base)
> ```


Now we have this:

```
<br />
-- Installing: /emmc/test22.zip<br />
Finding update package...<br />
[URL=I:Update]I:Update[/URL] location: /emmc/test22.zip<br />
Opening update package...<br />
Installing update...<br />
AnyKernel Updater by Koush.mount: failed to mount system at /system: Block device required<br />
minzip: Extracted file "/system/lib/modules/bcm4329.ko"<br />
unmount of /system failed; no such volume<br />
minzip: Extracted file "/tmp/dump_image"<br />
minzip: Extracted file "/tmp/mkbootimg"<br />
minzip: Extracted file "/tmp/mkbootimg.sh"<br />
minzip: Extracted file "/tmp/unpackbootimg"<br />
Extracting System Files...minzip: Extracted file "/tmp/zImage"<br />
about to run program [/tmp/dump_image] with 3 args<br />
Extracting Kernel files...about to run program [/tmp/unpackbootimg] with 5 args<br />
Usage:<br />
unpackbootimg <boot.img><br />
unpackbootimg <boot.img> <output_directory><br />
about to run program [/tmp/mkbootimg.sh] with 1 args<br />
error: could not load ramdisk '/tmp/boot.img-ramdisk.gz'<br />
run_program: child exited with status 1<br />
about to run program [/tmp/newboot.img] with 2 args<br />
run_program: execv failed: No such file or directory<br />
run_program: child exited with status 1<br />
script result was [Done!]<br />
Installing kernel...<br />
Done!<br />
Install from sdcard complete.<br />
result is []<br />
```


----------



## imnuts (Jun 9, 2011)

If you have adb access in recovery, I would boot into recovery, push the files you're unpacking to /tmp and set permissions on them, then run each command manually via adb shell, checking that the required files show up in /tmp after each command. Something isn't working properly the way it looks, possibly with unpackbootimg based on the log, and that is why it isn't creating and flashing the new boot.img.


----------

