[GUIDE REQUEST] Making and Editing Scripts - Samsung Galaxy SL i9003

Last night, I became interested in editing scripts.
Initially, I wanted to translate an AROMA installer, but it didn't work.
Soon, I will want to edit scripts, but not only translating, I want to edit scripts in a more advanced level.
Let me clarify. I'm talking about ROM scripts (update-script, updater-script, config scripts (for example, aroma config script)), and another scripts related to that.
So, I made this thread for asking you these things:
1) Where are scripts from? I want to know what is the program that creates they and how to create they.
2) What program do I have to use for editing scripts? I thought I can use Notepad or WordPad, maybe I was wrong.
3) What do I have to know about the format, characters (unsupported characters, for example), etc.? Please tell me all the minimal details that I have to know to avoid failures.
Well, sorry for my bad English, I am Argentinian
I'll be waiting for your answers.
Thanks in advance!

Well we have two kinds for the major part
Meta inf and init .D
Meta inf says the system to copy x file to the required location on its corresponding partitions. The init scripts load up during boot time it's used to set some values which needs to be set on boot like a ram freeing init script would enable lowoom kill its just programmed to do the required stuff on boot... Well for editing use notepad pp its a cross platform and hence the best
sent from cyanmobile powered Beni

speed_bot said:
Well we have two kinds for the major part
Meta inf and init .D
Meta inf says the system to copy x file to the required location on its corresponding partitions. The init scripts load up during boot time it's used to set some values which needs to be set on boot like a ram freeing init script would enable lowoom kill its just programmed to do the required stuff on boot... Well for editing use notepad pp its a cross platform and hence the best
sent from cyanmobile powered Beni
Click to expand...
Click to collapse
Yes, I was talking about META-INF scripts

Geraaaaa said:
Yes, I was talking about META-INF scripts
Click to expand...
Click to collapse
there isnt much of a scope to meta inf just take the meta inf from any rom use notepad++ try understanding the code its human readable only..

Related

[Android] Make bootpackage for booting Android directly

Hi guys,
some of you have asked whether there is an Android ROM yet, but there isn't, so we have to make with workarounds. One very practical one would be to install a clean WM6 ROM, and boot straight into Android.
Now before, we used haret.exe, and we still will. HaRET has a great functionality with it that allows you to make one big .EXE file containing the zImage, initrd and script. Now with the script - this is actually a problem, because
we may want to play with the boot params
we need to put our apn/internet credentials in
So it would be best to have the big .EXE and the script. This is what I've done.
To do it (works under Linux only!):
Download or copy the initrd.gz and zImage you want to use into a directory. Open a command line, switch to that directory. Type:
Code:
wget http://handhelds.org/cgi-bin/cvsweb.cgi/~checkout~/haret/tools/make-bootbundle.py
wget http://gigatron.de/.android/haret-scriptboot.exe
touch empty
python make-bootbundle.py -o boot_android.exe haret-scriptboot.exe zImage initrd.gz empty
(You may need to change the filenames of zImage and/or initrd.gz accordingly.)
Out comes boot_android.exe file. You can now
put it onto your SD card, and create a link to it in \Windows\StartUp
copy it directly into \Windows\StartUp
and in the same directory where you put boot_android.exe, put your default.txt.
Voilà, your phone will boot up Android automatically.
I advise you to put it on the SD card, because then you can take it out during startup if you do not want to start Android automatically.
Hope you enjoy it.
Stefan
P.S.:For starters, I have put together a version with the latest initrd.gz and zImage, at the usual place http://gigatron.de/.android (boot_android_09-03-18.exe)
P.P.S: Here's the diff for the patched haret-scriptboot.exe:
Code:
Index: src/wince/haret.cpp
===================================================================
RCS file: /cvs/haret/src/wince/haret.cpp,v
retrieving revision 1.24
diff -r1.24 haret.cpp
197,198c197,201
< // Run linked in script.
< runMemScript(script_data);
---
> if (len > 1)
> // Run linked in script.
> runMemScript(script_data);
> else
> scrExecute("default.txt");
Hope we can move everyone here.. seidler
Downloading exe file now to try out.. seems like a good compromise for the time being.
Keep up the good work!
Edit: this ignores the startup.txt file and uses the default.txt only?
bally3 said:
Hope we can move everyone here.. seidler
Downloading exe file now to try out.. seems like a good compromise for the time being.
Keep up the good work!
Edit: this ignores the startup.txt file and uses the default.txt only?
Click to expand...
Click to collapse
Well, didn't mean to move everyone here, it's just that I'm starting different threads for different topics now. (Kinda like a subforum, which we don't have.)
I didn't know about startup.txt, but it is right, it only reads default.txt. I'm actually thinking about adding an inclusion mechanism to the HaRET script language, so we can set the common parameters (MTYPe etc.) all internally in the big .EXE and still allow to set the user-specific details in the (external) default.txt
Stefan
this is SO GREAT!
would it be possible to include such an exe file in all bundles on androidonhtc ?
wow, amazing, thanks!
kubia said:
this is SO GREAT!
would it be possible to include such an exe file in all bundles on androidonhtc ?
wow, amazing, thanks!
Click to expand...
Click to collapse
I don't know about all the previous packages, but I think for all future ones this should definitely be the case.
Stefan
yes, of course, that's what i meant
Helloseidler2547,
I downloaded the sources on http://android.git.kernel.org/repo , as it's written on androidonhtc.com.
In the lastet system.img we can't specify another language than english, but when i look at sources, i can see in many apps sources plenty of languages resources files.
is it the same version used by DZO and you for the packages ?
seidler2547 said:
I didn't know about startup.txt, but it is right, it only reads default.txt. I'm actually thinking about adding an inclusion mechanism to the HaRET script language, so we can set the common parameters (MTYPe etc.) all internally in the big .EXE and still allow to set the user-specific details in the (external) default.txt
Click to expand...
Click to collapse
Hmm, sometimes I'm quite blind. HaRET already has a RUNSCRIPT command, which will allow us to do all that we need. Oh well - silly me.
Stefan
thanks seidler, look like a good start... how are use using haret exactly? are there parameters or mouse actions ect?
I'm not sure if I understand your question correctly, but
- developers are using haret for all kinds of stuff, finding out how winmo does stuff and then porting it into the linux kernel
- users use haret just for booting Android (linux) and setting some kernel parameters in default.txt
HTH,
Stefan
seidler2547 said:
I'm not sure if I understand your question correctly, but
- developers are using haret for all kinds of stuff, finding out how winmo does stuff and then porting it into the linux kernel
- users use haret just for booting Android (linux) and setting some kernel parameters in default.txt
HTH,
Stefan
Click to expand...
Click to collapse
I was refering to how you were directly using it to boot, but it sounds to me like you are using the source code to recompile for you needs?
I'm farmiliar with what haret is used for, i was wondering how you got haret to directly boot linux instead of bringing up the window where you can change the default.txt location or listen for a network connection before clicking run.
joel2009 said:
I'm farmiliar with what haret is used for, i was wondering how you got haret to directly boot linux instead of bringing up the window where you can change the default.txt location or listen for a network connection before clicking run.
Click to expand...
Click to collapse
Just rename your default.txt to startup.txt
don't be too lazy to search
Yes, but with the script make-bootbundle.py, we can make one big .exe for users, containing zImage, initrd and default.txt, which can still read an additional external .txt file (using RUNSCRIPT) -> I think for the whole package this is more convenient for users. Also because the average user doesn't need to change a lot of variables (internet works without kernel parameters, at least for GSM, keyboard settings for at&t tilt could maybe be automated, and userspace access is possible too).
Stefan
Is it possible to install new apps on the latest version ? I have the version from 01-03-2009 and when i try to download an app, it tells me "download failed - not enough space" or something.
You are asking in the wrong thread. Try http://forum.xda-developers.com/showthread.php?t=396782&goto=newpost
Stefan
Oh sorry
Thanks
excogitation said:
Just rename your default.txt to startup.txt
don't be too lazy to search
Click to expand...
Click to collapse
Before trying to insult someone by forwarding them to google, try not to be to be too lazy to read the question. I was asking about stefans bundle. Not what is haret and how to use it.
Thanks,
Joel

Project: apk2

hi folks!
i'm not a developer but sometimes i do some scripting.Now i'm working on a project that called "APK2",and i think that could be useful!
Some months ago, I thought "why don't create a package manager and a package system to install real linux packages, and not just apps? I may want to install some command-line tools to run with terminal emulator" then I wrote this script, named apk2.sh, that installs some particular packages (I wrote another script to easily create this type of packages): he simply does the apt-like un-tar in /, but it installs a config directory too, to remove the installed packages.
It supports the preinst, postinst, prerm, postrm scripts too.
Tell me if it could be interesting, and I'll put it here.
If so, I need testers
If not, simply tell me, and I give up.
so could you be able to run like air crack through debian with this or?
olvap377 said:
so could you be able to run like air crack through debian with this or?
Click to expand...
Click to collapse
I could be able to run it on Android if someone can port all the libs to armv5e
I know, you have to do the porting in order to run it, but for example if there is the package for debian armv5 I think it should work if you take all the deps from the repo (may need some repacking, just to remove the CONTROL folder, and maybe to add the file needed to uninstall and various preinst, postinst etc. ).
And you don't need to run a debian or an ubuntu on Android, that's not really fast.
What do you think?
i think that this sounds really good and if it worked fully it would be a major addition to android development im hoping youll continue with this
olvap377 said:
i think that this sounds really good and if it worked fully it would be a major addition to android development im hoping youll continue with this
Click to expand...
Click to collapse
Thank you!
Any tester? I attach the scripts to now how apk2 works, just run it without any parameter, and it will show you
The other script it's simple to use, you just have to run it once to create in your home the basilar directory tree, you have to complete it and put the files in it, then you just have to put your preinst-postinst-prerm-postrm scripts in the ~/yourpackage/system/etc/apk2 directory, if you have some.
Then run the script again, insert the same package name, and here we are! The package is build! It's in the packagename directory in your home, in .apk2 and in .tar.gz, if you have to edit something do it on the tar.gz, and then change the extension in .apk2
PS: rename the files *.sh.txt into *.sh, because this forum doesn't allow .sh attachments...
xela92 said:
Thank you!
Any tester? I attach the scripts to now how apk2 works, just run it without any parameter, and it will show you
The other script it's simple to use, you just have to run it once to create in your home the basilar directory tree, you have to complete it and put the files in it, then you just have to put your preinst-postinst-prerm-postrm scripts in the ~/yourpackage/system/etc/apk2 directory, if you have some.
Then run the script again, insert the same package name, and here we are! The package is build! It's in the packagename directory in your home, in .apk2 and in .tar.gz, if you have to edit something do it on the tar.gz, and then change the extension in .apk2
PS: rename the files *.sh.txt into *.sh, because this forum doesn't allow .sh attachments...
Click to expand...
Click to collapse
in non-linux speak (layman's terms), what could i do with this...my interest is peaked
what are some "real linux packages" that one might want
tnpapadakos said:
in non-linux speak (layman's terms), what could i do with this...my interest is peaked
what are some "real linux packages" that one might want
Click to expand...
Click to collapse
i.e., the one olvap377 mentioned: air crack (I think it's possible).
or, we can run every app that does not need X server.
I created some demo packages (containing 2 scripts), one is SwapTools, and lets you enable/disable swap with 2 simple cmds (swap-enable and swap-disable); at the first run it collects some info, like the swappiness and the swap partition, then it saves the conf in a file (using swap-disable with --remove-conf will remove the conf file).
Another one I created is remount: you can remount your /system partition rw or ro just by typing on a terminal emulator
Code:
remount rw
or
Code:
remount ro
But you can try to use other appz compiled for armv5 processors, like all the debian apps, except for the one with GUI (we run on framebuffer, no X server :/ )
PS: I attach the pkgs, I added the .zip extension, just rename it in pkgname.apk2
Honest question: Why reinvent the wheel? Other embedded Linux projects have used ipkg to good effect, or its close relative opkg (refs from same link) which is used by Openmoko. A port of this to Android systems which have uClibc should be nearly trivial.
xela92 said:
i.e., the one olvap377 mentioned: air crack (I think it's possible).
or, we can run every app that does not need X server.
I created some demo packages (containing 2 scripts), one is SwapTools, and lets you enable/disable swap with 2 simple cmds (swap-enable and swap-disable); at the first run it collects some info, like the swappiness and the swap partition, then it saves the conf in a file (using swap-disable with --remove-conf will remove the conf file).
Another one I created is remount: you can remount your /system partition rw or ro just by typing on a terminal emulator
Code:
remount rw
or
Code:
remount ro
But you can try to use other appz compiled for armv5 processors, like all the debian apps, except for the one with GUI (we run on framebuffer, no X server :/ )
PS: I attach the pkgs, I added the .zip extension, just rename it in pkgname.apk2
Click to expand...
Click to collapse
thanks dude
olearyp said:
Honest question: Why reinvent the wheel? Other embedded Linux projects have used ipkg to good effect, or its close relative opkg (refs from same link) which is used by Openmoko. A port of this to Android systems which have uClibc should be nearly trivial.
Click to expand...
Click to collapse
I have also an Openmoko phone
I know very well ipkg/opkg, it could be interesting a porting, but I thought it was better to create a little lighter script to do it, because 1. a script that uses sh is usable in every system, you can either to install armv5e pkgs, or any armv* pkg, you have just to change some little things; 2. I don't know how to port, and I'm not able to do programming.
If you are interested and know how to do a porting, it could be very useful, because opkg has really lots of functions...
I just did what I could
xela92 said:
I have also an Openmoko phone
I know very well ipkg/opkg, it could be interesting a porting, but I thought it was better to create a little lighter script to do it, because 1. a script that uses sh is usable in every system, you can either to install armv5e pkgs, or any armv* pkg, you have just to change some little things; 2. I don't know how to port, and I'm not able to do programming.
If you are interested and know how to do a porting, it could be very useful, because opkg has really lots of functions...
I just did what I could
Click to expand...
Click to collapse
Ahh, okay, I see what you mean. Fair enough; I haven't seen your work so far, I was just concerned you were doing unneeded work. 'Course sometimes it's good to do that for the learning experience.
I don't have a full build setup for Android, so I can't recompile (I do have a full build setup for building Optware packages, but that's not quite the same), but I believe most custom ROMs ship uClibc. I'm not familiar enough with uClibc to know if you need to build against an exact version, though you could copy opkg from your Openmoko phone for the heck of it and see if it runs
olearyp said:
Ahh, okay, I see what you mean. Fair enough; I haven't seen your work so far, I was just concerned you were doing unneeded work. 'Course sometimes it's good to do that for the learning experience.
I don't have a full build setup for Android, so I can't recompile (I do have a full build setup for building Optware packages, but that's not quite the same), but I believe most custom ROMs ship uClibc. I'm not familiar enough with uClibc to know if you need to build against an exact version, though you could copy opkg from your Openmoko phone for the heck of it and see if it runs
Click to expand...
Click to collapse
Ya mean, copy the binary??? If so, it won't work of course, because the architecture of the openmoko processor is armv4t, it wouldn't see my binary
Nethertheless, if someone is interested
PS: please, could someone test my scripts? Thank you dudes
xela92 said:
Ya mean, copy the binary??? If so, it won't work of course, because the architecture of the openmoko processor is armv4t, it wouldn't see my binary
Nethertheless, if someone is interested
PS: please, could someone test my scripts? Thank you dudes
Click to expand...
Click to collapse
Heh, oh, older ARM core. Not paying attention. I will now stop hijacking your thread
olearyp said:
Heh, oh, older ARM core. Not paying attention. I will now stop hijacking your thread
Click to expand...
Click to collapse
No problem, man
No testers?
Please give me a feedback. If u want, I can make some apk2 by debs for armv5... Then I accept hints like "howto manage dependencies", 'cause I've no ideas...
"Tester"
xela92 said:
Please give me a feedback. If u want, I can make some apk2 by debs for armv5... Then I accept hints like "howto manage dependencies", 'cause I've no ideas...
Click to expand...
Click to collapse
Hi I have and HTC Hero from Sprint, I'm not a linux power user but I spent lots of time in my computer running Ubuntu just for 2 big reasons 1 freeware and 2 it has the best an simplest packet manager... I love deb files that installs like any .exe win programs I love that! I'm son not a coder and have little to no skills under Linux shell I use my sudo nautilus commands and so because I need it but I hate to untar or tar gz crap... for me that it old and useless some linux power user may get offended by that comment but hi times changes we love GUI... if you manage to post prints screens or a word open office or PDF documentation dummy proof I'm very up to be a Happy tester... the other thing I'm a Digital Graphic Designer if you need some design for a GUI and can try to help you in making and eye candy app...
Here it the way I will love to see grow this project... finding a way to installed it as an apk file like others in the android market so users can install the app easy then...in top of that a simple GUI to browse to the SD card in order to get the apk2 file... you where talking about not being able to run programs that has GUI that it is sad but still interesting but a lot of work to do without a good community because that means that all GUI may need to be re-design to the different resolution on the phones and be touch friendly...
I'm not sure if I'm helping at all but I love the big picture behind your project...
I'm porting opkg on Android, but i'm can't tell that's a trivial task )))
i also wrote simple howto "building and porting linux apps for android from scratch", but on russian. If needed i can do some translating and put here too.
Also may be we can open project for buildroot-like framework for android and opkg's repository. In my how-to i'm use crosstool-ng + gcc + uClibc.
XVilka said:
I'm porting opkg on Android, but i'm can't tell that's a trivial task )))
i also wrote simple howto "building and porting linux apps for android from scratch", but on russian. If needed i can do some translating and put here too.
Also may be we can open project for buildroot-like framework for android and opkg's repository. In my how-to i'm use crosstool-ng + gcc + uClibc.
Click to expand...
Click to collapse
Wow! Please do some translating!
But, when you finish the porting, how will you manage to port the packages?
Will you use the debian pkgs changing the extension? Would it work?
Thanks a lot!
No, we want to create only android repository of packages, based on opkg (ipkg)
for arm, mips and others platfofms.

[Q] How to create pack for recovery.

Hello,
I have made a bounch of scripts which allow me to play with my camera settings.
I copy the files manualy and its looks like it is working.
I want now to create a zip pack which i will be able to install from recovery (like any other patch i can use for the ROM).
Is thee some guide or some refernce i can use which describes how to create such pack, and what are the commands which i can use in the installaion script
[crowd] said:
Hello,
I have made a bounch of scripts which allow me to play with my camera settings.
I copy the files manualy and its looks like it is working.
I want now to create a zip pack which i will be able to install from recovery (like any other patch i can use for the ROM).
Is thee some guide or some refernce i can use which describes how to create such pack, and what are the commands which i can use in the installaion script
Click to expand...
Click to collapse
If you are talkin about file and not string of code, you can use Update.zip 2.0 Modifier/Creator this script let you create an update.zip signed flashable from recovery...
Hanisa said:
If you are talkin about file and not string of code, you can use Update.zip 2.0 Modifier/Creator this script let you create an update.zip signed flashable from recovery...
Click to expand...
Click to collapse
Hi there ,
thanks ! thats exactly what i was looking for!
do you know where could i find a list of commands which i could put on the script
MortScript
With MortScript you'll automate the whole process.
See;
MortScript
[Mortscript] Source Compendium
[MortScript] Examples Accumulation
Have fun,
Senax
Senax said:
With MortScript you'll automate the whole process.
See;
MortScript
[Mortscript] Source Compendium
[MortScript] Examples Accumulation
Have fun,
Senax
Click to expand...
Click to collapse
Hi,
Thanks but i can't see how is this has anything to scripting in recovery mode.
Actualy i am not even sure this is Android supported (i can see the android player but not the scripting part) ...
Anyhow I am looking for a way to install my script from recovery mode actually all i need now is a place in which there will be a list of commands which are accepted buy the recovery updater.
Thanks.

[how to] Develop on Windows RT: A C# Scratchpad

Steps:
(Yes, you need Jailbreak first.)
Download CsBox.zip from this thread.
Unzip the CsBox folder to your user's folder (in my case it's C:\Users\ssaaxx\Desktop\Scripts\)
Get Notepad++ and run it (from the App porting thread)
In Notepad++, Create and save a C# code snippet (A sample code snippet can be found in TestCSharp.cs.txt attachment)
In Notepad++, click "Run" menu --> "Run..." --> Input following text and run (or you can save it as a command shortcut if you want to)
C:\Users\ssaaxx\Desktop\Scripts\CsBox\RunCsSnippet.bat "$(FULL_CURRENT_PATH)"​
There you go!
* Do use the right folder path for you.
------------------
How does it work?
Windows RT ships with a CSharp compiler (csc.exe), except it's not working by default because of missing some referenced dlls.
So I commented out the missing references from the rsp file, and it worked.
After this it's just some basic scripting and Notepad++ integration.
-----------------
Edit: fixed a bug. thanks Calebsem.
Edit: Hide compiler output when compiling succeeds.
cool!
Very cool little hack! I've been looking forward to a way to program C# on the Surface!
Just to demonstrate what this "scratchpad" is capable of, I'll update this reply with some handy scripts:
1. Script to enable Adobe Flash for specified website / domain: EnableFlash.zip
...
* Download the zip and unzip the cs file. Load it in Notepad++ and run.
ssaaxx said:
Steps:
How does it work?
Windows RT ships with a CSharp compiler (csc.exe), except it's not working by default because of missing some referenced dlls.
So I commented out the missing references from the rsp file, and it worked.
After this it's just some basic scripting and Notepad++ integration.
Click to expand...
Click to collapse
Thanks for the cool utility and guide! I was able to work it out to compile a multi-file .NET project. One snag that I hit in the endeavor was about the resources. ResGen.exe does not come on the RT version of Windows. I used my desktop to compile the various resources and then stuff them into the directory tree. At last, the program I re-built was completed and launched well. It consists of an exe and two dll files. All's well for that experiment. Unsure if I can make the time to do a clean room build of ResGen.exe for ARM.
I'm surprised this topic didn't get as many posts as it did. Found this thread through a youtube video, and this has got to be one of the best kept secrets for code development on the RT. A quick replacement of the csc.rsp file after toying with permissions, and adding the csc.exe to my PATH basically allows command-line C# building.
Wondering if the missing DLLs actually appear on different versions of RT. Not that these specific namespaces are something I regularly use, but it would be nice not to have to comment things out this way.
ssaaxx said:
Steps:
(Yes, you need Jailbreak first.)
Download CsBox.zip from this thread.
Unzip the CsBox folder to your user's folder (in my case it's C:\Users\ssaaxx\Desktop\Scripts\)
Get Notepad++ and run it (from the App porting thread)
In Notepad++, Create and save a C# code snippet (A sample code snippet can be found in TestCSharp.cs.txt attachment)
In Notepad++, click "Run" menu --> "Run..." --> Input following text and run (or you can save it as a command shortcut if you want to)
C:\Users\ssaaxx\Desktop\Scripts\CsBox\RunCsSnippet.bat "$(FULL_CURRENT_PATH)"​
There you go!
* Do use the right folder path for you.
------------------
How does it work?
Windows RT ships with a CSharp compiler (csc.exe), except it's not working by default because of missing some referenced dlls.
So I commented out the missing references from the rsp file, and it worked.
After this it's just some basic scripting and Notepad++ integration.
-----------------
Edit: fixed a bug. thanks Calebsem.
Edit: Hide compiler output when compiling succeeds.
Click to expand...
Click to collapse
i dont work, he says "WARNING CS2008 NO ORIGINAL FILE SPECIFICATED"
i post an image (sorry but is in italian)

[Q] Boot.img?

Sooo yeah.... anybody got some help for this one? I have searched google and the forums but can't clearly figure this out, but how do I get a Boot.img for this phone??? I have rebuilt the kernel 3 or 4 different ways and the output never yeilds one, however I apparently NEED one so I can peel away the ramdisk x( any ideas?
EDIT: Okay, so now that I can compile a working stock kernel for the Sidekick, where should I start now? I know we already have a working voodoo lagfix kernel, but I want to make CWM for the stock kernel, that sounds like a good spot. And adding in init.d sounds like another good start. Making my own may help me in understanding it all. I AM taking notes too
Zydrate_blue said:
Sooo yeah.... anybody got some help for this one? I have searched google and the forums but can't clearly figure this out, but how do I get a Boot.img for this phone??? I have rebuilt the kernel 3 or 4 different ways and the output never yeilds one, however I apparently NEED one so I can peel away the ramdisk x( any ideas?
Click to expand...
Click to collapse
If I recall correctly, I used the split_bootimg.pl script, and accompanying instructions, found here:
http://www.android-dls.com/wiki/?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images
Start by unpacking and repacking a kernel that you already know is functional -- i.e. a copy of a kernel you have already successfully flashed. Once that repack can be flashed successfully, you can move on to making modifications to it, or packing a whole new initramfs and kernel.
I had to remove references to a few of Samsung's proprietary modules to get the kernel to build -- Samsung helpfully supplies the places for those sources to be put (IN TREE -- shame on you Samsung), but not the sources themselves. One such module was rfs, IIRC. I removed the Makefile references so I could finish a compile, then used copies of the compiled modules from an existing initrd. Where you run into compile failures, where the source code appears to be simply missing, this is probably the cause.
I found that I had to manually strip at least the modules that resulted when I built from sources, otherwise the finished image was far too large. Compare the sizes of your compiled kernel and module files to those of a known-working reference image. They should not be too far out of line.
I wish I had saved more notes from my own kernel builds. Regular Linux kernels are so easy, but earlier Android kernels are unnecessarily horrible to build. Still, if you run into any more issues, I'll try to help...
Oh, and please disable the keystroke logger!
nxd said:
If I recall correctly, I used the split_bootimg.pl script, and accompanying instructions, found here:
http://www.android-dls.com/wiki/?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images
Start by unpacking and repacking a kernel that you already know is functional -- i.e. a copy of a kernel you have already successfully flashed. Once that repack can be flashed successfully, you can move on to making modifications to it, or packing a whole new initramfs and kernel.
I had to remove references to a few of Samsung's proprietary modules to get the kernel to build -- Samsung helpfully supplies the places for those sources to be put (IN TREE -- shame on you Samsung), but not the sources themselves. One such module was rfs, IIRC. I removed the Makefile references so I could finish a compile, then used copies of the compiled modules from an existing initrd. Where you run into compile failures, where the source code appears to be simply missing, this is probably the cause.
I found that I had to manually strip at least the modules that resulted when I built from sources, otherwise the finished image was far too large. Compare the sizes of your compiled kernel and module files to those of a known-working reference image. They should not be too far out of line.
I wish I had saved more notes from my own kernel builds. Regular Linux kernels are so easy, but earlier Android kernels are unnecessarily horrible to build. Still, if you run into any more issues, I'll try to help...
Oh, and please disable the keystroke logger!
Click to expand...
Click to collapse
Wow thanks nxd! I don't know if you have seen my other posts, but I'm a newbie at this stuff. Never too late to learn though right?
Now, as for the issues in the build, when I first tried to compile I was getting errors of an undeclared SEGMENT_SIZE in binfmt_aout.c so I searched around and was informed that the aout method is outdated? So I removed it from the config as instructed, seeing as it wasn't needed.
I've gotten to a compile resulting in the zImage and about 8 modules created. Now, the zImage is incomplete at this point if I am correct? If it's flashed, it will simply bootloop. (Because there is more to be done? i.e the ramdisk gz that loads the rom at the bootloader?)
Also, I will check the link about the logger, so I can disable it.
I appreciate all your help I really want to get this stuff down-pat eventually.
Zydrate_blue said:
I've gotten to a compile resulting in the zImage and about 8 modules created. Now, the zImage is incomplete at this point if I am correct? If it's flashed, it will simply bootloop. (Because there is more to be done? i.e the ramdisk gz that loads the rom at the bootloader?)
Click to expand...
Click to collapse
Correct, you need to put the modules onto an initramfs, and then assemble the zImage and initramfs into a boot.img. The URL I posted has instructions to both unpack and repack. I suggest that you obtain repack settings (command line, perhaps memory addressing) from an existing working image.
You can probably use the initramfs from an existing image as the basis for your new boot.img as well, replacing the modules from the old imitramfs with your new modules.
nxd said:
Correct, you need to put the modules onto an initramfs, and then assemble the zImage and initramfs into a boot.img. The URL I posted has instructions to both unpack and repack. I suggest that you obtain repack settings (command line, perhaps memory addressing) from an existing working image.
You can probably use the initramfs from an existing image as the basis for your new boot.img as well, replacing the modules from the old imitramfs with your new modules.
Click to expand...
Click to collapse
I hate to ask this because I'm afraid of being a pain in the a**.... but I hope you won't mind working with me, I'm in for the long run. Anyway, am I supposed to have a initramfs after the compile somewhere within the source? Or is this something I acquire from an an outside source? I promise I have done like 30-40 searches before hand. I have a feeling am missing something obvious -_-
Again, thank you for your generous help
Zydrate_blue said:
I hate to ask this because I'm afraid of being a pain in the a**.... but I hope you won't mind working with me, I'm in for the long run. Anyway, am I supposed to have a initramfs after the compile somewhere within the source? Or is this something I acquire from an an outside source? I promise I have done like 30-40 searches before hand. I have a feeling am missing something obvious -_-
Again, thank you for your generous help
Click to expand...
Click to collapse
The kernel compile will NOT produce an initramfs for you. It will produce the zImage (compressed kernel image) and modules.
The initramfs is an archive containing some files. During boot, when the kernel reaches the end of device initialization, it then creates an empty memory-backed filesystem, and extracts the initramfs contents into that new filesystem.
Ideally the initramfs would be generated by the Android build system, using the binaries produced by the kernel compile. But Samsung provides the bare minimum for GPL compliance, and so we don't get all the pieces we'd need for that. Presumably assembling those pieces is a big part of what windxixi has done, however.
When I worked up my boot.img, I used someone else's existing initramfs, dropped in my compiled modules and a few other minor changes, and then re-assembled it with my compiled zImage. If you're already working with windxixi's build kit and kernel sources, it might save you some time to use his initramfs as a basis for your own.
Really, once you've unpacked basically any SK4G boot.img, and extracted the files from the initramfs, I think you'll see the layout and that aspect the process will be clearer to you.
nxd said:
The kernel compile will NOT produce an initramfs for you. It will produce the zImage (compressed kernel image) and modules.
The initramfs is an archive containing some files. During boot, when the kernel reaches the end of device initialization, it then creates an empty memory-backed filesystem, and extracts the initramfs contents into that new filesystem.
Ideally the initramfs would be generated by the Android build system, using the binaries produced by the kernel compile. But Samsung provides the bare minimum for GPL compliance, and so we don't get all the pieces we'd need for that. Presumably assembling those pieces is a big part of what windxixi has done, however.
When I worked up my boot.img, I used someone else's existing initramfs, dropped in my compiled modules and a few other minor changes, and then re-assembled it with my compiled zImage. If you're already working with windxixi's build kit and kernel sources, it might save you some time to use his initramfs as a basis for your own.
Really, once you've unpacked basically any SK4G boot.img, and extracted the files from the initramfs, I think you'll see the layout and that aspect the process will be clearer to you.
Click to expand...
Click to collapse
I haven't found any boot.img from another kernel, however I have finally figured out how to unpack the zImage D I think I'm a bit closer now, however, now I need to figure out how to un-cpio the initramfs.cpio and/or use the intramfs folder I now have. (in the unpacked zImage)
Then the next step I suppose would be learning how to incorporate the modules that I have. hmm..
Zydrate_blue said:
I haven't found any boot.img from another kernel, however I have finally figured out how to unpack the zImage D I think I'm a bit closer now, however, now I need to figure out how to un-cpio the initramfs.cpio and/or use the intramfs folder I now have. (in the unpacked zImage)
Then the next step I suppose would be learning how to incorporate the modules that I have. hmm..
Click to expand...
Click to collapse
On the page I linked to in my first reply, under "Alternative Method", those instructions worked for me to split, unpack, repack, and assemble. Did they not work for you?
Regarding how to incorporate the modules, you would copy them into the extracted directory in the same locations in the initramfs as the existing module files. Generally something like /lib/modules. Look for files ending in '.ko'. They may be spread out a bit in your compiled kernel sources, but they should all be in one directory in your extracted initramfs directory.
As for an existing boot.img, it's a Froyo kernel, but there's this: http://forum.xda-developers.com/showthread.php?t=1663622.
nxd said:
On the page I linked to in my first reply, under "Alternative Method", those instructions worked for me to split, unpack, repack, and assemble. Did they not work for you?
Click to expand...
Click to collapse
I tried this method of repacking, but so far I have not been able to re-pack my zImage successfully. (I feel pretty close to getting this) Maybe I am putting the modules in the wrong place? Or perhaps I am skipping a step. I believe I need to assign more room for the modules. I am getting the error that initramfs_cpio is too large.
My initramfs has 2 directories in it- and I created a folder within called lib and placed the modules in there... that may be the wrong way, but I don't think it changes the need for more room in the kernel. Something to do with padding values maybe? /:
Also, the script I am using for this is from JunYoung- it is repack-zImage.sh a tool for de-compiling and recompiling a zImage. That's how I got to my initramfs directory in the new zImage I built with the source.
Zydrate_blue said:
I tried this method of repacking, but so far I have not been able to re-pack my zImage successfully. (I feel pretty close to getting this) Maybe I am putting the modules in the wrong place? Or perhaps I am skipping a step. I believe I need to assign more room for the modules. I am getting the error that initramfs_cpio is too large.
My initramfs has 2 directories in it- and I created a folder within called lib and placed the modules in there... that may be the wrong way, but I don't think it changes the need for more room in the kernel. Something to do with padding values maybe? /:
Click to expand...
Click to collapse
I think your extracted initramfs should have more than two directories.
Would you paste a listing of the files and directories here? Do this:
Code:
cd [path_to_extracted_initramfs] && find *
nxd said:
I think your extracted initramfs should have more than two directories.
Would you paste a listing of the files and directories here? Do this:
Code:
cd [path_to_extracted_initramfs] && find *
Click to expand...
Click to collapse
This is what I have after I unpack the zImage:
cpio-t
decompression_code
initramfs
initramfs/root
initramfs/dev
initramfs.cpio
kernel.img
padding3
padding_piggy
part3
piggy
piggy.gz
piggy.gz+piggy_trailer
piggy_trailer
ramfs+part3
sizes
EDIT: I also tested unpacking another zImage that is working, in fact I tried it on the Bali SK4G that we use currently (I hope that was okay with you /: I probably should have asked) but it just keeps displaying code as if it won't finish unpacking. It makes sense because there is a lot more to unpack, I think it is because it is compressed.
Zydrate_blue said:
This is what I have after I unpack the zImage:
cpio-t
decompression_code
initramfs
initramfs/root
initramfs/dev
initramfs.cpio
kernel.img
padding3
padding_piggy
part3
piggy
piggy.gz
piggy.gz+piggy_trailer
piggy_trailer
ramfs+part3
sizes
EDIT: I also tested unpacking another zImage that is working, in fact I tried it on the Bali SK4G that we use currently (I hope that was okay with you /: I probably should have asked) but it just keeps displaying code as if it won't finish unpacking. It makes sense because there is a lot more to unpack, I think it is because it is compressed.
Click to expand...
Click to collapse
You don't need my permission to use my Bali-based Linux kernel image or patches.
Where can I get a copy of this other boot.img you're working with? It seems clear the hacks and workarounds I used with the Bali-era kernel don't translate directly across. I'd like to take a look and see what I can make of it.
nxd said:
You don't need my permission to use my Bali-based Linux kernel image or patches.
Where can I get a copy of this other boot.img you're working with? It seems clear the hacks and workarounds I used with the Bali-era kernel don't translate directly across. I'd like to take a look and see what I can make of it.
Click to expand...
Click to collapse
Well, I never really found a literal "boot.img" from what I read I have to compile a zImage and in the sidekick's style system boots this as a boot.img??? And I have only used the one from kernel source so far, seeing as I could not get the Bali zImage to split.
As for the initramfs.cpio that us within the zImage, I tried to un-cpio it and I get an error about removing '/ from name?
I could send you the zImage I got from source o.e
EDIT: I never found a copy of boot.img, I couldn't even get one from an outer-source.
Sent from my SGH-T959V using xda app-developers app
Zydrate_blue said:
As for the initramfs.cpio that us within the zImage, I tried to un-cpio it and I get an error about removing '/ from name?
Click to expand...
Click to collapse
That's more of an advisory than an error. It's just telling you that it's stripping off the leading /, i.e. extracting to a relative path.
It sounds like you probably succeeded in extracting the initramfs.
nxd said:
That's more of an advisory than an error. It's just telling you that it's stripping off the leading /, i.e. extracting to a relative path.
It sounds like you probably succeeded in extracting the initramfs.
Click to expand...
Click to collapse
Well, then that sounds better! But what about this one:
cpio: dev/console: Cannot mknod: Operation not permitted
1 block
I forgot there was a following error
Zydrate_blue said:
Well, then that sounds better! But what about this one:
cpio: dev/console: Cannot mknod: Operation not permitted
1 block
I forgot there was a following error
Click to expand...
Click to collapse
You'll probably want to extract the files as root. Otherwise device nodes won't be created, like above, and permissions won't be kept on any of the files.
Be careful to be in a safe (i.e. empty) working directory when you do that. It will extract the files into your current working directory.
nxd said:
You'll probably want to extract the files as root. Otherwise device nodes won't be created, like above, and permissions won't be kept on any of the files.
Be careful to be in a safe (i.e. empty) working directory when you do that. It will extract the files into your current working directory.
Click to expand...
Click to collapse
Okay so now after I execute as root, it gives me this message:
cpio: /dev/console not created: newer or same age version exists
So the directories are empty after extracted?
Zydrate_blue said:
Okay so now after I execute as root, it gives me this message:
cpio: /dev/console not created: newer or same age version exists
So the directories are empty after extracted?
Click to expand...
Click to collapse
There's another argument you needed: --no-absolute-filenames
Unfortuantely it looks like cpio will have kept the absolute path and overwritten files on your real machine.
Extract into a directory using --no-absolute-filenames and see what files on your host system were overwritten. Those files should be recovered somehow before proceeding.
Sorry I didn't catch that.
nxd said:
There's another argument you needed: --no-absolute-filenames
Unfortuantely it looks like cpio will have kept the absolute path and overwritten files on your real machine.
Extract into a directory using --no-absolute-filenames and see what files on your host system were overwritten. Those files should be recovered somehow before proceeding.
Sorry I didn't catch that.
Click to expand...
Click to collapse
Oh god -_- wow I messed up then. well....the only file that was within the cpio was a file named console.... so I think I need to fix that?
I'm not mad or anything, it's a risk you take ya know? But I may need help.
EDIT: Okay so I reboot my laptop and it reboot fine, no issues. I don't think it actually overwrote any file (luckily because that cpio file didn't have anything in it...heh) So should I now try the command with the new argument?
Zydrate_blue said:
Oh god -_- wow I messed up then. well....the only file that was within the cpio was a file named console.... so I think I need to fix that?
I'm not mad or anything, it's a risk you take ya know? But I may need help.
EDIT: Okay so I reboot my laptop and it reboot fine, no issues. I don't think it actually overwrote any file (luckily because that cpio file didn't have anything in it...heh) So should I now try the command with the new argument?
Click to expand...
Click to collapse
I'll take a look at the boot image this evening. It would seem very odd to me if the only file on the initramfs was /dev/console.

Categories

Resources