[Guide] - How to compile the CDMA kernel source and Flash it to your phone (Updated) - Hero CDMA Android Development

You should do a nandroid backup and reboot your phone before trying to flash anything to your phone. This how to involves flashing directly to mtd2, if you don't know what you are doing then please use one of the custom roms available in the Sticky Wiki.
#### Update One Fixed scripts
#### Update Two Added instructions to compile and install the wlan.ko module
#### Update Three Fixed get-CDMAHero-source.sh typo
#### Update Four Added Instructions for Jaunty repo's for Ubunut 9.10
First off i would like to give credit to all the people who have made information and scripts available. I used bits and peices of info and tools written by and or made available by these people.
Armin Coralic http://blog.coralic.nl for creating some nice scripts and making them available
chuckhriczko for helping me out in the middle of the night.
LoxDev for creating a wonderfull how to about creating img's and zip's
tkirkton for helping out with enabling legacy jaunty repos to install java 1.5
Second I am writing this How To, so a complete newbie would be able to understand.
REQUIREMENTS....
Ubuntu Desktop 9.04 or better 32bit (cause thats what i used)
Android SDK (Needed to push and pull files as well as shell access to the phone. You will need to set this up by following the instructions found at http://www.android.com)
Legacy repo's enabled in apt to allow java 1.5 to install
Root access. I ran all commands below as root
I created a dir called "heroc" in my /root directory.
Download zip file below and unzip it in the heroc dir that you should have created.
STEPS
.5 Enable Legacy Repo's to allow java 1.5 to install (below is a cut from tkirktons post on page 7)
Code:
in Ubuntu 9.10, the Java 1.5 package doesn't even list. Here's what I had to do to get it to load:
1. Access a repository from the previous build (9.04 Jaunty will work: commands to put into /etc/apt/sources.list -
deb [URL]http://mirrors.us.kernel.org/ubuntu[/URL] jaunty main restricted universe multiverse
deb [URL]http://mirrors.us.kernel.org/ubuntu[/URL] jaunty-backports main restricted universe multiverse
deb [URL]http://mirrors.us.kernel.org/ubuntu[/URL] jaunty-security main restricted universe multiverse
deb [URL]http://mirrors.us.kernel.org/ubuntu[/URL] jaunty-updates main restricted universe multiverse
2. Set the max age higher than the default. This can be accomplished by editing the /etc/apt/apt.conf.d/20archive. Here's what my lines in that file look like:
APT::Archives:MaxAge "2880";
APT::Archives:MinAge "2";
APT::Archives:MaxSize "1000";
Making these two changes should work...although I have the Intrepid, Hardy and Dapper repositories in mine as well (didn't know which one would work, so I overkilled it).
Run the script again after making the changes and let me know if it works.
.
to update just run
Code:
# apt-get update
1. Create your work environment by running createandroidRepo.sh. This will take some time depending on your internet connection. Make sure you are in the heroc dir.
Code:
# unzip Scripts.zip
# chmod a+x *
# ./createAndroidRepo.sh
This will create a dir call my android and setup all the files and programs needed to compile the kernel. This will take some time to complete.
2. You need to download the source using the get-CDMAHero-source.sh
Code:
# ./get-CDMAHero-source.sh
This will download the source, and extract it to its own directory.
3. you will need to have your .config file handy for the next steps. If you don't have it then you will need to get it by doing the following
Code:
# adb pull /proc/config.gz /root/heroc/config.gz
# gunzip config.gz
The first command will pull the gzipped config from your phone and place it into the heroc dir. the second command will extract the file as "config"
4. This is where it gets fun. We now have everything downloaded and are going to start the process of compiling our kernel.
Code:
# cd heroc_ef05d31a
# export ARCH=arm
# export CROSS_COMPILE=arm-eabi-
# export PATH=$PATH:~/heroc/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin
# make menuconfig
After you run "make menuconfig" it will bring up a the config menu for our kernel. Go to the bottom and select "Load an alternate configuration file". It will then prompt you to select the config file you want to use. You will need to point it to where you have the config file. So type in "/root/heroc/config"
After you have loaded the config file you can edit what ever you want. however if you don't know what do disable or enable then i wouldn't mess around to much.
Next you will need to save your config file. Choose "Save an alternate configuration file", and save it as "/root/heroc/heroc_ef05d31a/.config"
You can now exit menuconfig
5. Time To Compile the kernel and wlan.ko module
Code:
# make
# export KERNEL_DIR=/root/heroc/heroc_ef05d31a/
# cd myandroid/system/wlan/ti/sta_dk_4_0_4_32/
# make
The kernel will take some time. go grab a drink and have a snack. If all goes well you should end up with a zImage file in "~/heroc//arch/arm/boot/". After the kernel is compiled you need to compile the wlan.ko module by executing the last three commands
6. Next we need to copy the zImage back to the heroc dir
Code:
# cp /root/heroc/heroc_ef05d31a/arch/arm/boot/zImage /root/heroc/zImage
7. Ok so now we need to get the boot image from our phone. We need this cause it has more than just the kernel. I contains the ramdisk image as well. and we need to take the boot image and decompress it and remove the old kernel and add our new compiled kernel, then recompress it to newboot.img
Code:
# adb shell
# cat /dev/mtd/mtd2 > /sdcard/mtd2.img
# exit
# adb pull /sdcard/mtd2.img /root/heroc/mtd2.img
# mv mtd2.img boot.img
The first two commands will open a terminal shell to your phone and copy the boot image to your sdcard. the last two commands will pull the the boot image from your phone, place it in your heroc dir and rename the file to boot.img
8. Now we will split apart the boot.img using some scripts.
Code:
# ./extract-kernel.pl boot.img
# ./extract-ramdisk.pl boot.img
# rm boot.img-kernel
# cp zImage boot.img-kernel
# ./mkbootfs boot.img-ramdisk | gzip > ramdisk-boot
# ./mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-boot --cmdline "no_console_suspend=1 console=null" -o newBoot.img --base 0x19200000
The first command extracts the stock kernel from boot.img. The second command extracts the ramdisk from boot.img. The third command will delete the stock kernel. the fourth command renames our zImage to boot.img-kernel. The fifth command takes boot.img-ramdisk folder and zips it up into ramdisk-boot. The sixth comand takes our kernel (renamed to "boot.img-kernel") and ramdisk-boot and combines it back to form a new file called newboot.img.
9. Now we need to flash our "newboot.img" file to our phone. You should reboot your phone before flashing this will insure that you don't get any out of memory errors and will keep your phone from booting into fastboot (Thx Obelisk79).
Code:
# adb push newBoot.img /sdcard/newBoot.img
# adb shell
# cat /dev/zero > /dev/mtd/mtd2 (you may get an error here. don't worry about it)
# flash_image boot /sdcard/newBoot.img
# reboot
The first command will push your boot image to the phone. the second command will bring up shell access to your phone. the third command will zero out mtd2 and get it ready to write your image. the fourth command will flash boot(mtd2) with newboot.img. the last command will reboot your phone
10. After the phone reboots we need to get the wlan.ko file to the phone so that wireless will work
Code:
# adb push /root/myandroid/system/wlan/ti/sta_dk_4_0_4_32/wlan.ko /sdcard/wlan.ko
# adb shell
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# cp /sdcard/wlan.ko /system/lib/modules/wlan.ko
# exit
Now you have a kernel that you compiles with everything work with the exception of power mgmt.

Just as soon as i figure out how to make an update.zip i will post instructions on how to do this

Added it to the CDMA Hero Guides wiki article.

gu1dry said:
Added it to the CDMA Hero Guides wiki article.
Click to expand...
Click to collapse
dang you beat me to it.

Not sure why, but had to run dos2unix on the the first script, not sure if it is all of them, but it was giving me the error
/bin/bash^M: bad interpreter: No such file or directory
Click to expand...
Click to collapse
dos2unix took care of the issue. Also Thanks for the guide, greatly appreciated!!!

make sure you run the script with the "./" , also you may need to chmod +x the files.

Is there a way to get this to run on the Emulator? I tried to specify the zImage after I compiled it but it won't boot when specifying it. Or will that not work for the HTC zImage?

Excellent guide. Can't wait to try it.

blehzz said:
Is there a way to get this to run on the Emulator? I tried to specify the zImage after I compiled it but it won't boot when specifying it. Or will that not work for the HTC zImage?
Click to expand...
Click to collapse
Check out this link

Check out this link
Click to expand...
Click to collapse
Thanks will have a look. Seems to be the Android kernel and not the HTC kernel though, but will read further into it

blehzz said:
Thanks will have a look. Seems to be the Android kernel and not the HTC kernel though, but will read further into it
Click to expand...
Click to collapse
not sure but i think this will work for you
Code:
# emulator -kernel /path/to/your/zImage

First script didn't work for me on ubuntu. Copying and pasting line by line works.

i'll repack the scripts again

not sure but i think this will work for you
Click to expand...
Click to collapse
that's what i tried... emulator never runs when i specify that zImage it built successfully.

Has anybody tried this yet with Ubuntu running under VMware on a PC running Windows? I know that (in theory) VMware's USB compatibility is spectacularly good (it somehow manages to give the guest OS direct ownership and control of the host PC's USB root hub), but up to now I've only tried it to run XP/32 under Vista/64 and Windows 7/64.
FYI, you can download VMware player for free (as in beer) and use it to run Ubuntu 9.04 with their complete blessing. Just make sure you download a guest OS that configures the hardware (memory, cpu, etc) the way you want it to be, because changing the hardware config is one of the few things you genuinely can't do with the free player. If someone here has the full version (and can find somewhere to host it so the bandwidth charges didn't eat him alive), he could even create an Ubuntu distro that's already set up and configured to build Android kernels for others here to download and use.

To use the first script: open up Synaptics, then download "tofromdos". Now, run "fromdos createAndroidRepo.sh", and it should work then

ROM?
Can someone post how to compile a kernel, and make a ROM, and put it all together in a update.zip? Would be really REALLY nice!
Jason(bikcmp)

Thanks for this guide I'm compiling a kernel right now Just a question, how do I change the kernel version name... like you did in that one screenshot?

bikcmp said:
Can someone post how to compile a kernel, and make a ROM, and put it all together in a update.zip? Would be really REALLY nice!
Jason(bikcmp)
Click to expand...
Click to collapse
Its coming

bikcmp said:
Can someone post how to compile a kernel, and make a ROM, and put it all together in a update.zip? Would be really REALLY nice!
Jason(bikcmp)
Click to expand...
Click to collapse
its in general options in menuconfig.

Related

[HOW-TO] ROM-HACKING: init.rc ext2-auto-mount / ROM Signing / ROM Kitchen

AS MENTIONED IN THE INTRODUCTION TEXT THIS HAS ONLY BEEN TESTED ON AMON RA ROM 1.6.2 BUT SHOULD REALLY WORK ON ANY ROM THAT HAS NO EXT2 AUTO-MOUNT. AND YEAH THIS WHOLE PROCESS HAS BEEN DONE ON A 32a BOARD. FOR THOSE THAT TRY THIS ON OTHER ROMS LET ME KNOW HOW IT GOES.
I've searched and shuffled through the entire forum and made inquiries to ROM authors without much light being shed on this issue. I doubt I am the only one who has been looking for a way of doing this so I decided to do a small HOW-TO. Here I will explain step by step as to how you can implement a script to be part of your ROM that will auto mount an ext2 partition on boot up if such partition is present. I have included all the tools I've used in order to pull this off, and as the title suggests this has only been done on Amon Ra's latest 1.6.2 ROM. In order to follow these instructions you are expected to allready have set up an adb enviroment on your linux box and for the signing process to work you must have sun-java present, the gnu java wont work. And of course a microSD card with an ext2 partition
1. Download install.sh to your home directory
Code:
wget http://www.grindhouse.no/androidtools/install.sh
chmod a+x install.sh
2. Now execute the install.sh script which will create a directory to work in and download a tool and script package and unpack it.
Code:
./install.sh
When the install.sh script is done you need to move the mkbootimg preferebly to your tools directory of your SDK.
Code:
mv toolstomove/mkbootimg <path/to/sdk/tools/mkbootimg>
3. Unpack the RA1.6.2 ROM into a directory in your home dir. In this HOW-TO we will use directory name "ra1.6.2" as an example through out the entire process.
4. Copy the boot.img from ra1.6.2 to the ROM-cooker dir
Code:
cp $HOME/ra1.6.2/boot.img $HOME/ROM-cooker/boot.img
cd $HOME/ROM-cooker
5. Use unpack.pl to extract the ramdisk from the boot image. I've modified the script a little so it automates the entire process and decompresses the ramdisk to a directory
Code:
./unpack boot.img
6. Now you can either replace the init.rc file here with the one I've included in this package or you can add these lines by yourself. In wich case do the following
Code:
cd boot.img-ramdisk
pico init.rc
Press CTRL+w and then CTRL+t and input 27. hit enter. This will take you to line 27 of init.rc so you can add a line right before the init process remounts the rootfs in read-only mode. Add following line:
Code:
mkdir /sdext2 0771 system system
Now scroll down to the end of the init.rc file and add the following:
Code:
service mountsdext2 /system/bin/mountsd
user root
group root
oneshot
7. You have now edited (or replaced) your init.rc file and prepared it to execute a script on boot that will detect an ext2 partition and boot it if there is one to be found. Now you have to make the mountsd script a part of the ROM. Do the following:
Code:
cd $HOME/ROM-cooker
mv toolstomove/mountsd $HOME/ra1.6.2/system/bin/mountsd
rm -rf toolstomove
8. Now that the init.rc file is sorted out and mountsd has been placed in /system/bin of the ROM so it is time to re-pack the boot.img:
Code:
cd $HOME/ROM-cooker
./repack boot.img-kernel boot.img-ramdisk boot.img
rm $HOME/ra1.6.2/boot.img
mv boot.img $HOME/ra1.6.2/boot.img
9. Your ROM now has a new boot image with an updated init.rc and the /system/bin dir has the script needed to auto-mount the microsd ext2. Now you must re-zip the ROM and sign it. Do the following:
Code:
cd $HOME/ra1.6.2
zip -r update.zip *
mv update.zip $HOME/ROM-cooker/update.zip
cd $HOME/ROM-cooker
./sign.pl update.zip
10. The ROM is now signed and you now have a file called update-signed.zip. Connect the phone to your computer and execute thus:
Code:
./push update-signed.zip
11. Now you are ready to flash the modified ROM which will auto-mount an ext2 partition on your microSD. There is no need to wipe before flashing. If you have no prior experience with ROM flashing or whatever just backup your current install. If you're using OpenHOME or anything similar, nothing will be changed or damaged but if you're using MontAlbert's themes with the ROM you will have to flash them again after flashing this modified ROM.
Code:
adb reboot recovery
12. Flash from choose zip and of course choose update-signed.zip. Reboot. After the system boots up again you can now check whats what with either one of the commands:
Code:
[email protected]:~$ adb shell mount | grep sdext2
/dev/block/mmcblk0p2 on /sdext2 type ext2 (rw,noatime,nodiratime,errors=continue)
[email protected]:~/boot$ adb shell busybox df -h | grep sdext2
/dev/block/mmcblk0p2 893.7M 13.0K 846.0M 0% /sdext2
13. Voila! Your RA 1.6.2 ROM now detects and mounts your microSD ext2 partition on boot. Woohoo?
I hope the HOW-TO was easy reading and that you have succeeded in hacking up your ROM. I know that certain ROMs have this as a built-in function but Amon Ra's does not. But since alot of people including myself use his ROM because of the high speed and stability I thought I should contribute to his project and add a cool (and missed?) function to it.
Mind you that you can use the ROM-cooker set to further adjust and hack up the ROM as you see fit. Happy learning!
Very nice!
Now the question many people will ask : why would you automount ext2 if you don't use apps2sd ?
I personally have ubuntu on my ext2 And besides this approach can be used for a number of things, people who have had the need, or wanted to experiment with init.rc doing things on boot, the mountsd script can easily be altered to do what ever needed.
For me its been a learning curve finding these things out, so by sharing it I may spare some people breaking their backs over this whole init.rc thing. people may want to modify init.rc for whatever reason, so I'm sure people wont have a problem finding a way of putting this to use, and its a subject that isnt all that covered on the forum .. and hey .. at least they get a rom kitchen out of the whole shabang
Very interesting! Thank you.
I used your unpack-program to unpack a recovery-image. It seems to work fine. What I am trying to do is change the state the recovery-image returns the phone to. Would it be possible to just replace your mountsd-script with, for example, a script that installs apps? Or is there a better way to do what Im trying to achieve?
Cheers,
edit: I noticed that on the emulator it is sufficient to just place an apk-file in "data/app" to get it installed. Could it be possible that this is all I need a script to do? :O or could I hurt my poor phone by doing so you think?
sandis84 said:
edit: I noticed that on the emulator it is sufficient to just place an apk-file in "data/app" to get it installed. Could it be possible that this is all I need a script to do? :O or could I hurt my poor phone by doing so you think?
Click to expand...
Click to collapse
That's indeed all you need to do.
Hi!
So I tried to create a signed update.zip, but it failed. It didnt create a "update-script"-file, so my device refused to install it. I wrote my own "update-script"-file, but then it complained "no digest" for the file. How do I solve this?
post the contents of your script people might see whats up
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
sitimber said:
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
Click to expand...
Click to collapse
Says where its at in the first line : )
Code:
wget http://www.grindhouse.no/androidtools/install.sh
But now that I checked, I have to apologize, I see I have a missed payment with my hosting, I'll fix that within the day. Also sorry I havent been answering the few questions here I've been afk cause of surgery.
sitimber said:
post the contents of your script people might see whats up
Click to expand...
Click to collapse
well, I looked in another "update-script" file and found this:
assert compatible_with("0.2") == "true"
assert getprop("ro.product.device") == "dream" || getprop("ro.build.product") == "dream"
show_progress 0.5 0
write_radio_image PACKAGE:radio.img
show_progress 0.5 10
Click to expand...
Click to collapse
So I figured that nothing was essential other then the line "write_radio_image PACKAGE:radio.img". Also ofcourse I made sure it contained the name of my image-file instead of "radio.img". This gave me the "no digest" message, so now I feel unsure on how to create a working update.zip.
edit:
SOLVED! How silly of me. When you sign the update, a hash of each file is put in manifest.mf. Since I added the update-script after signing the file, ofcourse the digest(hash) was missing. Now everything works alot better and I can proceed... until I get stuck again
Cheers,
edit2:
Just to get a better understanding, what exactly does each line do here? Or where can I read about this?
Code:
service mountsdext2 /system/bin/mountsd
user root
group root
oneshot
edit3:
Ok, so I have experimentet, but I still dont manage to solve those last steps. I tried to edit init.rc and just add "mkdir /testdir 0000 system system" where the other directories were created. I then repacked it, zipped it, signed it, put it on my sdcard, started up a custom recovery, installed the update and rebooted. Everything seems to work fine. But when I start adb and check around, I dont see the "testdir"-directory. Also when I check in init.rc my line is gone. Do you guys have an idea of where I went wrong?
sitimber said:
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
Click to expand...
Click to collapse
it doesnot necesarily have to be linux ...you can also do it in windows using cygwin and dsxda's android rom kitchen

[HOWTO] Create your own AOSP 100% stock

EDIT: Just updated post 2 you probably want to read both this post and that post before trying to build.
you can skip the part of getting the official source and the cyanogen source by just doing
Code:
repo init -u git://github.com/CyanogenMod/android.git -b froyo
First some prereqs You must be using linux and building for an evo 4G aka htc_supersonic
Install the android SDK as instructed here: http://developer.android.com/sdk/installing.html
You will need JDK most linux distros have this in the respositorys.
Then just follow step 2 and make sure that you can run adb from any directory in terminal.
Now to the good stuff.
You will now need to open a terminal window and run the following as root
Code:
cd /usr/bin/; curl http://android.git.kernel.org/repo > repo; chmod a+x /usr/bin/repo
now as user do the following
Code:
mkdir ~/android
cd ~/andoid
repo init -u git://android.git.kernel.org/platform/manifest.git
repo sync
This can take FOREVER like 4-5 hours so you might want to let it go when you go to sleep.
Depending on how fast your computer is the following step can take a long time too
Code:
cd ~/andoid
make
This will build the source code for a generic device it should build everything correctly if you have all of the compilers and what not. If it fails just install the app that it is complaining about.
Now for the EVO specific stuff
Code:
cd ~/android/device/htc
git clone http://github.com/CyanogenMod/android_device_htc_supersonic.git supersonic
That will get the build files however you are going to have to edit them to get it to work.
~/android/device/htc/supersonic/BoardConfig.mk needs to be edited
Code:
TARGET_RECOVERY_UI_LIB := librecovery_ui_supersonic librecovery_ui_htc
TARGET_RECOVERY_UPDATER_LIBS += librecovery_updater_htc
should be
Code:
#TARGET_RECOVERY_UI_LIB := librecovery_ui_supersonic librecovery_ui_htc
#TARGET_RECOVERY_UPDATER_LIBS += librecovery_updater_htc
Some other files may have to be edited to your liking. Personaly I changed ADWLauncher to launcher2 and removed all of the cyanogen stuff.
Now to setup the build enviroment.
Code:
cd ~/android
cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_supersonic-eng
Now to do the building.
Code:
make CYANOGEN_WITH_GOOGLE=true otapackage ## if you want google apps (market etc.)
make otapackage ## 100% Open Source only!
By the way for some reason you have to inclued the otapackage even if you just want the .img files because otherwise it crashes at least for me.
Let me know if you encounter any problems and I will try to help.
UPDATES
Copy your ~android folder somewhere and replace ~/android in this tutorial with the directory that you copied it to. This will allow you to update the overlay when needed.
To add google files you will need to do this
Code:
cd ~/android/vendor/cyanogen
./get-google-files
This gets the htc files and I think taht it might be required.
Code:
cd ~/android/device/htc/supersonic
./extract-files.sh
To make a clean rom like mine do the following:
Edit the file ~/android/vendor/cyanogen/products/common.mk to your liking. I just changed the build name and rom version.
I added the files sysrw and sysro ad you can see in the file just put them in a directory and tell it where they are and where you want them. Also I commented out rommanager.apk as I don't like or use it. Also I use RA recovery so it wont work for me anyway.
Also edit the file ~/android/vendor/cyanogen/products/cyanogen_supersonic.mk
I chaged teh build number to the latest spring and removed the boot animation as I like the stock android one better (and it is faster).
YOU NEED TO do this if you want a keyboard...
edit ~/android/vendor/cyanogen/Android.mk and remove LatinIME!
Now we delete some files.
go to ~/android/packages/apps
delete any application that you don't want. You can optionally add program source code that you do want.
I deleted CM* and Protips
I also edited some code in Settings to remove Cyanogen stuff. Actually I took the stock android stuff an edited that with one little fix but I forgot what it was. Just try to build and it will tell you in an error message.
another reserved post
Really cool
Awesome! Thanks so much for posting this.
thanks dude!!
Thanks man.
question...
im having an issue with this step
Code:
cd ~/adnroid
cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_supersonic-eng
specifically (lets ignore the type in the instructions
Code:
$ cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
cp: cannot stat `./vendor/cyanogen/products/cyanogen_supersonic.mk': No such file or directory
$ find ~/android -name "cyanogen_supersonic.mk"
$ echo $?
0
anyone else having this issue?
So what is the difference between this and running CM6?
Will this avoid the market issues with CM6?
Once it's built, how do you get it installed on the phone?
Here is the link to cyanogens wiki how too......
http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Supersonic
Anyway to do this on Windows 7? Another question, would this still work if I just ran Ubuntu from disk?
Thanks, will def.ly give this a try soon...
Sent from my PC36100 using Tapatalk
onicrom said:
question...
im having an issue with this step
Code:
cd ~/adnroid
cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_supersonic-eng
specifically (lets ignore the type in the instructions
Code:
$ cp ./vendor/cyanogen/products/cyanogen_supersonic.mk ./buildspec.mk
cp: cannot stat `./vendor/cyanogen/products/cyanogen_supersonic.mk': No such file or directory
$ find ~/android -name "cyanogen_supersonic.mk"
$ echo $?
0
anyone else having this issue?
Click to expand...
Click to collapse
there was a typo in my code I edited the post and it should work now.
cteneyck said:
Here is the link to cyanogens wiki how too......
http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Supersonic
Click to expand...
Click to collapse
So really, this is just CM6 built on your own Linux box?
Sent from my PC36100 using Tapatalk
Can this be done from ubuntu on a virtual machine?
And what's the difference between this and cm6 ?.....
how do you replace the adw launcher ?
how can you add additional applications?
onicrom said:
how do you replace the adw launcher ?
how can you add additional applications?
Click to expand...
Click to collapse
in vendor/cyanogen/products
replace this
Code:
#PRODUCT_PACKAGES += ADWLauncher
PRODUCT_PACKAGES += Launcher2
also all of the people asking what the differnece between this and cm is nothing unless you change the source files or add remove packages. they can be found in the packages directory.
Igotsanevo4g said:
Can this be done from ubuntu on a virtual machine?
And what's the difference between this and cm6 ?.....
Click to expand...
Click to collapse
yes you can do this in VM but i don;t know the exact steps to set that up just once you get into your linux VM follow the tutorial.
nice tut. thanks for this...sure it will help MANY
l33tlinuxh4x0r said:
in vendor/cyanogen/products
replace this
Code:
#PRODUCT_PACKAGES += ADWLauncher
PRODUCT_PACKAGES += Launcher2
also all of the people asking what the differnece between this and cm is nothing unless you change the source files or add remove packages. they can be found in the packages directory.
Click to expand...
Click to collapse
Thanks much

[GUIDE] How to compile Sidekick 4G Kernel [Ubuntu]

1) download source code from https://opensource.samsung.com/index.jsp. You are looking for source code for SGH-T839.
2) Get initramfs (Need to make a kernel package)
Extract it using extract boot http://www.mediafire.com/?lc12eceeh617b97.
This is why I am looking for a boot.img
extract it
Code:
tar -xvf extractboot.tar.gz
now move into directory with extract boot and copy your boot.img into here and do
Code:
./extractboot boot.img
3) Get mkboot tools
http://www.mediafire.com/?w06d1m6n1dgo4op
untar it by doing
Code:
tar -xvf $FILENAMEHERE
Add the bin directory to your path by moving to the bin directory and copying down the path then
Now you will add this to your path by editing your .bashrc file.
Go to your bashrc file
Code:
gedit ~/.bashrc
and adding this
Code:
PATH=$PATH:/FULLDIRECTORYYOUWROTEDOWN/
export PATH
4) Download the ARM toolchain
https://sourcery.mentor.com/sgpp/lite/arm/portal/package5385/public/arm-none-linux-gnueabi/arm-2009q3-67-arm-none-linux-gnueabi.bin
and
https://sourcery.mentor.com/sgpp/lite/arm/portal/package5355/public/arm-none-eabi/arm-2009q3-68-arm-none-eabi.bin
5) Install the ARM Toolchain
create the directory /opt/toolchains/arm-2009q3/
Code:
sudo mkdir /opt/toolchains/arm-2009q3/
then install the toolchain using /opt/toolchains/arm-2009q3/
as the install directory
Code:
sudo chmod +x arm-2009q3-68-arm-none-eabi.bin
sudo chmod +x arm-2009q3-67-arm-none-linux-gnueabi.bin
sudo ./arm-2009q3-67-arm-none-linux-gnueabi.bin -i console
sudo ./arm-2009q3-68-arm-none-eabi.bin -i console
6) Compile
Extract your source code and go to the directory Kernel and do the following
WARNING: MAKE SURE THERE ARE NO SPACES IN YOUR FILEPATH BECAUSE THE MAKEFILE DOESNT LIKE THEM.
Code:
make clean
make arch=arm sidekick_rev02_defconfig
make ARCH=arm HOSTCFLAGS="-g -O3" -j8 CROSS_COMPILE=/opt/toolchain/bin/arm-none-eabi-
Now copy any of the resulting compiled ko files into the initramfs file you have extracted and you should have what you need to package a kernel.
you forget initramfs
windxixi said:
you forget initramfs
Click to expand...
Click to collapse
yeah I kept it out so that somebody would post a boot.img then could do steps related to that. I am looking for a boot.img to get initramfs from
unpack zImage
Sent from my SGH-T839 using XDA
---------- Post added at 08:46 AM ---------- Previous post was at 07:49 AM ----------
and how to pack a boot.img?
A request to anyone building SK4G kernels.
Please disable the keystroke logging printk statements in the file:
Code:
drivers/input/keyboard/s3c-keypad.c
The lines look like this:
Code:
//printk("\nkey Pressed : key %d map %d\n",i, pdata->keycodes[i]);
and
Code:
//printk("\nkey Released : %d map %d\n",i,pdata->keycodes[i]);
It is possible to recover the actual keystrokes from the numerical codes those statements log, and the messages go into the dmesg buffer. So it's pretty easy to extract them and determine exactly what the user typed.
In the latest Samsung sources I've seen, those lines were already commented out. It makes sense to enable them while debugging a new ROM build, but please do disable them prior to building a kernel intended for general consumption.
Do you guys know if the available source code will produce a kernel that will work with kj2? the kernel version in SGH-T839_Opensource_Update1 looks to match up, but I compilied a zImage and it didn't boot on stock kj2. but I could very well be missing something.
I have done a small amount of kernel work on an HTC device, but I basically just used the Rom Kitchen to pack up my zImages with a boot.img-ramdisk to create a boot.img. I guess I might need a little more instruction for packing up a Samsung kernel. Is it also an option to just tar up the zImage and flash it with Odin/Heindall?
Thanks for this thread, and for any other advice!
Sent from my SGH-T839 using Tapatalk 2
In case it might be useful to someone else working on building a kernel.
The official and Bali_SK4G sources both seem to insist on building with debug symbols enabled for some of the modules. In particular, i was ending up with dhd.ko being 2.4 MB in size, where it should have been less than 400 KB.
The ideal case would be to determine why the debug symbols are being included -- commenting out the labelled debug options in the bcm4329 Makefile didn't accomplish this.
But a workaround is to strip the modules after the build is finished, before assembling the initramfs.
Has anyone been able to build a working zImage for KJ2 using Dr. Honk's Bali sources [1] and sduvick's KJ2 ramdisk files [2]?
I have been able to build a zImage of a reasonable size (6520 KB). But when I flash this to the KERNEL partition using heimdall, the device boot loops to the B&W Sidekick logo. It doesn't get far enough to show any adb log output.
I can then use the same heimdall flashing procedure to flash the Platypus Egg v1 zImage, or other KJ2-compatible zImage files, and the device boots and works properly.
So I'm trying to figure out what I'm doing wrong in building my zImage. If anyone has any advice I would be appreciative.
[1] https://github.com/drhonk/Bali_SK4G
[2] https://github.com/sduvick/SK4g_KJ2_Ramdisk
I got an updated Bali_SK4G kernel booting using the ramdisk from GenericGinger 2.0.
I have worked up some patches to disable the logging of keystrokes and other more trivial debug spew in dmesg. Also included is a Makefile patch that was required for the compile to complete with my toolchain.
https://carbon.flatlan.net/nxd/patches_Bali_SK4G_nxd.tar.bz2
md5sum: 5d14ac32de155cdca0fd82f14bc4ceca
These patches are GPL licensed, in compliance with the license for the Linux kernel itself. I make no guarantees about their suitability for any purpose. I grant permission to use them to anyone who would like to do so, so long as they comply with the GPL.
I'd like to make a compiled kernel available with these changes, but XDA's rules can be interpreted to mean that I must obtain permission from a series of upstream contributors, some of whom may not be reachable. Perhaps a moderator will clarify the parameters of the permission rule.

TF300t Ncurses style Multiboot kernel

Posting multiboot kernel with grub-style curses boot selection menu.
This is targeted towards linux users who have a multitude of distros on their tf300.
The kernel itself is Tailormoon's 2.2.9 version of Graiden kernel which included Rabits multiboot.
The difference is that I've modified the initrd to scan all drives at boot to look for linux root filesystems or .img files.
Just put all your .img files in the root of your sdcard (dock or internal), or in /data/media/linux, and boot up.
All detected filesystems will then be displayed in an an ncurses menu allowing you to select any one of them.
To install:
- Unpack the blob and install using fastboot:
> fastboot flash boot kernel.blob
- or install using your recovery
Notes:
- Press volume down button when rabits logo pops up to boot into android.
- As with Graiden/Tailormoon, unpack module.tar to your distro's module folder in order to modprobe etc.
- Also a reminder for linux rootfs, you need to mount or copy /data and /system from your android filesystem to get the wifi firmwares you need to fire up your wifi (this is true for any linux on tf300 AFAIK)
- The boot system does not use kexec so kexecboot users may already be satisfied with their current setup. I'm no fan of kexec and hence have not seen the need to include it.
TODO:
- No timer, boot menu sits there indefinitely until a choice is made
- Add android to boot menu so no need for volume down
- Add option for modifying kernel boot parameters, booting to single user etc
Thanks
Dave Driesen
Attaching source code for the boot menu as requested.
The menu is very simple. It just reads a config file provided by the initrd scripts, and outputs its own config file. Both are to be provided by command line parameter.
Makefile is included but you'll obviosuly need curses dev package to build.
Usage:
apt-get install ncurses-dev (or whatever the alternative is for your distro)
tar -xcf bootmenu-src.tar.gz && cd bootmenu-src && make
done!
The rest of the source (such as partition scanning code and OS boot code) consists of modification to Rabits' multiboot which are freely available inside the initrd. I will not post them here as I did not originally create them. If you're interested, I suggest unpacking the initrd and getting stuck in there.
Fyi, here's some scripts for unpacking/packing a kernel.blob.. I don't support these and you'll need to install the relevant tools (blobpack/abootimg/cpio) if you're keen. But this is what I use; may it help others in building blobs, or understanding the steps involved.:
unpack.sh:
Code:
#!/bin/bash
DIR=$(pwd)
# Stage 1 - unpack the blob
mkdir 1.kernel
cp $1 1.kernel/kernel.blob
cd 1.kernel
blobunpack kernel.blob
# Stage 2 - Extract boot image (compressed initrd)
mkdir ../2.LNX
cd ../2.LNX
abootimg -x ../1.kernel/kernel.blob.LNX
# Stage 3 - Decompress initrd
mkdir ../3.initrd.gz
cd ../3.initrd.gz
zcat ../2.LNX/initrd.img >initrd.cpio
# Stage 4 - Unpack initrd
mkdir ../4.initrd
cd ../4.initrd
cpio -id < ../3.initrd.gz/initrd.cpio
# This will leave fully uncompressed kernel in directory "4.initrd"
pack.sh:
Code:
#!/bin/bash
DIR=$(pwd)
# Stage 5 - Pack initrd
mkdir 5.initrd.cpio
cd 4.initrd
find . | cpio --create --format='newc' > ../5.initrd.cpio/initrd.cpio
# Stage 6 - gzip compress initrd
mkdir ../6.initrd.img
cd ../6.initrd.img
gzip ../5.initrd.cpio/initrd.cpio -c9 --stdout --best >initrd.img
# Stage 7 - Create Android boot image
mkdir ../7.LNX
cd ../7.LNX
mkdir content
cp ../2.LNX/* content
cp ../6.initrd.img/initrd.img content
abootimg --create kernel.LNX -f content/bootimg.cfg -k content/zImage -r content/initrd.img && rm -rf content
# Stage 8 - Sign the Android boot image.
# You'll need to do this or your device may reject the blob.
# I could never find a tool for this so just prepend the signature using echo.
mkdir ../8.kernel
cd ../8.kernel
blobpack kernel_unsigned.blob LNX ../7.LNX/kernel.LNX
echo -n -e "-SIGNED-BY-SIGNBLOB-\0\0\0\0\0\0\0\0" >kernel.blob
cat kernel_unsigned.blob >> kernel.blob
rm kernel_unsigned.blob
# Your finished kernel.blob is now in directory "8.kernel"
Awesome stuff!
Wow - this is very very nice! What a job thank you for sharing. I do have issues though - but they are related to my setup - i cant mount /root on /dev/loop (or something along those lines) so the boot process defaults to Android (which actually boots out the box from this (which is nice - had a ****load of issues with other kernels and the original rabits kernel thing) any ideas for the /dev/loop thing?
Again thanks man - so nice!
Nice work, but can you post the source code please? Thanks.
thanks for posting, wouldn't mind trying linux on here after all these years. is this kernel fine with android 5.1.1?
dkzeb said:
i cant mount /root on /dev/loop (or something along those lines) so the boot process defaults to Android
Click to expand...
Click to collapse
Is this an extfs? Usually when you get the mount failure, be it in original Rabits or this multiboot, I find that if I drop to a shell and try to mount by hand, the mount command throws an error either way. Most often this then turns out to be due FS settings ("Check filesystem after X mounts, or X days etc). Checking the FS or using tune2fs to disable periodic checking makes this go away.
You can drop to a busybox shell by pressing "s" when the rabits logo shows up.
Insane PPC said:
thanks for posting, wouldn't mind trying linux on here after all these years. is this kernel fine with android 5.1.1?
Click to expand...
Click to collapse
I'm not sure but doubt it.. Tbh I never got any Android version over Cromi-X 5.4 to run reliably on the TF300 :/ Interested to hear your opinion but for me they all turned out to be slow, unstable (crashes, reboots), drained the battery or just plain impossible to implement. Hence went back to Cromi-X 5.4 and probably staying there forever.
Linux on the TF300 is ok but has many challenges, some of which simply cannot be overcome. Biggest problem is that NVidia dropped support for Tegra3 about 5 minutes after launch. They are not releasing new drivers for contemporary ABIs, something you WILL need if you want to run any kind of recent Xorg using the device's Tegra3 hardware features. That includes touch pad and graphics accelleration.
So you're basically stuck with distro's from 2012 and must be very careful what packages you upgrade or your TF300 will lose OS support for some of its HW features.

HOWTO: extract / modify kernel and initrd IE: rctd

Since so many people are asking, I figured I would write up a quick tutorial on how to modify a boot image. A boot image is a kernel, and an initrd packaged together along with some other information.
This will only concentrate on tearing one apart, modifying it, and putting it back together -- making your own kernel and packaging it is outside the scope.
So, the big thing going around right now is the fact that the lovely carriers have this process (rctd) that runs and chews up CPU. rctd stands for Root Check Toolkit Daemon -- and it does what it sounds like. It checks if you have root, it checks if the system partition has been modified, it checks if the kernel has been modified, etc...etc... Most importantly, it chews up a LOT of CPU and disk IO to do this.
For this to work, you need to have a Linux install, or WLS on Windows 10.
Ubuntu comes packaged with abootimg:
Code:
apt install abootimg
abootimg is used to extract / create / update the Android Boot Image, but first we need out boot image.
adb reboot recovery
adb pull /dev/block/bootdevice/by-name/boot boot.img
Now we extract it.
abootimg -x boot.img
This will give you 3 files:
bootimg.cfg // feel free to take a look if you want, but do not change anything in this file or your kernel probably won't boot.
zImage // This is the Linux kernel. If you grab the sources, and compile a kernel, this is what you get. Again, leave it alone.
initrd.img // This is the initrd (Initial Ramdisk). It is loaded by the kernel to give you a working environment before anything else is loaded. This is what we need to modify
Before we modify initrd, we have to extract it. It is a compressed cpio file. There are several ways to extract it, but this is the method I use:
Code:
mkdir initrd_temp
cd initrd_temp
zcat ../initrd.img | cpio -idv
zcat cats the file while decompressing it. cpio -idv ... -i means extract (yea, wtf), -d means create the directory tree, and -v just means verbose
So now we are in a directory (initrd_temp) with all the files that are in the initrd. The one we care about is init.lge.rc -- we need to edit this file.
If you open it up in an editor, search for this section:
Code:
# LG RCT(Rooting Check Tool)
service rctd /sbin/rctd
class late_start
user root
group root
seclabel u:r:rctd:s0
service ccmd /system/bin/ccmd
class core
user system
group system
socket ccmd stream 0660 root system
seclabel u:r:ccmd:s0
Delete all of that, or comment it out using # signs
Now we need to package everything back up.
Code:
find . | cpio --create --format='newc' | gzip -9 > ../newinitrd.img
cd ..
abootimg --create newboot.img -f bootimg.cfg -k zImage -r newinitrd.img
When you are done, you will have newboot.img, and you need to flash it.
Since we are still in recovery:
Code:
adb push newboot.img /sdcard
adb shell
cd /sdcard
dd if=newboot.img of=/dev/block/bootdevice/by-name/boot
Reboot and enjoy your new -- faster -- rctd and ccmd free kernel.
If doing it this manual way isn't for you, @Zacharee1 has created a script to automate the procedure. I wrote this for people that like to know exactly what is going on. Feel free to poke around in the other files that are in your initrd. You may find other things that you want to tweak. However, be careful, you could make a kernel that won't boot. If that happens, just get into recovery and flash one that does
-- Brian
Did anyone ever figure out what ccmd is?
I am 99% sure it allows remote command execution. Pull it, and take a hex editor to it...
It is nothing good, that is for sure.
It listens on a socket: socket ccmd stream 0660 root system
and
Code:
Unable to start CommandListener (%s)
No permission to run ccmd ccmode commands
Usage: ccmode enable
Usage: ccmode getflag
Usage: ccmode setflag <flag>
-- Brian
Im no good installing anything on windows ciao!!
It would be nice if someone with brains. Not me. Lol can figure out a new kernel for 10p h918 with no rctd and only kcal. ?
Sorry to hijack this thread, but I've made a Telegram thread for this subject https://t.me/joinchat/EkE57g6dCLopBy8xVQRT9w
With LG G5 h850 im not able to boot the image anymore. I always only get the fastboot screen. Maybe there is a difference?
@DMOEdetc If you pull your kernel and send me a link, I will take a look. As far as I know, the Android boot image hasn't changed since the first version.
The init that Android uses may not like files with CR/LF if you are editing it in Windows and not specifying LF only. init may think it is a corrupt file and therefore refuse to load it...
-- Brian

Categories

Resources