Boot device location? - Xiaomi Mi 5s Plus Questions & Answers

Hey devs/custom ROM users. I wanted to know where is your kernle's partition in /dev
Needs root, run this command:
Code:
su -c find dev -name boot

Code:
/dev/block/platform/soc/624000.ufshc/by-name/boot
RR

Awesome​. I've built Kali Nethunter in top of CM-14.1 (and other ROMs based on it), any tester can PM me

Related

Haykuro kernel .config

Can anyone help me extract the .config file from the kernel used on the HTC build?
This is standard linux stuff, the running kernel config is availible in /proc just like in most linux distros.
Code:
adb pull /proc/config.gz /tmp
zcat /tmp/config.gz

[Tutorial] How to compile a kernel module outside the kernel

I've decided to make a short tutorial and present the way I compile kernel modules (outside the kernel sources).
I've built few kernel modules (governors - ineractive and smartass, cifs, nls, etc) and I started receiving private messages asking how I did it.
For kernel modules that come with the kernel itself - cifs / tun for example - they just work if you compile the kernel and activate correct config parameters.
Some other modules (such as the smartass governor that doesn't come with the kernel) you compile outside the kernel source. However they require changes since kernel does not export the symbols the module needs to use - so you have to know what k_all_syms are needed, grab them from the phone and update the kernel module.
So there will be changes there. However, the main steps are:
a) follow tutorials to get the kernel / android ndk to compile. People seem able to do this.
b) then take the module you want (For example cpufreq_smartass.c from here: http://pastebin.com/rR4QUCrk ) and copy it in a new folder on the disk.
c) create a Makefile like the one below, but with your paths of course:
Code:
KERNEL_DIR=/home/viulian/android_platform/kernel-2.1.A.0.435/kernel
obj-m := cpufreq_smartass.o
PWD := $(shell pwd)
default:
$(MAKE) ARCH=arm CROSS_COMPILE=/home/viulian/android_platform/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) clean
d) execute make
Of course, the module source needs to be adjusted as you need to put in the frequencies, and also update the k_all_syms pointers .. But you can retrieve them from /proc/kallsyms on the device itself - just look for the method name, and use the address you see in the log.
If you still can't get it to compile, try to compile a very basic hello_world kernel module. I used the code below when testing:
Code:
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
MODULE_LICENSE("GPL");
MODULE_AUTHOR("viulian, 2011");
MODULE_DESCRIPTION("Demo module for X10i");
int init_module(void)
{
printk("<1>Hello world\n");
// A non 0 return means init_module failed; module can't be loaded.
return 0;
}
void cleanup_module(void)
{
printk(KERN_ALERT "Goodbye world 1.\n");
}
It is not perfect, but if you manage to insmod-it and check dmesg, you will see "Hello world" written there.
One more thing, linux kernel is fussy about the module versions. Even if nothing is changed between two kernel versions related to what a module needs, is enough a small difference in module's modinfo value to make the kernel to refuse the module.
For this, you need to trick your local kernel and adjust EXTRAVERSION value in kernel's main Makefile to have the exact version of the one on the device:
In X10 stock kernel (GB 2.3.3 release), the kernel version is 2.6.29-00054-g5f01537 visible in phone settings.
This means that the kernel on the phone will only accept modules that are compiled for that exact version. But the kernel version is just a string in the module .ko, so is a string comparison - the module might work perfectly, but is not loaded.
There is luck though, the string value comes from a define in kernel's Makefile, which you can change before you compile!
The Makefile in the kernel you are going to use to build the module will have to include these lines at the top:
Code:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 29
EXTRAVERSION = -00054-g5f01537
Other than that, it should work .. Expect phone reboots and difficulty to debug if stuff goes wrong. Android kernel doesn't come with syslog functionality, kernel prints are found in /proc/kmsg. Dmesg works, but you can't execute if if phone reboots.
I usually had to keep another adb shell opening with 'cat /proc/kmsg' which showed as much as possible from the module's outputs.
Happy compiling on your risk!
Good
Sent from my GT-S5570 using Tapatalk
Nice really nice.
Anyone help me.have someone who could compile the linux bluetooth modules please? Iam noob in linux
http://www.multiupload.com/58OPISAYNH
Anyone please can make a video tutorial?
That's really nice of you for sharing this.
Guide to Compiling Custom Kernel Modules in Android
I've spent the better part of today trying to figure out how to compile and load a custom kernel modules in android to aid me in my research. It has been in entirely frustrating experience, as there is almost no documentation on the topic that I can find. Below you will find my attempt at a guide. Hopefully this will help save someone else the hassle.
PREREQUISITES
Disclaimer: This list may be incomplete, since I've not tried it on a fresh install. Please let me know if I've missed anything.
Install the general android prereqs found here .
Download and un(zip|tar) the android NDK found here .
http://developer.android.com/sdk/ndk/index.html
Download and un(zip|tar) the android SDK found here .
http://developer.android.com/sdk/index.html
Download and untar the kernel source for your device. This can usually be found on the website of your device manufacturer or by a quick Google search.
Root your phone. In order to run custom kernel modules, you must have a rooted phone.
Plug your phone into your computer.
PREPARING YOUR KERNEL SOURCE
First we must retrieve and copy the kernel config from our device.
Code:
$ cd /path/to/android-sdk/tools
$ ./adk pull /proc/config.gz
$ gunzip ./config.gz
$ cp config /path/to/kernel/.config
Next we have to prepare our kernel source for our module.
Code:
$ cd /path/to/kernel
$ make ARCH=arm CROSS_COMPILE=/path/to/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- modules_prepare
PREPARING YOUR MODULE FOR COMPILATION
We need to create a Makefile to cross-compile our kernel module. The contents of your Makefile should be similar to the following:
Code:
obj-m := modulename.o
KDIR := /path/to/kernel
PWD := $(shell pwd)
CCPATH := /path/to/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
COMPILING AND INSTALLING YOUR MODULE
Code:
$ cd /path/to/module/src
$ make
$ cd /path/to/android-sdk/tools/
$ ./adb push /path/to/module/src/modulename.ko /sdcard/modulename.ko
RUNNING YOUR MODULE
Code:
$ cd /path/to/android-sdk/
$ ./adb shell
$ su
# insmod /sdcard/modulename.ko
---------- Post added at 07:40 PM ---------- Previous post was at 07:37 PM ----------
IMPORNTANT TOO
Preparing a build environment
To build an Android kernel, you need a cross-compiling toolchain. Theoretically, any will do, provided it targets ARM. I just used the one coming in the Android NDK:
$ wget http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar.bz2
$ tar -jxf android-ndk-r6b-linux-x86.tar.bz2
$ export ARCH=arm
$ export CROSS_COMPILE=$(pwd)/android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
For the latter, you need to use a directory path containing prefixed versions (such as arm-eabi-gcc orarm-linux-androideabi-gcc), and include the prefix, but not “gcc”.
You will also need the adb tool coming from the Android SDK. You can install it this way:
$ wget http://dl.google.com/android/android-sdk_r12-linux_x86.tgz
$ tar -zxf android-sdk_r12-linux_x86.tgz
$ android-sdk-linux_x86/tools/android update sdk -u -t platform-tool
$ export PATH=$PATH:$(pwd)/android-sdk-linux_x86/platform-tools
not yet ((((
Come on, please make video tuto
that's interesting.
Thanks for sharing
Any takers to do a video status? Come on people it would be good for newbies like me and many that tme around. When teaching the community grows.
hi
i'm traing to compile module for acer a500.
but i have got an error: Nothing to be done for `default'.
my makefile:
Code:
obj-m += hello.o
KDIR := /home/hamster/android
PWD := $(shell pwd)
CCPATH := /home/hamster/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
acer kernel code is located in /home/hamster/android
could you help me?
thanks
Thanks man. The step "modules_prepare" is what did the trick for me!
Makefile including tabs
hamsterksu said:
hi
i'm traing to compile module for acer a500.
but i have got an error: Nothing to be done for `default'.
my makefile:
Code:
obj-m += hello.o
KDIR := /home/hamster/android
PWD := $(shell pwd)
CCPATH := /home/hamster/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
acer kernel code is located in /home/hamster/android
could you help me?
thanks
Click to expand...
Click to collapse
This is probably because you need to add a tab in front of your $(MAKE). Without the tab it will not recognize the command.
Help with compiling module
I am trying to compile a module for Galaxy S. I am getting this error.
# insmod hello_world.ko
insmod: init_module 'hello_world.ko' failed (Exec format error)
These are the module related options that I have enabled in the .config
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
Further this is the cat /proc/kmsg out put
<3>[53597.457275] hello_world: version magic '2.6.35.7-I900XXJVP-CL264642 preempt mod_unload ARMv7 ' should be '2.6.35.7-I9000XXJVP-CL264642 preempt mod_unload ARMv7 '
Why am I getting this error??
These are the steps I followed,
1. Downloaded the GT-I9000_OpenSource_GB.zip from samsung open source.
2. Change the EXTRAVERSION to EXTRAVERSION = .7-I900XXJVP-CL264642 (kernel version shown on phone is [email protected] #2)
I tried with EXTRAVERSION = [email protected] as well.
3. Added this line to the main make file -
core-y := usr/ TestModule/
5. Place the TestModule/ with the module code on the root directory.
6. Created the TestModule/Makefile and added this entry
obj-m := hello_world.o
4. On the read me of the kernel source it says to install Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI, which I did.
5. Execute 'make aries_eur_defconfig'.
6. Execute make (again this is how the readme in the source says)
I have compiled this module for the emulator and it works fine, What am I doing wrong here?
Thanks in advance.
hamsterksu said:
hi
but i have got an error: Nothing to be done for `default'.
Code:
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
Click to expand...
Click to collapse
be sure to have {tab} not space or other symbol before: $(MAKE) in:
Code:
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
Hello,
I'm trying to load a module in my GS3 but I encounter problems about version. Maybe it's just a mismatch between the kernel i use to compile and the one on my phone.
I have a 3.0.31-742798 kernel version on my GS3, so I put this info in the makefile like viulian said but it didn't work.
I manage to compile and put the module on the phone, but when I want to insmod it, I've got
Code:
insmod: init_module 'hello_world.ko' failed (Exec format error)
and the /proc/kmsg say
Code:
... disagrees about version of symbol module_layout
And there no config.gz on the /proc/ dir like fabricioemmerick suggest to use
EDIT: I try to modify the symbol by copying the one of module from the phone. Have another error.
btw , with modinfo I found that the compilation always add -gc33f1bc-dirty after the subversion. Maybe something in the compilation goes wrong. Still use the stock kernel and the toolchain from the ndk sourcecode
m00gle said:
Hello,
I'm trying to load a module in my GS3 but I encounter problems about version. Maybe it's just a mismatch between the kernel i use to compile and the one on my phone.
I have a 3.0.31-742798 kernel version on my GS3, so I put this info in the makefile like viulian said but it didn't work.
I manage to compile and put the module on the phone, but when I want to insmod it, I've got
Code:
insmod: init_module 'hello_world.ko' failed (Exec format error)
and the /proc/kmsg say
Code:
... disagrees about version of symbol module_layout
And there no config.gz on the /proc/ dir like fabricioemmerick suggest to use
EDIT: I try to modify the symbol by copying the one of module from the phone. Have another error.
btw , with modinfo I found that the compilation always add -gc33f1bc-dirty after the subversion. Maybe something in the compilation goes wrong. Still use the stock kernel and the toolchain from the ndk sourcecode
Click to expand...
Click to collapse
Maybe your kernel source code version and your phone kernel version is different. If both are 3.0.31 but just the subversion is different, you can
try "insmod -f" to load. The -f option will ignore the version.
How can I get a dmesg of a specific kernel module using adb shell or any other way?
ravike14 said:
How can I get a dmesg of a specific kernel module using adb shell or any other way?
Click to expand...
Click to collapse
I'm not sure I understand the question ... you can just dmesg and grep by the module name ? Or some string that the module outputs ? You have full control
viulian said:
I'm not sure I understand the question ... you can just dmesg and grep by the module name ? Or some string that the module outputs ? You have full control
Click to expand...
Click to collapse
That's the part I don't understand, the grep part.. When I enter grep with my commamd I get as it's not a recognized command.. I'm using Windows is that the reason?
I'm using 'adb shell dmesg > dmesg.txt' how do I add the grep part for it and and the module name.. I did alot research but all are Linux kernel specific debugging guides.. What would be the exact command to grep a specific module.ko logs?
Sent from my HTC_Amaze_4G using XDA Premium 4 mobile app
ravike14 said:
I'm using 'adb shell dmesg > dmesg.txt' how do I add the grep part for it and and the module name.. I did alot research but all are Linux kernel specific debugging guides.. What would be the exact command to grep a specific module.ko logs?
Click to expand...
Click to collapse
I think I understand now
The order is this:
a) DroidSSHd from here: http://code.google.com/p/droidsshd/downloads/list
b) Busybox installer from the market.
c) Putty on your windows to connect to the phone
Now you can dmesg + grep once you are connected to the phone (don't forget to su before and allow DroidSSHd root).
You need to be connected to the phone since it is much more easier. Use the phone as your remote Linux machine.

[Q] Add modules isofs and/or iso9660 to kernel?

Hi all, this is my first post here, so please be gentle
The situation:
I run a Transformer TF300T with a JB 4.1.1 + xubuntu dual boot environment (see http://forum.xda-developers.com/showthread.php?t=2190847). Within ubuntu i want to create a bootable flash drive from an *.iso file. When trying to mount the *.iso, i get the error
Code:
mount: unknown filesystem type 'udf'
or
Code:
$ sudo mount -t iso9660 -o loop *.iso /mnt/iso/
mount: unknown filesystem type 'iso9660'
respectively. Using modprobe returns
Code:
$ sudo modprobe isofs
FATAL: Module isofs not found.
$ sudo modprobe iso9660
FATAL: Module iso9660 not found.
from which i understand that the modules are not included in the kernel i run (which i think is based on rabits' kernel for the tf700).
Is there an obvious way to compile these modules and update my kernel without having to compile a new entire kernel and flash it?
Thx in advance.

Easy build environment with Docker for Zombi & Omni

I like to have the barrier to build a ROM as low as possible. Nowadays Docker is getting to be de-facto delivery model for development environments. So I thought to give a try to create a docker env for building Zombi ROM for Asus TF700 . It can be used also to build TF300 and any OMNI ROM with minor modifications. So here's how to use it:
Preparations with Docker.
This needs to be done only once. I keep the git repo in different path as the docker base, but you can have them in the same directory as done below for simplicity:
Install Docker if you don't have it: https://docs.docker.com/
Make a directory where you have ~70GB free space:
Code:
mkdir -p /srv/docker_android && cd /srv/docker_android
Clone my fork of docker-android-builder
Code:
git clone https://github.com/ikke-t/docker-android-builder.git -b zombi-lp5.1 .
Run Docker image, and build Android.
I do the following in tmux terminal. It starts the docker image for android building. If the docker image is not done once, it will build it first.
Run the script to build docker image:
Code:
./run.sh
After you are in docker promt, build android:
Code:
build-android
Building the ubuntu docker image will take about half an hour, depending on your network speed and computer power. Leave it running and go have dinner. The next time it starts immediately, as it doesn't need to be built again.
The build-android will hog huge amount of bandwith, as it downloads all the android stuff from github, and that's several gigs. Once it's done, it will build the android for you. That again might take up to 5 hours depending on your computing power.
Once the build is done, it will promt you where the zombi rom is. You can access it from your host system, just drop the .zip to your TF700 and flash it
Do not try adb from docker image, it won't work, as the docker image is a black box which cannot access any devices. To exit the buyo terminal once build is ready, just logout normally (ctrl-d).
Have fun!
ikkeT
BTW, the docker-android-build is not originally written by me, credits to those that deserve it. See the Readme. I just made the Zombi changes, and added some selinux stuff that was missing.
if you need space for the exercise...
If you need disk-space for the exercise and you have LVM on your machine, here's what I did on my Fedora:
Code:
sudo mkdir -p /srv/docker_shared/omnirom
sudo lvcreate vg_whipper -n docker_omnirom -L 80GB
echo "/dev/mapper/vg_whipper-docker_omnirom /srv/docker_shared/omnirom ext4 defaults 1 0" | sudo tee -a /etc/fstab
sudo mkfs.ext4 /dev/mapper/vg_whipper-docker_omnirom
sudo mount /srv/docker_shared/omnirom
# in case you have selinux, fix the labeling:
sudo chcon -R -t svirt_sandbox_file_t /srv/docker_shared/omnirom/
See more info on github: https://github.com/ikke-t/docker-android-builder
Nice!
I added the ability to build also TF700T OmniRom, in case you wish to help Joshua fix the selinux problems I tested it builds, didn't flash it though.
Activate the config by uncommenting the lines in config/android-build-vars.sh (and naturally commenting out the current ones)
Code:
## Example - these parameters will build the android-5.1 (lollipop)
## branch of OmniRom for the Asus TF700T
# BUILD_NAME="OmniRom"
# REPO="git://github.com/omnirom/android.git"
# BRANCH="android-5.1"
# DEVICE="tf700t"
# BRLUNCH="brunch"
# MAKE=""
do that, and this is what you get:
Code:
Package complete: /root/android/out/target/product/tf700t/omni-5.1-20150324-tf700t-HOMEMADE.zip

Asus ZenPhone 3 Max ZC520TL MT6737M Kernel Compile Help.

Hello I am having issues compiling this kernel to boot on the phone https://dlcdnets.asus.com/pub/ASUS/...412.436189975.1548547589-306171368.1548198647.
Basically I went through and fixed all the syntax and missing files for kernel and compiled successfully with Linaro-4.9-aarch64 as well as UberTC-4.9-aarch64. And used Android Image Kitchen to replace the kernel with my Image.gz-dtb then flashed the new boot.img with Fastboot and ran Magisk to fix the Ramdisk, but when I boot the phone I get a bootloop I have tried this for every def_config in the /arch/arm64/config folder I also noticed cust.dtsi is missing from the DTS folder. I noticed when fixing the source the drivers for Mediatek MT6737M or MT6735M seem to be incomplete and I ended up replacing the missing files with those from the MT6735 not M variant driver folders.
At this point I just want to see if someone who knows what they are doing can confirm the kernel source is incomplete so Im not wasting my days trying to compile something that is broken, Any help is appreciated thank you.
~Figured it out.
$ chmod -R a+x kernel-3.18
$ cd kernel-3.18
$ mkdir tools/tools
$ mkdir out
$ make <def_config for D281L> ARCH=arm64 O=out
$ make menuconfig ARCH=arm64 O=out
$ make -j6 ARCH=arm64 O=out
I compiled it with ubertc 4.9 aarm64 and made the boot.img with Android Image Kitchen I installed magisk on the phone then I backed up the boot partition to a boot.img and used AIK to swap the zImage with the the new zImage.gz-dtb then I flashed with fastboot and it boots...
Also when unzipping the source non of the file permissions have been set so everything that is executable needs a swift chmod +x <FILE>.

Categories

Resources