I compiled the Xiaomi poco M3 kernel from
https://github.com/MiCode/Xiaomi_Kernel_OpenSource
on branch
lime-q-oss
with commands
export ARCH=arm64 && export SUBARCH=arm64
export CROSS_COMPILE=/opt/aosp_prebuilts/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export DTC_EXT=
make ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- vendor/citrus-perf_defconfig
make ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- EXTRA_CFLAGS="-I $PWD/techpack/display/pll/ -I $PWD/techpack/camera/drivers/cam_sensor_module/cam_cci/ -I $PWD/techpack/camera/drivers/cam_req_mgr -DSDCARDFS_VERSION= -I $PWD/" -j$(nproc --all)
I unpacked the original boot.img from the official ROM from the xiaomi's website, which is the exact ROM I have on my phone:
unpackbootimg -i boot.img -o boot_img_unpacked
Then I repacked with the new kernel:
mkbootimg --kernel "$SCRIPT_DIR/devices/$DEVICE/kernel/k/arch/arm64/boot/Image" \
--ramdisk boot.img-ramdisk \
--dtb boot.img-dtb \
--cmdline "$(< boot.img-cmdline)" \
--base "$(< boot.img-base)" \
--kernel_offset "$(< boot.img-kernel_offset)" \
--ramdisk_offset "$(< boot.img-ramdisk_offset)" \
--tags_offset "$(< boot.img-tags_offset)" \
--dtb_offset "$(< boot.img-dtb_offset)" \
--os_version "$(< boot.img-os_version)" \
--os_patch_level "$(< boot.img-os_patch_level)" \
--pagesize "$(< boot.img-pagesize)" \
--header_version "$(< boot.img-header_version)" \
--hashtype "$(< boot.img-hashtype)" \
--board "$(< boot.img-board)" \
--ramdisk_offset "$(< boot.img-ramdisk_offset)" \
-o ../boot.img
then the phone won't boot. I repacked with the official kernel from boot.img just to see if my repacking method was working, and with the original kernel, it boots. So the problem is probably on the kernel.
Do I have to update some offset? Like, is the dtb offset the same in this kernel as in the official one? I don't know why the dtb offset since the dtb is also in the ramdisk. How do I know if the dtb is being picked from inside the kernel or from the ramdisk?
One thing to notice is that my phone is on Android 11, which uses 4.19.113 while my kernel is 4.19.95 (the latest available on xiaomi's website), which I think was meant for Android 10. However, I think I should at least boot, even if with an older kernel. At least see some error.
I tried fastboot oem enable uart but this option is not supported by the Poco M3, so I guess there's no way to debug over usb like in the Pixel phones. Is there any way to know what's happening? I found some methods for debugging but they all require a kernel that at least boots, but I don't even know if mine is booting. Maybe it is but can't start any graphics?
I made a docker container that facilitates downloading, hacking the kernel and etc: https://github.com/lucaszanella/and...tree/18fbd933094f8ad6e63e65b2795ce80c377f8dc6 so if anyone wants to try, I'd be really glad. I'm working on tutorials to bring more people to kernel hacking, that's why I bought the Poco M3.
Related
I'm building some common gnu/linux console utilities for my Android phone but so far I have only been able to build them statically, with quite a size penalty. Can someone walk me through the steps or point me to a howto for dynamic compiles using arm shared libraries?
Here's the script(s) I'm using for configuration:
Code:
./configure --host=arm-none-linux-gnueabi \
CC="arm-none-linux-gnueabi-gcc" \
CROSS_COMPILE="arm-none-linux-gnueabi-" \
CFLAGS=" -static $_XXFLAGS" \
for shared:
Code:
./configure --host=arm-none-linux-gnueabi \
CC="arm-none-linux-gnueabi-gcc" \
CROSS_COMPILE="arm-none-linux-gnueabi-" \
--enable-shared=yes --enable-static=no
Do I need to make the libs on my android phone avaiable to my cross-compiler? Google isn't helping me here.
Bump. Anyone?
Never mind on this. I learned that using the cross-compiler supplied by Google is the way to go.
This may be of use to some devs here. but I came across a few links that may be old news or maybe not...
here are the files and source
RAZR XT910 Developer Edition 698 MB
RAZR-XT910-DE_01.6.5.1-167_SPU-15-M2-1-DE .zip
http://developer.motorola.com/products/software/
kernel_omap4.tar.gz
http://sourceforge.net/projects/me865.motorola/
http://sourceforge.net/projects/me865.motorola/files/ME865/5.5.1-1_GC-109/
PHP:
1. Create a workspace containing "vanilla" gingerbread release from Google. You may need to apply the following change in build repo to prevent the build from aborting when unexpected user tag is found on some modules:
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 3c11673..ecf611d 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -99,7 +99,7 @@ ifneq ($(filter $(LOCAL_MODULE_TAGS),user),)
$(warning * PRODUCT_PACKAGES section of)
$(warning * build/target/product/core.mk)
$(warning * )
- $(error user tag detected on new module - user tags are only supported on legacy modules)
+ $(warning user tag detected on new module - user tags are only supported on legacy modules)
endif
endif
2. Overlay Motorola-provided published repos on top of original Google versions.
3. Build user space components:
cd <workspace>
. build/envsetup.sh
lunch generic-user
make BOARD_HAVE_BLUETOOTH=true TARGET_BOARD_PLATFORM=omap4 <target>
Where is something like out/target/product/generic/system/bin/bluetoothd
4. Building kernel and kernel modules.
# set this to the top of your android workspace
my_top_dir=....
# set this to where you want kernel intermediates written to
kernel_out_dir=...
# cross compiler
cross=$my_top_dir/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
make -j1 -C $my_top_dir/kernel/omap4 ARCH=arm \
CROSS_COMPILE=$cross \
O=$kernel_out_dir \
KBUILD_DEFCONFIG=mapphone_defconfig \
defconfig modules_prepare
make -C $my_top_dir/kernel/omap4 ARCH=arm \
CROSS_COMPILE=$cross \
O=$kernel_out_dir \
INSTALL_MOD_PATH=$kernel_out_dir \
modules 2>&1
make -C $my_top_dir/kernel/omap4 ARCH=arm \
CROSS_COMPILE=$cross \
O=$kernel_out_dir \
INSTALL_MOD_PATH=$kernel_out_dir \
modules_install
make -C $my_top_dir/kernel/omap4 ARCH=arm \
CROSS_COMPILE=$cross \
O=$kernel_out_dir zImage
make PREFIX=$kernel_out_dir CROSS=$cross CROSS_COMPILE=$cross \
PROCFAMILY=OMAP4430 PROJROOT= HOST_PLATFORM=sdc4430 \
KRNLSRC=$my_top_dir/kernel/omap4 KERNEL_DIR=$kernel_out_dir \
-C $my_top_dir/hardware/ti/wlan/wl1283/platforms/os/linux
# newly built module in $my_top_dir/hardware/ti/wlan/wl1283/platforms/os/linux/tiwlan_drv.ko
make PREFIX=$kernel_out_dir CROSS=$cross CROSS_COMPILE=$cross \
PROCFAMILY=OMAP4430 PROJROOT= HOST_PLATFORM=sdc4430 \
KRNLSRC=$my_top_dir/kernel/omap4 KERNEL_DIR=$kernel_out_dir \
-C $my_top_dir/hardware/ti/wlan/wl1283_softAP/platforms/os/linux
# newly built module in $my_top_dir/hardware/ti/wlan/wl1283_softAP/platforms/os/linux/tiap_drv.ko
make PREFIX=$kernel_out_dir CROSS=$cross CROSS_COMPILE=$cross \
PROCFAMILY=OMAP4430 PROJROOT= HOST_PLATFORM=sdc4430 \
KRNLSRC=$my_top_dir/kernel/omap4 KERNEL_DIR=$kernel_out_dir \
-C $my_top_dir/kernel/omap4 ARCH=arm \
O=$kernel_out_dir \
M=$my_top_dir/vendor/authentec/safenet/vpndriver modules
# newly built module in $my_top_dir/vendor/authentec/safenet/vpndriver/vpnclient.ko
5. Building lbl:
make -f motorola/external/lbl/Makefile all \
LBL_OUT=out/target/product/generic/obj/PARTITIONS/lbl_intermediates HOST_PREBUILT_TAG=linux-x86
I want to mod my stock boot.img for init.d support, but I'm not sure what "base" and "pagesize" parameters to use with mkbootimg. Can anyone help me out?
See here lines 37 and 38
imnuts said:
See here lines 37 and 38
Click to expand...
Click to collapse
Thanks! So, these settings are specific to the kernel. I see that for CM kernel, I would use:
BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_BASE := 0x40000000
I was also trying to modify the stock boot.img for my device (p3110) and I came across a tool called "unmkbootimg" found here:
http://forum.xda-developers.com/showthread.php?t=1877807
When I use this new tool to extract the stock boot.img, I get this:
mkbootimg --kernel kernel.gz --ramdisk initramfs.cpio.gz --base 0x80000000 --cmdline 'console=ttyO2,115200n8 mem=1024M androidboot.console=ttyO2 vram=20M omapfb.vram=0:16M androidboot.carrier=wifi' -o new_boot.img
When I use the tool to extract the CM10 boot.img, I get this:
mkbootimg --kernel kernel.gz --ramdisk initramfs.cpio.gz --base 0x40000000 --pagesize 4096 -o new_boot.img
cool.
Hello to everyone,
I'm trying to boot my Nexus 10 with another kind of kernel version,because I'm not interested to use the Android kernel,but the Ubuntu pure kernel. I've chosen to use the linux-kvm-arm kernel version 3.13 :
These are the commands that I have used :
git clone git://github.com/virtualopensystems/linux-kvm-arm.git
cd linux-kvm-arm
git checkout origin/chromebook-3.13 -b chromebook-3.13
curl http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/config > .config
and then I've added these lines to the .config file :
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ASHMEM=y
CONFIG_ANDROID_LOGGER=y
CONFIG_ANDROID_PERSISTENT_RAM=y
CONFIG_ANDROID_RAM_CONSOLE=y
CONFIG_ANDROID_TIMED_OUTPUT=y
CONFIG_ANDROID_TIMED_GPIO is not set
CONFIG_ANDROID_LOW_MEMORY_KILLER=y
CONFIG_ANDROID_SWITCH is not set
CONFIG_ANDROID_INTF_ALARM is not set
CONFIG_FB_TILEBLITTING=y
CONFIG_PHONE is not set
CONFIG_USB_WPAN_HCD is not set
CONFIG_WIMAX_GDM72XX is not set
CONFIG_ARM_PLATFORM_DEVICES=y
CONFIG_ARM_CHROMEOS_FIRMWARE=y
CONFIG_CHROMEOS=y
CONFIG_CHROMEOS_VBC_BLK=y
CONFIG_CHROMEOS_VBC_EC=y
CONFIG_CHROMEOS_RAMOOPS_RAM_START=0x41f00000
CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE=0x00100000
CONFIG_CHROMEOS_RAMOOPS_RECORD_SIZE=0x00020000
CONFIG_CHROMEOS_RAMOOPS_DUMP_OOPS=0x1
CONFIG_CLKDEV_LOOKUP=y
and then I did :
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make uImage dtbs
from here I've followed the tutorial that I've found here :
http://forum.xda-developers.com/showthread.php?t=1981788
and here :
http://forum.xda-developers.com/showthread.php?t=1981788&page=2
mkdir -p newkernel
cd newkernel
wget -c https://dl.google.com/dl/android/aosp/mantaray-kot49h-factory-174ba74f.tgz
tar xvzf mantaray-kot49h-factory-174ba74f.tgz
cd mantaray-kot49h
unzip image-mantaray-kot49h.zip
wget -c http://android-serialport-api.googlecode.com/files/getramdisk.py
chmod +x getramdisk.py
./getramdisk.py boot.img --> ramdisk.img
wget -c http://android-serialport-api.googlecode.com/files/android_bootimg_tools.tar.gz
tar xvf android_bootimg_tools.tar.gz
./mkbootimg --kernel ../../linux-kvm-arm/arch/arm/boot/zImage --ramdisk ramdisk.img --cmdline bootimg.cfg -o new-boot.img
fastboot flash boot new-boot.img
I think that something is wrong here,because it is not able to boot....I see a black screen and nothing else happens...any ideas ?
Recently I tried to build kernel from source. All went pretty good, kernel works but only with old pre-build dt.img which comes with the boot.img which I use as a base.
To collect dt.img i used compiled from source
gitlab.com/Thecrazyskull/oneplus2/raw/652861ab053df83c61e4c8d4807a52598703a5e6/dtbTool/dtbtool.c
Code:
./dtbTool -s 4096 -o boot/dt.img -p kernel-out/scripts/dtc/ kernel-out/arch/arm64/boot/dts/
or mkqcdtbootimg(allow to specify dtb dir) from sony xperia
To make image I use github.com/luckasfb/mkbootimg-worked-mtk
Code:
./mkbootimg --kernel Image --ramdisk boot.img-ramdisk.gz --cmdline "console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 boot_cpus=0-5 ramoops_memreserve=2M androidboot.selinux=permissive" --base 0 --pagesize 4096 --dt dt.img --ramdisk_offset 01000000 --tags_offset 00000100 -o newboot.img
So, the question, what am I doing wrong?
Use the dtbTool found here https://source.codeaurora.org/quic/kernel/skales/tree/
git clone git://codeaurora.org/quic/kernel/skales
Click to expand...
Click to collapse
I use it in my kernel build helper and it works.
Cozzmy13 said:
Use the dtbTool found here https://source.codeaurora.org/quic/kernel/skales/tree/
I use it in my kernel build helper and it works.
Click to expand...
Click to collapse
Thanks a lot! It worked! Problem solved.
can I use this tool for qualcomm and exynos (samsung) devices?