Hello All,
Short question: I've successfully booted a custom kernel whose .config file has the appropriate (CONFIG_MODULES=y, CONFIG_MODULES_UNLOAD=y, CONFIG_MODULES_FORCE_UNLOAD=y) are all set. However, running lsmod gives the error: /proc/modules no such file/directory and insmod gives a 'function not implemented' error. Did I not actually boot into the kernel I just made? The reason I ask is that the Phone details kernel version remains the same and loadable modules aren't supported, despite the steps outlined below.
Phone details:
Model: Nexus 4
Android Version: 4.2.2
Kernel Version: 3.4.0-perf-g7ce11cd [email protected] #1 Tue Jan 29 11:41:33 PST 2013
Build Number: JDQ39
Long explanation: I'm new to working with custom kernels and really anything beyond rooting the device - so apologies for any simple mistakes I make. I'm working on a project that requires me to create a custom kernel that supports module loading, unloading, and force unloading. I've been trying to do this manually (I'd like to learn the process). I've mostly used the following guides to get to this point:
What I want to do (except with a real phone) https://code.google.com/p/volatility/wiki/AndroidMemoryForensics
http://forum.xda-developers.com/nexus-4/general/howto-build-nexus-4-kernel-t2021202
http://forum.xda-developers.com/nexus-4/general/nexus-4-guide-unlock-bootloader-root-t2266654
http://xda-university.com/as-a-developer/getting-started-building-a-kernel-from-source
I've completed the process outlined in the first link with the goldfish emulator, but now I want to test it out on my rooted Nexus 4 device.
Setup:
Download Google SDK
git clone toolchain (http://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6)
adb pull /proc/config.gz from phone
git clone kernel source (https://android.googlesource.com/kernel/msm)
git clone AnyKernel folder source (https://github.com/koush/AnyKernel.git)
Unlock bootloader & setup CWM v. 6.0.4.7
Setup Notes
Here's where I think I may be messing up: the kernel source step. So once I clone the kernel source, I switch into what I believe to be the appropriate branch. I've tried all of the msm-mako-3.4-jb branches except for the kgsl one at this point. I think possibly my error is coming from grabbing the wrong kernel -- but I wasn't sure how else to do it since I'm working with an older 4.2.2 model.
Here are the msm-mako-3.4-jb branches I can switch to (I'm assuming I need jb because I am running 4.2.2):
View attachment 3377399
For the AnyKernel folder structure, I modified the updater-script's mount command to mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system"); (solution here: http://forum.xda-developers.com/showthread.php?t=1875460) because I was receiving a 'mount expects 4 args, got 3 error'.
Making the Kernel
As far as that goes, I executed the following commands without errors:
make ARCH=arm SUBARCH=arm CROSS_COMPILE=~/toolchain/arm-linux-androideabi- menuconfig (using the config file I pulled from the phone)
make ARCH=arm SUBARCH=arm CROSS_COMPILE=~/toolchain/arm-linux-androideabi- (succesfully creates the zImage and 2 .ko files (scsi_wait_scan.ko and adsprpc.ko))
copy the zImage to AnyKernel/kernel and the two .ko files to AnyKernel/system/lib/modules
zip the directors from AnyKernel and place zip on sdcard
adb reboot recovery
once in CWM, advanced > wipe davlik cache and afterwards install zip > choose zip from /sdcard > mykernel.zip
This process appears to successfully execute to me (screenshot below) and then I hit reboot system now for the changes to take place. At this point I check lsmod and insmod again and receive the same errors. I've reached this step 4 times with some of the different msm-mako-3.4-jb kernel sources (mr1, mr1-fr, mr1.1, and mr2).
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Sorry for the long post and thank you if you've taken the time to read it all! I'd appreciate it if anyone could help me out. Please ask if there are any details I left out that might help the issue.
Solution
I ended up going about this a different route. Instead of trying to create a flashable zip, I created a boot image following these instructions: http://forum.xda-developers.com/nexus-4/general/guide-beginners-guide-to-building-t2986686. Additionally, the correct kernel source for my particular device (Nexus 4 running 4.2.2) was the msm-mako-3.4-jb-mr1.1 branch. Hope this helps anyone in a similar situation!
Related
What's up! I successfully rooted my Nexus S i9020T 2.3.4 Thanks to the many links in these forums! THANKS! Now, I downloaded the BT5 ARM img , got everything pushed to the phone. Then in Terminal emulator -
Code:
cd /sdcard/BT5
sh bootbt
Returns
Code:
mkdir failed for -p, File exists
Loop device exists
ioctl LOOP_SET_FD failed:
Bad file number
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
bootbt: cannot create /data/local/mnt etc.....
I can post the rest if needed.
I seen the other threads where the bootbt had to be modified but I haven't seen anything specific for the Nexus S. Perhaps I should use the modified BT5 ARM img? Any help is appreciated thanks in advance.
Update! BT5 ARM Nexus S
So I used the modified BT5 img and followed the instructions here.
http://forum.xda-developers.com/showthread.php?t=1074169 (not allowed to post there yet!)
I run sh installbt.sh and that seems to go ok.
I get errors at this step.
Code:
to use your BackTrack you can use following commands.
startbt <- mounts and prepares the system for usage.
stopbt <- unmounts and free up all resources.
bt <- a command line version of BT chroot.
When I run startbt I get this
Code:
mknod: /dev/block/loop: File exists
moun: mounting /dev/block/loop254 on /data/local/bt
failed: Device or resource busy
mount: I/O error
mount: I/O error
mount: I/O error
startbt: cannot create /data/local/bt/etc/resolv.conf: I/O error
startbt: cannot create /data/local/bt/etc/resolv.conf: I/O error
startbt: cannot create /data/local/bt/etc/hosts: I/O error
chroot: can't execute '/bin/bash': Input/output error
Any help is appreciated!
Did you check your ROM for EXT2 support?
sounds like you are trying to run Linux as the OS in the phone?
have you tried the guide on how to install ubuntu into your phone?
http://forum.xda-developers.com/showthread.php?t=907760&highlight=ubuntu
the original image you flashed is wrong it's for the wrong phone
this is a Nexus S not a Sony Xperia
Waiting for *how to*...
just founded that http://mayaseven.blogspot.com/2011/05/backtrack-5-on-my-android-phone-nexus-s.html
its posible.
Thanks! I'll keep an eye out for it.
Working
Using this link http://forum.xda-developers.com/showthread.php?t=1085863
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Screens Added
added a few screens.
Working fine here on my nexus s. got the ui up in my vnc viewer no problem.
ext2 support
what roms are the two of you running?
my rom doesn't have support for mounting ext2 file systems so i can't use this until i find one that does.
Hi ,
i want to compile kernel with compat-wireless 3.6 compatibility (drivers for monitoring mode / packet injection) , so for start
i compiled kernel from asus source
changed kernel config
then i have make kernel image then blob
and this is where i need to help
after flashing blob to TAB i have bricked it , 2 times already, i have it now from service.
first time i tried to flash blob from .zip
second time i tried dd to /dev/block/mmcblk0p4
i need help with this.
thank you
...........................................................
slider SL101 with revolver 4.2.1
external USB adapter Edimax-EW-7811Un (rlt8188cus chipset)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
with working monitoring mode / packet injection
Fluffinko said:
Hi ,
i want to compile kernel with compat-wireless 3.6 compatibility (drivers for monitoring mode / packet injection) , so for start
i compiled kernel from asus source
changed kernel config
then i have make kernel image then blob
and this is where i need to help
after flashing blob to TAB i have bricked it , 2 times already, i have it now from service.
first time i tried to flash blob from .zip
second time i tried dd to /dev/block/mmcblk0p4
i need help with this.
thank you
...........................................................
slider SL101 with revolver 4.2.1
external USB adapter Edimax-EW-7811Un (rlt8188cus chipset)
with working monitoring mode / packet injection
Click to expand...
Click to collapse
Did you include an appropriate init ramdisk? A flashable kernel package usually includes the blob, a META-INF folder and a system folder. The blob, when unpacked, includes at least a blob.LNX (which is the same as a boot.img) which when unpacked further contains the init ramdisk file system and the kernel zImage. The META-INF folder has the updater-script and maybe a few other files and the system folder may have an lib/modules folder for the modules built with the kernel and possibly an init.d folder for startup scripts and such. The init ramdisk has the system initialization files for the underlying Linux system that Android runs on top of.
Hi!
This may be of interest to fellow developers. I've taken some time to enable the fastboot protocol for the u-boot in the Nook HD+ and ported the Genode Framework OS.
Act one, part one. Fastboot.
As you know, booting from external sd is done via the u-boot bootloader. I've modified it so that instead of booting from sd, it wait for the fastboot connection from the host PC. Besides, I've fixed the display initialization and now it can display the boot log on the framebuffer console (yay!). Developers (especially verygreen) may want to take a look at
git://github.com/astarasikov/uboot-bn-nook-hd-fastboot.git
Act two. Genode
Genode is a microkernel framework for building runtime environment. It can run on top of many kernels, the most actively developed one is FiascC. One increadibly cool feature of Genode is that it allows booting many instances of linux and android on the devices where the CPU does not have the virtualization extensions. Though today it lacks drivers for most hardware and is more of a proof of concept than a daily driver. Take a look at the screenshot and read my blog post if you want to know more technical details.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
http://allsoftwaresucks.blogspot.ru/2013/05/porting-genode-to-commercial-hardware.html
Ok, this is indeed mainly to show off, and I sincerely hope someone finds the Genode Framework an interesting concept and joins the development process. Do you want to touch an OS from 2021 in 2012
I'm working on booting arch linux on the HD+ native, and Im' having trouble with booting your uImage files once compiled. I hang at a black screen. Any chance that you could send me binaries? I'm interested in this project.
Here is the precompiled u-boot binary for you
https://docs.google.com/file/d/0B7wcN-tOkdeRV3ZJNzlhQTh2OE0/edit?usp=sharing
And the image.bin.gz (don't forget to uncompress prior to fastbooting)
https://docs.google.com/file/d/0B7wcN-tOkdeRWlJmX1haRGsxUUU/edit?usp=sharing
Have you managed to get the framebuffer console working in the Nook HD+ kernel?
I came across this original thread when searching for enabling LCD framebuffer console for the Nook HD+.
I, too, wish to run Arch ARM linux on the nook.
Because we have kernel source and a sdcard bootup, I thought this would be somewhat easy, but I've been finding it difficult.
I started out learning how to unpack and repack the ramdisk.
I replaced the busybox binary in the TWRP recovery ramdisk with one that has added "applets", such as ash, mdev, pivot_root, etc.
Then I tried to build my own busybox init based ramdisk (which is frustrating without a serial console), with the idea of using it to pivot_root (mmcblk1p2, /sbin/init).
When that didn't work I built a ramdisk image using buildroot.
Because of difficulties, I decided I needed a kernel that had at least a framebuffer console, which I attempted to compile.
So this is where I'm stuck at.
(can't post link)
It's mainly useless, but it does demonstrate LCD framebuffer console- to an extent.
It has several different ramdisks.
Default is the ramdisk extracted from emmc boot.img. It does nothing but display some logs on the screen.
ramdisk.twrp is the twrp 2.6.3.0 recovery with a more complete busybox binary. It works, and you'll see a flash of the framebuffer console, before twrp starts.
ramdisk.br is a buildroot generated ramdisk. On this the screen blanks out for minute, then displays some garbled garbage on the screen.
(Other than that I think it's "working" in that the kernel doesn't panic).
This is where I'm stuck at. Does anyone know the correct tty I should be directing output to in the kernel command line?
I'm tempted to try going the kexec route... perhaps something like kboot or kexecboot and give up on the pivot_root idea.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Huawei have helpfully released the kernel source for the Honor 7 on their download site. Impressively, the version posted there (3.10.86) actually matches the current release build (B330). However, the download itself is only part of the puzzle - it's important to then know how to compile it and use it. Hence this guide.
Some points to note first of all...
This guide refers to building on Linux. You can probably build on OSX or whatever too but seriously, it's less pain in the long run to spin up an Ubuntu VM.
There is a readme file in the kernel download with build instructions. Don't follow it... it won't work. You will end up with a built kernel, but it won't flash to your device due to the size of the file created by the 4.9 toolchain. Strange I know.
In the download linked above, as well as the kernel, there are some other bits and pieces (some of which are quite bizarre). I've mirrored the kernel to Bitbucket, so you don't need to grab the whole download.
Got that? OK, so here's a step by step on how to build the kernel! I strongly recommend building stock first and testing that works for you, then you can start adding your tweaks in. I'm interested to hear what you add / change!
Open a terminal window on your Linux machine / in your Linux VM. No GUIs here. Change to the directory where you want the kernel / toolchain to live.
First of all, we're going to clone the toolchain from AOSP.
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8
Next we're going to clone the kernel source itself from my git repo on bitbucket.
Code:
git clone https://bitbucket.org/paulobrien/android_kernel_honor7.git
We need to add the toolchain location to the path.
Code:
export PATH=$(pwd)/aarch64-linux-android-4.8/bin:$PATH
We need to specify that we are cross compiling for arm64.
Code:
export CROSS_COMPILE=$(pwd)/aarch64-linux-android-4.8/bin/aarch64-linux-android-
Let's create a directory for our output to go in to.
Code:
mkdir out
We've got the kernel downloaded, so let's change to that directory so we're ready to go.
Code:
cd android_kernel_honor7
A bit of cleaning up before we get started...
Code:
make ARCH=arm64 O=../out mrproper
Specify that we're building for PLK (Plank = H7)...
Code:
make ARCH=arm64 O=../out hw_PLK_defconfig
And build it!
Code:
make ARCH=arm64 O=../out -j8
When this process completes, we can check the '../out' directory and you should find the file arch/arm64/boot/Image. This is the kernel that you've just built! You can't flash it as is though, you need to put it into a boot image first.
Here's how you do it...
Change out of the kernel directory back to its parent.
Code:
cd ..
Download tools for manipulating the boot image.
Code:
git clone https://github.com/xiaolu/mkbootimg_tools.git
Download the stock boot image (actually we're using the root ready version for convenience).
Code:
wget -O boot.img http://nigella.modaco.com/files/boot.policypatched.b330.img
Extract the boot image.
Code:
mkbootimg_tools/mkboot boot.img boot.extracted
Copy the new kernel into the extracted boot folder.
Code:
cp out/arch/arm64/boot/Image boot.extracted/kernel
Build a new boot image.
Code:
mkbootimg_tools/mkboot boot.extracted boot.newkernel.img
You now have a new boot image (boot.newkernel.img). All that's left is to flash it to your device! Reboot to bootloader (either using 'adb reboot bootloader' or by powering on with volume down held), flash using 'fastboot flash boot boot.newkernel.img' and then reboot using 'fastboot reboot'. Job done! In the About screen of settings you should see the date of the new kernel and details of your build machine.
Well Done mate! Can we be hopefull about a sort of unoffical cm?
Caleidoscopio said:
Well Done mate! Can we be hopefull about a sort of unoffical cm?
Click to expand...
Click to collapse
Not sure this really helps with that. It's not something I'm looking at atm anyway I'm afraid (due to time constraints).
P
A quick note on building with the 4.9 toolchain - basically, the boot image that gets created is too big. This can be resolved by deleting unnecessarily PNGs in ramdisk/res/images/charger.
P
cant a new kernel be used to extend the battery life?
joelk2 said:
cant a new kernel be used to extend the battery life?
Click to expand...
Click to collapse
With the right tweaks, of course!
P
Sent from my HTC 10 using Tapatalk
I've patched the kernel from .86 to .101. All working well!
P
hi paulobrien, i want to try to compile my own kernel, i'm not an expert of android building but i've compiled varoius linux kernel so my question is where i can find useful patch to add on my kernel? thanks for the help
Do you know to build kernel for honor 7c... Actually I am looking for a nethunter kernel for my device but there is nothing if you know the tutorial please tell me I will try myself because there is no one who comes forward for compiling my kernel
Official Kernel source for huawei honor 7c https://download-c1.huawei.com/down...oadId=98821&version=416732&siteCode=worldwide
Hello Friends~!
I decided to play with some forks of android and chrome os in vmware this week, it was a lot of fun!
A problem I would like to create a solution for, is the inability for vmware tools to install natively.
Here is a toolset I prepared called "droidvmtools" DOWNLOAD
I was able to create this toolset based off of the prelGlibc25 Linux iso that came with VMWare, that is stored in Windows in this directory:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
If you care about the extra steps added to "droidvmtools" I tried to document that process HERE
This exercise is performed using this Prebuilt copy of PrimeOS for VMWare DOWNLOAD
In theory, this method should work on other android images with root access, then likely fail as this example does at the end.
INSTALLATION:
Obtaining the perl binaries:
In termux run the command
Code:
pkg install perl
Then in Root Explorer, go to
Code:
/data/data/com.termux/files/usr/bin
and copy the perl binaries.
Now paste the binaries to:
Code:
/system/bin
To install the Toolset:
Extract droidvmtools and paste it to the root file system. The video goes over this step at 2:34 if you need reference. ( I also used my yt channel to easily dl the tools youtube.com/@jennn/about the tools are there if no usb)
Open a terminal emulator and type:
Code:
su
chmod 777 -R /droidvmtools
Then in Root Explorer, open droidvmtools, select all, copy, and then paste the contents to the root file system
You will be prompted with this message, select these options:
Now when you type:
Code:
perl run.pl
The tools are able to start installation but they crash at this part:
This is the part I am stuck on. I had never heard of recursion until this happened..
Here is a PASTEBIN dump of the code, maybe someone is able to look and see why this would be happening?
This thread is in preparation for a megathread I want to make. If you want to preview some of the images early see HERE
PLEASE NOTE:
I Understand that "Vmware Tools is not supported" in Linux let alone Android, blah blah. Let's try!
I also already know about and have tried every emulator in existence... So Please! Let's refrain from "just use x emulator", this is about problem solving.