1. Are you ready for the Galaxy S20? Here is everything we know so far!

Prevail Kernel Ramdisk Packer

Discussion in 'Android Devices' started by hroark13, Sep 8, 2011.

  1. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    We can not compile a bootable kernel zImage yet, but we can mod the kernel ramdisk.

    I created some tools for repacking a zImage and ramdisk, so that others besides Shabby and myself can release Kernels, who knows, maybe some of you can come up with some creative mods.

    My tool can create an Odin or ClockWorkMod flashable kernel.

    You have to have Linux, the Android SDK and all packages required for the Android SDK
    You also need Python 2.7, newer versions of Pyhton tend to have problems with the Android SDK


    Download and unzip the kpack.zip file to your /home/"user" folder

    Examples

    To Create an Odin flashabe ShabbyKernel RC1 tar file
    Open terminal
    cd /home/"user"/kpack
    ./odinkrnl.pl shabby-rc1

    you will now have a odinkrnl.tar file in the kpack folder that you could copy to a Windows computer and flash with Odin

    To Create a CWM flashabe Hroarkernel 1.2 zip file
    Open terminal
    cd /home/"user"/kpack
    ./cwmkrnl.pl hroark-12

    you will now have a cwmkrnl.zip file in the kpack folder that you could copy to sdcard and flash with cwm

    To Create a CWM flashabe EE14 stock kernel zip file
    Open terminal
    cd /home/"user"/kpack
    ./cwmkrnl.pl stock-ee14

    you will now have a cwmkrnl.zip file in the kpack folder that you could copy to sdcard and flash with cwm

    To Create your own version of an Odin flashabe Kernel tar file
    Copy the contents of either the hroark-12, shabby-rc1, or stock-ee14 into a new folder called myramdisk

    Make your changes to the files or add modules or whatever the hell you want.
    Remember that the ramdisk has a size limit, so you can not add too many modules

    Open terminal
    cd /home/"user"/kpack
    ./odinkrnl.pl myramdisk

    you will now have a odinkrnl.tar file in the kpack folder that you could flash with Odin

    To Create your own version of a CWM flashabe Kernel zip file
    Copy either the hroark-12, shabby-rc1, or stock-ee14 folders into a new folder called myramdisk

    Make your changes to the files or add modules or whatever the hell you want.
    Remember that the ramdisk has a size limit, so you can not add too many modules

    Open terminal
    cd /home/"user"/kpack
    ./cwmkrnl.pl myramdisk

    you will now have a cwmkrnl.zip file in the kpack folder that you could copy to sdcard and flash with cwm

    [​IMG]

    MEGAUPLOAD - The leading online storage and file delivery service
     

    Advertisement

  2. blue2107

    blue2107 Well-Known Member

    Even with that detailed description I have no clue on how to use this, but hopefully someone else does. I'm sure it will prove very useful in the near future

    Thanks for the release and I appreciate your hard work
     
    hroark13 likes this.
  3. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    as long as someone has Linux, this should be pretty straight foward for them
     
  4. inigomontoyasr

    inigomontoyasr Android Enthusiast

    anything i should absolutely not tamper with in here? mount points?
     
  5. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    i am sure there are a lot of things that can kill the phone, like if you try to overclock it or something
     
    inigomontoyasr likes this.
  6. inigomontoyasr

    inigomontoyasr Android Enthusiast

    nothing so radical. just want to see how it's done and do it.

    trying with the included shabby-rc1 has me held up at this
    zImage is there
    mkbootimg is there and executable
    ramdisk-repack.gz gets created and removed
    boot.img not created so i understand cannot start no such file~ and exiting with failure~
    so i copy one there to see what happens.
    Code (Text):
    1. Can't exec "./mkbootimg": No such file or directory at ./odinkrnl.pl line 20.
    script then completes without further error which again i understand but that line now looks complete to me. gave the same result with other folders.
    what more does line 20 need?
     
  7. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    i think we either need to add the folder that has mkbootimg to your path or you can copy mkbootimg to your /bin folder
     
    inigomontoyasr likes this.
  8. inigomontoyasr

    inigomontoyasr Android Enthusiast

    added kpack folder location to path, nothing changed. copied to /bin, nothing. copied to usr/local/bin, nothing. been reading around but can't figure out what next step is.

    edit: could that file be corrupt? downloading again
    ed2: same.
     
  9. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter


    what version of linux are you using, do you have Python installed and if so what version
     
  10. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    can you try changing this line in the odinkrnl.pl or cwmkrnl.pl

    system ("./mkbootimg --kernel zImage --ramdisk ramdisk-repack.gz -o boot.img --base 0x13000000 --pagesize 4096");

    to this

    system ("$dir/mkbootimg --kernel zImage --ramdisk ramdisk-repack.gz -o boot.img --base 0x13000000 --pagesize 4096");
     
  11. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    after thinking about for a while, I think it may be a permissions issue with that file, but I am not 100 percent certain, we need a Linux guru in here

    edit

    maybe try

    chmod 755 /home/"user"/mkbootimg
     
  12. inigomontoyasr

    inigomontoyasr Android Enthusiast

    ubuntu 11.04 and Python 3.1 installing slackware now cause i read somewhere if you learn ubuntu you learn ubuntu but if you learn slackware you learn linux and i'm eager to learn.

    same error with full path instead of ./mkb~

    i'd chmod-ed the whole folder 777 before i posted the first error because i had that thought. i'll try again as 755 but..*shrug*
     
  13. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    well I did setup my system as an Adroid development system and installed alot of packages

    i am running Ubuntu 11.4 64 bit and have Python 2.7
    i remember when I was setting up this system that I had to downgrade python to 2.7 for it to work with the Android SDK or something

    the mkbootimg file is part of the Android SDK, the mkbootimg file in my zip file is an older version

    so I am thinking maybe a required package for the mkbootimg file is not installed and I am not sure which package it is, or the newer version of Python can be the culprit

    did you try running it as root
    sudo su

    ?
     
  14. inigomontoyasr

    inigomontoyasr Android Enthusiast

    i installed the the sdk and bang. i should've thought of that earlier but i have it on the Windows machine so i figured i could shuttle files back and forth. it didn't say to use 2.7 so i left it alone and the kernel flashed fine. now to modify.
     
  15. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    I will edit the OP and mention that the SDK is needed

    so the original ummodified scripts are running right?
     
  16. inigomontoyasr

    inigomontoyasr Android Enthusiast

    the kernels i made first wouldn't boot.
    i downgraded to pyton 2.7 and they boot.

    yes your original scripts are working. i removed the kpack folder and redownloaded the zip to be sure i was using it the way you wrote it up

    also i simply removed 'disabled' from shabbykernel's init.d lines and it works with S##script now. i don't know if that's an error on my part but it seems there are no adverse affects.
     
  17. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    I will edit the OP again and mention Python 2.7
    Shabby's RC1 kernel and mine do init.d totally different, I am not sure which is better, and I dont think it matters too much.

    are only S## scripts running or can the script be any name now

    I made the repacker so that curious people like yourself can mess around with it and learn, and maybe come up with some creative mods
     
  18. new optimus

    new optimus Android Expert

    I did some messing around, just testing and was able to pack shabby, yours, and a hodgepodge of the 2 with no problem.

    Though I have been attempting to build my own ext4 kernel and it fails with permission denied on dbus and ends up in a boot loop. I found that using adb logcat after getting frustrated with it.

    course this was trying to make a odin flashable working setup.I tried cwm flashable but it would abort every time.
    I think im just a bit over my head and more trial an error is needed, I wish I had a second phone as I hate resetting mine up, and the down time. lol I had my phone in an unusable state all day today I think. And I thought I royally bricked it today
    odin was stuck at data.rfs for 16 mins and so I just closed it. took some doing to get it back up and going.

    on a good note, for me anyway, I was able to piece together a odin flashable ext4 with new cwm recovery with working usb storage and my apps the way I want them with my theme.
     
  19. inigomontoyasr

    inigomontoyasr Android Enthusiast

    shabbykernel init.d will now execute script of any name. no letters or numbers required.
    i took a few hints and the modules from hk12 and put a kernel together that uses shabby init.d method, mounts ext4, doesn't require install-recovery.sh and has v6 agressive minfrees default. a few more tweaks and i may post it for others to try.
    i'm an auto mechanic and machine fabricator by trade and my motto is less moving parts makes life easier so i like the init.d in shabby's for not referencing another script. just personal preference. both ways work fine.
    i don't understand how his orders the scripts but i think i will over time.

    thanks again for this. i'm only ~six weeks into experience with modifying android and a few days with linux pc but i feel like i can learn in leaps. i've been looking at code and script from other phones to see what's different. i may have discovered a new hobby.

    new op, i've found, while making a2sd work, that the ext4 rom doesn't like bml mount in cwm scripts. that's why the ext4 rom is the only one you need to manually mount partitions for the installer now. i know what you mean about downtime. i have a broken one from a friend i've been using to test things. he tried to rig up an external antenna and broke the cell radio. wifi still works though so i just don't know if anything i do has an affect on reception until i flash it to MY phone. handy.

    can't wait to get another phone to start doing all this again.
     
  20. new optimus

    new optimus Android Expert

    Nice job, I would love to have a look at what you did.

    I have been so busy looking at the code and trying this and trying that. Most of what I can do is just from looking at what someone else has done and modifiing to suit me.

    by the way I found a script to set the sd card read ahead cache place it in init.d and it will set it you dont have to have an app to do it and the benefit is its set before the screen is up and ready. I have a class 10 card and having the read ahead set to 3072 is very handy.
    I tried building it into the kernel, in init.rc but it never worked, even when the kernel still booted. tried with hroarks and with shabby's and both booted after but no change in read ahead.
    Code (Text):
    1. #!/system/bin/sh
    2. if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]
    3.   then
    4.     /system/xbin/echo "3072" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
    5. fi;
    6.  
    for hroarks I named mine S77sdcardspeedfix
    chose that to not interfere with other scripts
     
  21. new optimus

    new optimus Android Expert

    I just looked through the shabby kernel I am very curious why init.d was disabled by default.
    I am going to look at it some more.
     
  22. hroark13

    hroark13 Android Expert
    Recognized Developer Thread Starter

    the 2 modules needed for ext4 support are the ext4.ko and the jb2.ko

    those two modules that came with my kernel are for this phone, I was able to compile them with the kernel source code for this phone

    you can compile other kernel modules for this phone if you dowload the source code, you probably will not be able to compile a bootable zImage, but should be able to do some modules, but as I said berfore, we are working with a size limit, i did compile the ext3.ko and jbd.ko but when i added them to the ramdisk it was too big
     
  23. new optimus

    new optimus Android Expert

    I have 2 questions, now that I see this new info.

    First the jbd.ko for ext4 wont work with ext3?

    for example if you want ext3 and ext4 could you just use the one jbd.ko?

    and second from the way you say it became too big is it because of the 2 extra .ko modules? or would even one make it too big?

    Can you upload the compiled ext3 that you have I would like to look at a few things.

    There might be other areas to trim down maybe.
     
  24. new optimus

    new optimus Android Expert

    Well I found out why they do them differently.

    I also found why hroarks require S* to boot.

    In Shabbys init.rc has this line

    Code (Text):
    1. service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
    2.     enable
    3.     oneshot
    Which if im not mistaken, (and I sure could be) init.d is called by busybox as part of the addons in something like android kitchen.
    and hroarks uses a script

    Code (Text):
    1. #!/tmp/busybox sh
    2.  
    3. if cd /system/etc/init.d >/dev/null 2>&1 ; then
    4.     for file in S* ; do
    5.         if ! ls "$file" >/dev/null 2>&1 ; then continue ; fi
    6.         /system/bin/sh "$file"
    7.     done
    8. fi
    9.  
    10.  
    also from busybox but in a tmp location, more of a hack on I guess you may call it. and as you can see the script calls for S* in order to run.
     
  25. inigomontoyasr

    inigomontoyasr Android Enthusiast

    that's not the shabby's init.rc i have. the one i downloaded in kpack has disable oneshot after the sysinit line. or is that your edit?
     
Loading...

Share This Page

Loading...