[Q] what to modify to autoload a kernel module @ boot? - General Questions and Answers

[Q] how autoload a kernel module @ boot?
hi.
I have ''simple', one-click rooted (via http://forum.xda-developers.com/showthread.php?t=808103), 'stock' android 2.1 on a Samsung Galaxy S Epic 4G.
i've upgraded to latest/full busybox (http://www.appbrain.com/app/busybox/stericson.busybox) with run-parts support.
I've found/installed 'tun.ko' kernel module for my platform, and verified that it's insmod-able.
I need to load that tun.ko kernel module on boot. Where do I add that module specification so it sticks?
direct mods to anything "/init*" get overwritten @ boot ... from ramdisk.img, iiuc.
i've created /system/lib/init.d/tun, but that needs busybox run-parts to exec/load @ boot ... same issue. mods to, e.g. init.rc get overwritten @ reboot.
any hints here?
thanks!

Related

[MTD][TW][DEV][INIT.D]Base boot.cpio.gz for TW on MTD

I have been trying out the various TW roms that run on MTD and have noticed some problems with the init.rc files that are being used, so I decided to create something that could be used as a base by others. I'm not sure who created the first TW rom on MTD, but they all seem to have mostly the same init.rc file, so I started from the one in tortel's EI22-Stock-ish MTD.
Things I changed:
Various changes and additions from the CM7 version
Removed plus tweaks (all of this can be taken care of elsewhere)
Added init.d support
Added support for /etc/init.local.rc
For init.d support to work, your rom must have the file /system/bin/sysinit, containing something like so:
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
Every rom I've seen so far has, so it shouldn't be a problem.
How to use:
If you're not familiar with the format of the boot.img file that is flashed to the boot partition, check my other thread here. Basically is contains the zImage, and two ramdisks: boot and recovery. The zImage contains the kernel and a ramdisk: initramfs. The init.rc is located in the boot ramdisk, so I will distribute a copy of that. You can put this into your rom or kernel by deconstructing your boot.img with extract_boot.sh, replacing the boot.cpio.gz with this, then rebuilding the boot.img with mkshbootimg.py
Download:
boot.cpio.gz - 1.2 MB
Thank you. What I need is what changes the the kernel are needed to make a kernel work with MTD. I tried comparing my source tree with Tortell's but he had so many tweaks that it was hard to know what was really needed to make it work.
I thank you greatly for this good sir, and for all of your help !

[Q] Can't run init.d scripts on boot?

Was running Gee One's 9.2.1.17 rooted stock ROM ( http://forum.xda-developers.com/showthread.php?t=1552303) + guevor kernel 17c and init.d scripts ran fine.
Recently wiped everything with Android HD wipe script to start over and install 9.2.1.24 via instructions: http://forum.xda-developers.com/showthread.php?t=1634634
However, my init.d scripts won't run at boot. I have guevor's kernel flashed and busybox installed. I can manually run the script and it works, but it doesn't run automatically at boot.
The script I'm running is at: http://forum.xda-developers.com/showthread.php?t=1433436
Help?
EDIT: Redid everything again but this time flashed TastyMeh kernel which worked with init.d scripts just fine. But the script still won't run at boot. Must be something with the ROM. I'll just use Script Manager as a clunky workaround.

[Q] How to add Root, and Auto Zipalign to my Custom Rom

I am working on a custom jb4.2.2 rom for the A13 SOC and wanted to add some features, ROOT By default - I added the su Binary and the SuperSU.apk however it does not work by default. If you boot into CWM Recovery then Reboot the device it offers to fix Root, when I select yes it proceeds and works fine... I would Rather make the ROM Rooted without having to do that any Ideas On what Im doing wrong ?
I am also interested in adding features to the ROM automatic Zipalign would be desirable as well as the ability to use a swap / zram. I am using a Stock JB 3.0.8+ Kernel and in at least one prior iteration I could use zram and activate swap... I would Like to make those features user selectable.
I currently have init.d working in the rom set in the init.rc using busybox run-parts. I do not have run-parts installed by default, is there a simple way to include the full busybox install as well ?
Assistance on any of these questions is appreciated.

init.d support for Nougat based ROMs

I wanted a working init.d to mod some stock Interactive Gov settings in AospExtended ROM so I took the clever universal init.d enabler created by @_alexndr and modified it for a slightly different outcome.
The untouched version ends up using /system/bin/debuggerd as the host file to launch init.d support. This works perfectly well except debuggered is called at the post-fs-data point in the boot process.
This is too early for some init.d settings to stick as they can be overwritten later in the boot process by stock settings. I found /system/bin/mpdecision is called on property:sys.boot_completed=1 making it a much better candidate to use for our phone. So the original script has been modified to use mpdecision instead of debuggerd as the host file to start init.d
I also removed some lines automatically setting up a 99SuperSUDaemon init.d script since we may have magisk instead
All the magic is done in update-binary for those wondering how this works.
Tested working on AospExtended V4.2
Edit: to completely uninstall - delete /system/bin/mpdecision and rename /system/bin/mpdecision_real to mpdecision. Too easy!
Edit, edit: Some custom kernels disable mpdecision by renaming the same file that is being used here. That will prevent correct operation but can be easily overcome by first letting the custom kernel rename mpdecision (to mpdecision.bak) then make another (empty) file called mpdecision so it will become the host to launch init.d functionality. The key to correct operation is that the init.qcom.rc file still has the line that starts mpdecision.
Edit, edit, edit: What is wrong with the built in sysinit script to enable init.d you might well say.......2 problems: it requires busybox and it runs too early in the boot process (on post-fs-data)
Hope this comes in useful.

Kernel with loop device support

Is there any way to compile a kernel with loop device support? I know twrp will mount an ext4 img and chroot in. Is there anyway to add this support to the rom itself?
https://android.googlesource.com/kernel/msm
I've been downloading the sourcecode but I think loop device support is already enabled in the default config file.

Categories

Resources