Building kernel from Xiaomi's source for cereus (probably, cactus too) - Xiaomi Redmi 6 ROMs, Kernels, Recoveries, & Other

Since Xiaomi released source code for kernel, I tried to build it.
https://github.com/Dhoine/android_kernel_cereus
Current status of this - it compiles, boots, but unusable.
Bugs:
Broken bluetooth
Broken wifi
Soft-reboots after some time
Propably, more bugs that remained undiscovered because of reboots.
Tested with miui 9 on cereus 3/32.
--------
You can test builded kernel using this:
GDrive
Use Carliv image Kitchen to repack your rom's boot.img, then flash it via fastboot (UNLOCKED BOOTLOADER REQUIRED). To restore working state after testing, flash stock boot image again.
WARNING
Our kernel uses android regular boot.img format, not MTK.
---------
If you want to build this, any manual for building kernel will fit. I used google's android arm eabi 4.9 toolchain, our arch is arm, defconfig is cereus_defconfig.
For now, I don't have enough time to take a closer look at this (work, university exams), so, any help (last_kmsg, dmesg, pull requests) will be appreciated.

Wait seriously? Does that mean that i can buil LOS rom now? I have my UbuntuVM with whole LOS source code downloaded but i got stuck at no kernel found for cereus. So it might work now(Im extremely new to linux) I'll try to build the rom asap

TanRayCz said:
Wait seriously? Does that mean that i can buil LOS rom now? I have my UbuntuVM with whole LOS source code downloaded but i got stuck at no kernel found for cereus. So it might work now(Im extremely new to linux) I'll try to build the rom asap
Click to expand...
Click to collapse
This kernel for now won't really help with building los. I haven't find any device tree for our SoC (or close). MTK always requre a ton of patches to android sources. But i have reference MTK 9.0 android sources for this SoC - ALPS (can't share, it's probably illegal, but you can find them on 4pda.ru, if you want). It builds on almost unmodified reference device tree, but i haven't tested it on device. First, we need to make this kernel usable.

[email protected] said:
This kernel for now won't really help with building los. I haven't find any device tree for our SoC (or close). MTK always requre a ton of patches to android sources. But i have reference MTK 9.0 android sources for this SoC - ALPS (can't share, it's probably illegal, but you can find them on 4pda.ru, if you want). It builds on almost unmodified reference device tree, but i haven't tested it on device. First, we need to make this kernel usable.
Click to expand...
Click to collapse
This may not really help, but can you try that kernel again after upgrading to MIUI 10.2.4 ?
EDIT : See https://www.kimovil.com/en/list-smartphones-by-processor/mediatek-helio-p22-mt6762 for a list of devices with MT6762. Probably we can check out their trees?
EDIT 2 : It seems like our Redmi 6 is the only device with available kernel source in that list.
EDIT 3 : Try this?

minhducsun2002 said:
EDIT : See https://www.kimovil.com/en/list-smar...lio-p22-mt6762 for a list of devices with MT6762. Probably we can check out their trees?
EDIT 2 : It seems like our Redmi 6 is the only device with available kernel source in that list.
Click to expand...
Click to collapse
Maybe them exists, but I haven't found them.

minhducsun2002 said:
This may not really help, but can you try that kernel again after upgrading to MIUI 10.2.4 ?
---------------------
EDIT 3 : Try this?
Click to expand...
Click to collapse
I finally finished my university exams, so now I have some free time to play with it.
The kernel you link is just forked xiaomi sources merged to linux 4.9 kernel. It shouldn't be buildable at all, since there is the same problem in sources I "fixed" with this.
Probably, this too.

[email protected] said:
I finally finished my university exams, so now I have some free time to play with it.
The kernel you link is just forked xiaomi sources merged to linux 4.9 kernel. It shouldn't be buildable at all, since there is the same problem in sources I "fixed" with this.
Probably, this too.
Click to expand...
Click to collapse
[email protected] said:
Maybe them exists, but I haven't found them.
Click to expand...
Click to collapse
You're right, they're identical.
By the way, I couldn't find any implementation available for our Helio P22; the chipset itself is fairly new, thus not many devices have the source code available.

minhducsun2002 said:
This may not really help, but can you try that kernel again after upgrading to MIUI 10.2.4 ?
Click to expand...
Click to collapse
Ok, i've tested it on latest GS. It seems to work a way better. At least, it doesnt reboot after few seconds of usage. It makes things a lot easier.
Tested a few more things:
-sound - works
-camera (both photo and video) - works
- mobile data - works
- phone calls - work
- dual sim -works
- all sensors work
The only thing i was unable to test is gps. It didn't worked for me, but i was inside 9-floor building near the window to inner corner of building... So idk.
And usb otg - since i don't have adapder.
After this I can tell, that there are only 2 major bugs - wifi and bluetooth.
Maybe gps, fm radio and exfat too. This is modules loading problem, I think (though, there shouldn't be any modules, drivers are marked as built-in in config, but .ko files for them exist in /vendor/lib/modules)

[email protected] said:
Ok, i've tested it on latest GS. It seems to work a way better. At least, it doesnt reboot after few seconds of usage. It makes things a lot easier.
Tested a few more things:
-sound - works
-camera (both photo and video) - works
- mobile data - works
- phone calls - work
- dual sim -works
- all sensors work
The only thing i was unable to test is gps. It didn't worked for me, but i was inside 9-floor building near the window to inner corner of building... So idk.
And usb otg - since i don't have adapder.
After this I can tell, that there are only 2 major bugs - wifi and bluetooth.
Maybe gps, fm radio and exfat too. This is modules loading problem, I think (though, there shouldn't be any modules, drivers are marked as built-in in config, but .ko files for them exist in /vendor/lib/modules)
Click to expand...
Click to collapse
Yeah, Treble definitely makes things easier.
Nevertheless I'm trying to integrate those kernel modules into the compiled zImage - there's no modprobe in Android, sadly.

Adding modules support and disabling modules versions check in config didn't help.
I can't find any source files in kernel sources, from which these modules can be built. Maybe, they are built from separate platform code (they are placed in vendor, so...) Need to download ALPS (brrr, around 50 gb of tar.bz2 archives) to check it.

I've looked into reference mediatek 4.9 kernel sources and found this:
Code:
# Do build-in for Makefile checking
# export CONFIG_WLAN_DRV_BUILD_IN=y
ifeq ($(CONFIG_WLAN_DRV_BUILD_IN),y)
PATH_TO_WMT_DRV = vendor/mediatek/kernel_modules/connectivity/common
PATH_TO_WLAN_CHR_DRV = vendor/mediatek/kernel_modules/connectivity/wlan/adaptor
PATH_TO_WLAN_DRV = vendor/mediatek/kernel_modules/connectivity/wlan/core/gen4m
ABS_PATH_TO_WMT_DRV = $(srctree)/../$(PATH_TO_WMT_DRV)
ABS_PATH_TO_WLAN_CHR_DRV = $(srctree)/../$(PATH_TO_WLAN_CHR_DRV)
ABS_PATH_TO_WLAN_DRV = $(srctree)/../$(PATH_TO_WLAN_DRV)
# check wlan driver folder
ifeq (,$(wildcard $(ABS_PATH_TO_WMT_DRV)))
$(error $(ABS_PATH_TO_WMT_DRV) is not existed)
endif
ifeq (,$(wildcard $(ABS_PATH_TO_WLAN_CHR_DRV)))
$(error $(ABS_PATH_TO_WLAN_CHR_DRV) is not existed)
endif
ifeq (,$(wildcard $(ABS_PATH_TO_WLAN_DRV)))
$(error $(ABS_PATH_TO_WLAN_DRV) is not existed)
endif
$(warning symbolic link to $(PATH_TO_WMT_DRV))
$(warning symbolic link to $(PATH_TO_WLAN_CHR_DRV))
$(warning symbolic link to $(PATH_TO_WLAN_DRV))
$(shell unlink $(srctree)/$(src)/wmt_drv)
$(shell unlink $(srctree)/$(src)/wmt_chrdev_wifi)
$(shell unlink $(srctree)/$(src)/wlan_drv_gen4m)
$(shell ln -s $(ABS_PATH_TO_WMT_DRV) $(srctree)/$(src)/wmt_drv)
$(shell ln -s $(ABS_PATH_TO_WLAN_CHR_DRV) $(srctree)/$(src)/wmt_chrdev_wifi)
$(shell ln -s $(ABS_PATH_TO_WLAN_DRV) $(srctree)/$(src)/wlan_drv_gen4m)
# for gen4m options
export CONFIG_MTK_COMBO_WIFI_HIF=axi
export MTK_COMBO_CHIP=CONNAC
export WLAN_CHIP_ID=6765
export MTK_ANDROID_WMT=y
# Do build-in for xxx.c checking
subdir-ccflags-y += -D MTK_WCN_REMOVE_KERNEL_MODULE
subdir-ccflags-y += -D MTK_WCN_BUILT_IN_DRIVER
obj-y += wmt_drv/
obj-y += wmt_chrdev_wifi/
obj-y += wlan_drv_gen4m/
endif
No such code in xiaomi's source. And this prooves my words: these modules CAN BE BUILT IN and SOURCES FOR THEM ARE IN ALPS. I have to download this ton of ****...
-------
I tried to backpors drivers from 9.0 - no success. It compiles,but doesn't boot. I tried to hack modules loading - no success too.

[email protected] said:
Adding modules support and disabling modules versions check in config didn't help.
I can't find any source files in kernel sources, from which these modules can be built. Maybe, they are built from separate platform code (they are placed in vendor, so...) Need to download ALPS (brrr, around 50 gb of tar.bz2 archives) to check it.
Click to expand...
Click to collapse
Most of the time those binaries are not open-source (you probably know vendor blobs for Google devices are too, but that is a different story). Nevertheless I don't really get why kernel modules are placed in
Code:
/vendor
- after all, mobile devices don't have hot-plugging hardware that requires dynamic LKM loading, why do they separate them out?
I'll attempt to crawl the web for those sources while waiting for Mi Unlock to allow my device being unlocked (the waiting period sucks).

[email protected] said:
I've looked into reference mediatek 4.9 kernel sources and found this:
No such code in xiaomi's source. And this prooves my words: these modules CAN BE BUILT IN and SOURCES FOR THEM ARE IN ALPS. I have to download this ton of ****...
-------
I tried to backpors drivers from 9.0 - no success. It compiles,but doesn't boot. I tried to hack modules loading - no success too.
Click to expand...
Click to collapse
1. Backports? How?
2. In which file did you got those lines?
3. Indeed those modules' source are removed from our tree - if you have the link, I don't really mind having another 50GB occupied on my PC to get those source code.

minhducsun2002 said:
1. Backports? How?
2. Indeed those modules' source are removed from our tree - if you have the link, I don't really mind having another 50GB occupied on my PC to get those source code.
Because attached below is the existence of the modules. /shrug
Click to expand...
Click to collapse
I already said that i have leaked mtk alps 9.0 sources These modules have sources, they are not prebuilt. I managed to built in them, but kernel doesn't boot at all after that. And i can't take any logs because the system dies before adb init.

Ok, after one little, but very cruel hack modules are fixed. Enjoy testing the kernel.
https://drive.google.com/open?id=1Z3p2fAWOZFyp045QMNV6vhLZvj9ZZPSY

[email protected] said:
Ok, after one little, but very cruel hack modules are fixed. Enjoy testing the kernel.
Click to expand...
Click to collapse
does it work well?

Lonewolf_1210 said:
does it work well?
Click to expand...
Click to collapse
Users from 4pda reported it fully working.
---------------------
Soon will be build with usb network adapters support enabled (requested by romanxdream from 4pda).
P.S. I'm not adding everything requested to kernel. But this was only config modification.
-------
I don't check xda often, so there can be a huge delay in my responses.

[email protected] said:
Users from 4pda reported it fully working.
---------------------
Soon will be build with usb network adapters support enabled (requested by romanxdream from 4pda).
P.S. I'm not adding everything requested to kernel. But this was only config modification.
-------
I don't check xda often, so there can be a huge delay in my responses.
Click to expand...
Click to collapse
Great job then, hope for a custom rom coming soon

Ok, download link to all versions. I'll edit the first post later.
https://drive.google.com/open?id=1yEZRS8L8bPgkk58tT5Uv2b-vsLqk7aql

Should we make a telegram group for this?

Related

Need help to recompe kernel for the Nordic HTC Magic to support netfilter/iptables

Hi all!
As many of you might already know we have gotten a HTC Magic here in Scandinavia without support for netfilter and iptables. I've been trying to recompile a new version of the kernel on my x86_64 Archlinux box while adding these lines to the .config which I exported from my rooted phone:
Code:
CONFIG_NETFILTER=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_MATCH_STATE=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=Y
I am a n00b when it comes to compiling, booting and flashing Android stuff and not really a git wizard either. I've downloaded the source, cross-compiled it with my new .config and tried booting it with fastboot only to stare at the HTC logo for 15 minutes before giving up. I suspect that I have probably failed doing the right thing at more than one step in the process but have troubles finding a full guide for Android kernel hacking and loading on the web. I am not even sure if I really compiled the 2.6.27 version used in the daldroid build I have on the phone instead of the latest version in git.
I will provide the step-by-step details below.
1. Downloading and installing the CodeSourcery Cross-compiler from
HTML:
http://www.codesourcery.com/sgpp/lite/arm/portal/release858
2. Downloading setting up the android source code:
Code:
git clone git://android.git.kernel.org/kernel/msm.git
git checkout --track -b msm_htc origin/android-msm-2.6.27
git checkout -f
(here I noticed that the checkouts did not seem to download any extra code, is that expected?)
3. Setting up the cross compilation in the Makefile.
Code:
CROSS_COMPILE=../arm-2009q1/bin/arm-none-linux-gnueabi-
4. Using my .config when running make like this:
Code:
make zImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
(a few additional options not present in the .config-file need to be manually specified before the build starts)
5. Extracting the ramdisk from the nordic daldroid boot.img:
Code:
split_bootimg.pl boot.img
5. Trying the new kernel with the daldroid ramdisk:
Code:
fastboot boot arch/arm/boot/zImage ../../boot.img-ramdisk.daldroid.gz
creating boot image...
creating boot image - 1634304 bytes
downloading 'boot.img'... OKAY
booting... OKAY
6. Fail
I would really appreciate some help to get this going. How can I confirm that 2.6.27 was really used? What other gotchas I have forgotten about?
CONFIG_MACH_SAPPHIRE=y
ridli said:
CONFIG_MACH_SAPPHIRE=y
Click to expand...
Click to collapse
Hmm, unfortunately this option is already set to true.
Perhaps it is mainly a fastboot problem. I dunno.
maybe but why you dont try to make a boot.img and flash it?
did you set the system type to msm? it is important.
copy here your .config, maybe we can try to see if something is wrong or you can do this.
Code:
make ARCH=arm CROSS_COMPILE=../arm-2009q1/bin/arm-none-linux-gnueabi- msm_defconfig
for do a default msm .config.
For what I've seen, you're not making a kernel+ramdisk image, but loading them both splitted. Maybe you're missing the command line parametters?
Also, you can patch the kernel code to make it light up one of the leds so you can know if at least the kernel is actually booting or is getting stucked somewhere. To make this, you can patch, on board-sapphire.c, the init function:
Code:
static void __init sapphire_init(void)
{
int rc;
printk("sapphire_init() revision = 0x%X\n", system_rev);
/*
* Setup common MSM GPIOS
*/
config_gpios();
msm_hw_reset_hook = sapphire_reset;
msm_acpu_clock_init(&sapphire_clock_data);
/* adjust GPIOs based on bootloader request */
printk("sapphire_init: cpld_usb_hw2_sw = %d\n", cpld_usb_h2w_sw);
gpio_set_value(SAPPHIRE_GPIO_USB_H2W_SW, cpld_usb_h2w_sw);
[] INSERT HERE:
gpio_set_value(SAPPHIRE_CPLD_LED_BASE+XX, 1);
Where XX is the led number you want to enable.
Any progresses ?
shwan_3 said:
Any progresses ?
Click to expand...
Click to collapse
Not yet, but the posts above are encouraging. I'll post my .config below.
My .config
I stripped all the '#' commented lines from the file to have it go below the 1000 lines limit.
Code:
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_MMU=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_SUPPORTS_AOUT=y
CONFIG_ZONE_DMA=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_OPROFILE_ARMV6=y
CONFIG_OPROFILE_ARM11_CORE=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_SWAP=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_PANIC_TIMEOUT=5
CONFIG_EMBEDDED=y
CONFIG_UID16=y
CONFIG_KALLSYMS=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_COMPAT_BRK=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_ANON_INODES=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_ASHMEM=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLAB=y
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_KMOD=y
CONFIG_BLOCK=y
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_DEFAULT_AS=y
CONFIG_DEFAULT_IOSCHED="anticipatory"
CONFIG_CLASSIC_RCU=y
CONFIG_ARCH_MSM7XXX=y
CONFIG_ARCH_MSM7201A=y
CONFIG_MACH_TROUT=y
CONFIG_MACH_SAPPHIRE=y
CONFIG_HTC_BATTCHG=y
CONFIG_HTC_PWRSINK=y
CONFIG_MSM_AMSS_VERSION=6225
CONFIG_MSM_AMSS_VERSION_6225=y
CONFIG_MSM_AMSS_SUPPORT_256MB_EBI1=y
CONFIG_MSM_DEBUG_UART_NONE=y
CONFIG_MSM7XXX_USE_GP_TIMER=y
CONFIG_MSM7XXX_SLEEP_MODE_POWER_COLLAPSE_SUSPEND=y
CONFIG_MSM7XXX_SLEEP_MODE=0
CONFIG_MSM7XXX_IDLE_SLEEP_MODE_POWER_COLLAPSE=y
CONFIG_MSM7XXX_IDLE_SLEEP_MODE=1
CONFIG_MSM7XXX_IDLE_SLEEP_MIN_TIME=20000000
CONFIG_MSM7XXX_IDLE_SPIN_TIME=80000
CONFIG_MSM_IDLE_STATS=y
CONFIG_MSM_IDLE_STATS_FIRST_BUCKET=62500
CONFIG_MSM_IDLE_STATS_BUCKET_SHIFT=2
CONFIG_MSM_IDLE_STATS_BUCKET_COUNT=10
CONFIG_MSM_FIQ_SUPPORT=y
CONFIG_MSM_SERIAL_DEBUGGER=y
CONFIG_MSM_SMD=y
CONFIG_MSM_ONCRPCROUTER=y
CONFIG_MSM_RPCSERVERS=y
CONFIG_MSM_CPU_FREQ=y
CONFIG_MSM_CPU_FREQ_MSM7K=y
CONFIG_MSM_CPU_FREQ_SCALING_MAX=528000
CONFIG_MSM_CPU_FREQ_SCALING_MIN=384000
CONFIG_MSM_HW3D=y
CONFIG_MSM_ADSP=y
CONFIG_HTC_HEADSET=y
CONFIG_HTC_ACOUSTIC=y
CONFIG_WIFI_CONTROL_FUNC=y
CONFIG_WIFI_MEM_PREALLOC=y
CONFIG_CPU_32=y
CONFIG_CPU_V6=y
CONFIG_CPU_32v6=y
CONFIG_CPU_ABRT_EV6=y
CONFIG_CPU_PABRT_NOIFAR=y
CONFIG_CPU_CACHE_V6=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_COPY_V6=y
CONFIG_CPU_TLB_V6=y
CONFIG_CPU_HAS_ASID=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y
CONFIG_ARM_THUMB=y
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_PREEMPT=y
CONFIG_HZ=100
CONFIG_AEABI=y
CONFIG_ARCH_FLATMEM_HAS_HOLES=y
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_RESOURCES_64BIT=y
CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
CONFIG_ALIGNMENT_TRAP=y
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_CMDLINE="mem=64M console=ttyMSM,115200n8"
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_DEFAULT_GOV_MSM7K=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_MSM7K=y
CONFIG_BINFMT_ELF=y
CONFIG_PM=y
CONFIG_PM_SLEEP=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
CONFIG_HAS_WAKELOCK=y
CONFIG_HAS_EARLYSUSPEND=y
CONFIG_WAKELOCK=y
CONFIG_WAKELOCK_STAT=y
CONFIG_USER_WAKELOCK=y
CONFIG_EARLYSUSPEND=y
CONFIG_FB_EARLYSUSPEND=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_NETFILTER=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_MATCH_STATE=y
CONFIG_IP_NF_FILTER=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_ASK_IP_FIB_HASH=y
CONFIG_IP_FIB_HASH=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_ANDROID_PARANOID_NETWORK=y
CONFIG_BT=y
CONFIG_BT_L2CAP=y
CONFIG_BT_SCO=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_LL=y
CONFIG_FIB_RULES=y
CONFIG_RFKILL=y
CONFIG_RFKILL_LEDS=y
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
CONFIG_EXTRA_FIRMWARE=""
CONFIG_MTD=y
CONFIG_MTD_PARTITIONS=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_MSM_NAND=y
CONFIG_BLK_DEV=y
CONFIG_MISC_DEVICES=y
CONFIG_ANDROID_PMEM=y
CONFIG_TIMED_OUTPUT=y
CONFIG_TIMED_GPIO=y
CONFIG_BINDER_IPC=y
CONFIG_KERNEL_DEBUGGER_CORE=y
CONFIG_LOW_MEMORY_KILLER=y
CONFIG_LOGGER=y
CONFIG_ANDROID_RAM_CONSOLE=y
CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE=y
CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION=y
CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE=128
CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE=16
CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE=8
CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL=0x11d
CONFIG_HAVE_IDE=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_DEBUG=y
CONFIG_DM_CRYPT=y
CONFIG_DM_UEVENT=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_SMC91X=y
CONFIG_NETDEV_1000=y
CONFIG_NETDEV_10000=y
CONFIG_PPP=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
CONFIG_SLHC=y
CONFIG_MSM_RMNET=y
CONFIG_INPUT=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_KEYRESET=y
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ELAN_I2C_8232=y
CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI=y
CONFIG_INPUT_MISC=y
CONFIG_INPUT_UINPUT=y
CONFIG_INPUT_GPIO=y
CONFIG_INPUT_KEYCHORD=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_MSM=y
CONFIG_SERIAL_MSM_CLOCK_CONTROL=y
CONFIG_SERIAL_MSM_RX_WAKEUP=y
CONFIG_SERIAL_MSM_HS=y
CONFIG_UNIX98_PTYS=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_MSM=y
CONFIG_SENSORS_AKM8976=y
CONFIG_SENSORS_PCA963X=y
CONFIG_SENSORS_MT9T013=y
CONFIG_SENSORS_MT9P012=y
CONFIG_POWER_SUPPLY=y
CONFIG_SSB_POSSIBLE=y
CONFIG_DAB=y
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_MSM=y
CONFIG_FB_MSM_LOGO=y
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_FUNCTION=y
CONFIG_USB_FUNCTION_MSM_HSUSB=y
CONFIG_USB_FUNCTION_ADB=y
CONFIG_USB_FUNCTION_MASS_STORAGE=y
CONFIG_MMC=y
CONFIG_MMC_UNSAFE_RESUME=y
CONFIG_MMC_EMBEDDED_SDIO=y
CONFIG_MMC_PARANOID_SD_INIT=y
CONFIG_MMC_BLOCK=y
CONFIG_MMC_BLOCK_PARANOID_RESUME=y
CONFIG_MMC_MSM7XXX=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_CPLD=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_SLEEP=y
CONFIG_SWITCH=y
CONFIG_SWITCH_GPIO=y
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_INTF_ALARM=y
CONFIG_RTC_DRV_MSM7XXX=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_JBD=y
CONFIG_FS_MBCACHE=y
CONFIG_FS_POSIX_ACL=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
CONFIG_FAT_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
CONFIG_PROC_FS=y
CONFIG_PROC_SYSCTL=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
CONFIG_YAFFS_FS=y
CONFIG_YAFFS_YAFFS1=y
CONFIG_YAFFS_YAFFS2=y
CONFIG_YAFFS_AUTO_YAFFS2=y
CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_MSDOS_PARTITION=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=1024
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DETECT_SOFTLOCKUP=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
CONFIG_SCHED_DEBUG=y
CONFIG_SCHEDSTATS=y
CONFIG_TIMER_STATS=y
CONFIG_DEBUG_PREEMPT=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_SG=y
CONFIG_FRAME_POINTER=y
CONFIG_HAVE_FTRACE=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CRYPTO=y
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
CONFIG_CRYPTO_HW=y
CONFIG_BITREVERSE=y
CONFIG_CRC_CCITT=y
CONFIG_CRC32=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_REED_SOLOMON=y
CONFIG_REED_SOLOMON_ENC8=y
CONFIG_REED_SOLOMON_DEC8=y
CONFIG_PLIST=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
biktor_gj said:
For what I've seen, you're not making a kernel+ramdisk image, but loading them both splitted. Maybe you're missing the command line parametters?
Where XX is the led number you want to enable.
Click to expand...
Click to collapse
Yeah, that could be a problem. I was under the impression that fastboot built the boot.img itself before transfering the kernel to the phone.
Interesting test with the leds. I'll check it out if I don't solve this.
I'm working on the exact same thing. can you contact me via im? pm for my screen names
I think that HTC patched some things in that are not available in the source tree... So I doubt that you'll be able to get a kernel running build from source. If you do happen to make it run let us know
Amon_RA said:
I think that HTC patched some things in that are not available in the source tree... So I doubt that you'll be able to get a kernel running build from source. If you do happen to make it run let us know
Click to expand...
Click to collapse
I would not be suprised at all if that was the case. However, since the Linux kernel is GPL, such patches, as I understand it, also need to be under the GPL and made available upon request. Is there a public HTC source tree anywhere?
And btw, how can I fix the "recompile" misspelling in the title of this thread? It is driving me insane
This might be a very stupid question, but here it goes:
Shouldn't it be possible to build all the extra netfilter/iptables support for the vanilla 2.6.27 kernel as modules and insmod them when running HTC's kernel? Or will that result in swift and horrible death?
i don't see why it wouldn't. we wouldn't need the source for htc's kernel then, right? just figure out how to build the modules? isn't that kind of how proprietary video drivers work for linux?
EDIT: Modules will work, that is certain. A little googling confirmed that's how wlan and such work (on Android)
EDIT 2: It seems like there is .config for the kernel on the phone that can be used with the standard 2.6.27 kernel source to build the android kernel.
EDIT 3: found the kernel here http://github.com/zhoukejun/android-2.6.27-yf255/tree/master
sammypwns said:
i don't see why it wouldn't. we wouldn't need the source for htc's kernel then, right? just figure out how to build the modules? isn't that kind of how proprietary video drivers work for linux?
EDIT: Modules will work, that is certain. A little googling confirmed that's how wlan and such work (on Android)
EDIT 2: It seems like there is .config for the kernel on the phone that can be used with the standard 2.6.27 kernel source to build the android kernel.
EDIT 3: found the kernel here http://github.com/zhoukejun/android-2.6.27-yf255/tree/master
Click to expand...
Click to collapse
I wonder if access to the kernel can help with the Bluetooth problems in the Hero ROM?
Bump!
Is there any news about iptables on PVT 32A based sapphire?
gboddina said:
Bump!
Is there any news about iptables on PVT 32A based sapphire?
Click to expand...
Click to collapse
Well. The kernels that we successfully have built by cross-compiling refuse to boot. Looking at the config.gz that the phone exports and trying
Code:
make oldconfig
we have learnt that HTC has a lot of parameters specified for code that appears not to be in the standard android 2.6.27 kernel source tree. We would be very very happy if someone around here could point us to the repository holding HTC specific patches and code for the Magic/Sapphire.
Based on http://www.mail-archive.com/[email protected]/msg00442.html , it seems we need to find the source of the android-msm-htc-2.6.27 kernel.
Which don't seems to be public.
gboddina said:
Based on http://www.mail-archive.com/[email protected]/msg00442.html , it seems we need to find the source of the android-msm-htc-2.6.27 kernel.
Which don't seems to be public.
Click to expand...
Click to collapse
But it has to be made public if requested. That is essence of the GPL.
i emailed them a while ago. i also talked to someone who has gotten his own kernels to boot but on the dream dev phone

Kexec-hardboot patch

In this post, I would like to explain what kexec-hardboot patch is and also bring it to light a bit more since until now, it was only burried in MultiROM thread.
@kernel developers: I would like to ask you to merge this patch to your kernels, because it is essential part of MultiROM - it allows me to boot any kernel without changing the boot partition. I realize that it is no small request, but the patch is not big, touches relatively stable parts of kernel and should not cause any problems. Thank you.
What is kexec?
It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 7. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a commong thing among Android devices, which is why kexec-hardboot was made.
What is the difference between normal and hardboot exec?
Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Another difference is that both kernels must be patched. The "host" kernel requires a full patch, the one which is being kexecd' requires only two small compatibility patches.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Patches:
Full kernel patch: https://gist.github.com/4558647, 4.1 kernel repo, cm 10.1 kernel repo
This is the full kernel patch. Kernels with this patch can be both "host" and "guest" kernels.
Related CONFIG options:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_ATAGS_PROC=y
CONFIG_GROUPER_HARDBOOT_RECOVERY=n
First three options must be enabled. Last one, GROUPER_HARDBOOT_RECOVERY, specifies if the kexec call should reboot to normal mode or to recovery. This can be useful if you don't have the kernel in boot partition but only as kernel in recovery partition. You usualy want to disable this option.​
Compatibility patch: https://gist.github.com/4458581
This patch only makes the kernel bootable via kexec, ie. it can't be the host kernel. This was made for Ubuntu kernel (and it was accepted), because I did not want to drag the whole patch in there. If your kernel is for Android ROMs, you should use the full patch.​
Userspace kexec binary: View attachment kexec-tools.zip
That ZIP file contains kexec source, patches and README. It is from the original patch from Mike Kasick. It also contains precompiled, statically linked kexec binary, so you probably just want to use that.​
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0x85000000 --command-line="$(cat /proc/cmdline)"
kexec -e
Note the command line parameter - cmdline from bootloader is not added automatically, you have to put it there by yourself.
Currently used by:
MultiROM - I use it to boot different kernels (eg. Ubuntu).
MOSLO - Part of Plasma Active for Nexus 7, also usefull tool for every N7 developer - read more: http://ruedigergad.com/2012/12/09/nexus-7-easily-flashaccess-entire-userdata-partition/
Authors:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
Hi Tasssadar,
im trying to get this to work on the HOX in order to have a shot at multiboot,
the patched applied with no problem... however on compiling i gett this error
"Adress for kexec hardboot page not defined"
ask this error naturely defined to kick in with every device beside N7 i that comment completely....
and that ended up giving me an error about KEXEC_HB_PAGE_ADDR not defined,
so i readded it, but i removed the "#if defined(CONFIG_MACH_GROUPER)"
now trying to compile it, its gets pretty close to the end... but failed with unexpected string error at line OUTPUT_ARCH(arm) in file linux/arch/arm/boot/compressed/vmlinux.lds
Code:
/*
* linux/arch/arm/boot/compressed/vmlinux.lds.in
*
* Copyright (C) 2000 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
/DISCARD/ : {
*(.ARM.exidx*)
*(.ARM.extab*)
/*
* Discard any r/w data - this produces a link error if we have any,
* which is required for PIC decompression. Local data generates
* GOTOFF relocations, which prevents it being relocated independently
* of the text/got segments.
*/
*(.data)
}
. = 0;
_text = .;
.text : {
_start = .;
*(.start)
*(.text)
*(.text.*)
*(.fixup)
*(.gnu.warning)
*(.glue_7t)
*(.glue_7)
}
.rodata : {
*(.rodata)
*(.rodata.*)
}
.piggydata : {
*(.piggydata)
}
. = ALIGN(4);
_etext = .;
.got.plt : { *(.got.plt) }
_got_start = .;
.got : { *(.got) }
_got_end = .;
_edata = .;
. = ALIGN(8);
__bss_start = .;
.bss : { *(.bss) }
_end = .;
. = ALIGN(8); /* the stack must be 64-bit aligned */
.stack : { *(.stack) }
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
}
also, im booted into windows now... so i can't provide the exact error.
I'm afraid "comment everything which doesn't work" won't work here. The KEXEC_HB_PAGE_ADDR and END_MEM is device-specific, it will most likely be different for HTC One X. You can find out what address is it supposed to be by examining /proc/iomem on your device. For example, here's memory map from grouper:
Code:
...
80000000-be9fffff : System RAM
80008000-808faba7 : Kernel text
80940000-80b8228f : Kernel data
beb00000-bebfffff : ram_console
...
So, for grouper, END_MEM is 0xbe9fffff + 1 = 0xbea00000.
KEXEC_HB_PAGE_ADDR is located 1MB before console RAM, which is in this case also immediatelly after System RAM, so for grouper, it is also 0xbea00000.
but failed with unexpected string error at line OUTPUT_ARCH(arm) in file linux/arch/arm/boot/compressed/vmlinux.lds
Click to expand...
Click to collapse
That doesn't seem to be related to this patch. Are you using correct cross-compiler?
Tasssadar said:
I'm afraid "comment everything which doesn't work" won't work here. The KEXEC_HB_PAGE_ADDR and END_MEM is device-specific, it will most likely be different for HTC One X.
Click to expand...
Click to collapse
i figured
but im walking you through what i did.
You can find out what address is it supposed to be by examining /proc/iomem on your device. For example, here's memory map from grouper:
Code:
...
80000000-be9fffff : System RAM
80008000-808faba7 : Kernel text
80940000-80b8228f : Kernel data
beb00000-bebfffff : ram_console
...
So, for grouper, END_MEM is 0xbe9fffff + 1 = 0xbea00000.
KEXEC_HB_PAGE_ADDR is located 1MB before console RAM, which is in this case also immediatelly after System RAM, so for grouper, it is also 0xbea00000.
Click to expand...
Click to collapse
Code:
7d000000-7d003fff : tegra-udc.0
7d000000-7d003fff : tegra-otg
7d000000-7d003fff : tegra-udc
7d004000-7d007fff : tegra-ehci.1
80000000-beafffff : System RAM
80008000-8094000f : Kernel text
809a8000-810b940f : Kernel data
beb00000-bebfffff : ram_console
bec00000-beffffff : fbmem
bf000000-bf7fffff : fbmem
0xbeafffff + 1 = 0xbeb00000
grrr that would put me inside the ram_console...
aaaa would it wok if i used the address before??
7d00800
Edit:
or did your ram RAM end earlier because you set you END_MEM 0xbea00000
in that case, it works out just the same with the HOX
That doesn't seem to be related to this patch. Are you using correct cross-compiler?
Click to expand...
Click to collapse
i would have guessed so, but the kernel compiled and is working before the patch.
im using the one provided by google (Android NDK r9) while it contains booth gcc 4.6/4.8 im using 4.6 (arm-linux-androideabi-)
The patch will move ram_console 1MB further, see https://gist.github.com/Tasssadar/4558647#file-n7_hardboot-diff-L387 . You'll have to modify this part of the patch, it will be in different file for your device.
Tasssadar said:
The patch will move ram_console 1MB further, see https://gist.github.com/Tasssadar/4558647#file-n7_hardboot-diff-L387 . You'll have to modify this part of the patch, it will be in different file for your device.
Click to expand...
Click to collapse
HOX is also a Tegra 3 device... so im guessing i wont need to touch a thing?
also note... that iomem provided is from an unpatched kernel (as i cant compile a patched one)
also,
im currently on freenode #htc-one-x
if you dont mind joining.
I've been looking through the kexec-hardboot patch these last few days, trying to actually understand it instead of just blindly porting it and after several hours of messing with assembler with no means to debug it, I've managed to remove the need for guest kernel to be patched. This is not really useful for grouper, since thanks to multirom and accepting kernel devs, nearly every third-party kernel has the proper patches. But, if I'll port multirom to some other device (hello, flo), it will be very useful
To know more see the changes in this commit, but you'll probably need to understand how the patch does things: https://github.com/Tasssadar/androi...mmit/2ce4130061f72430a8ddfde25346c4e528c5c30b
@mkasick: Could you please look over this? I'm afraid there's some good reason why you didn't do this in the first place, like rewriting some part of memory which shouldn't be rewritten or something like that. Thank you.
Tasssadar said:
I've been looking through the kexec-hardboot patch these last few days, trying to actually understand it instead of just blindly porting it and after several hours of messing with assembler with no means to debug it, I've managed to remove the need for guest kernel to be patched. This is not really useful for grouper, since thanks to multirom and accepting kernel devs, nearly every third-party kernel has the proper patches. But, if I'll port multirom to some other device (hello, flo), it will be very useful
To know more see the changes in this commit, but you'll probably need to understand how the patch does things: https://github.com/Tasssadar/androi...mmit/2ce4130061f72430a8ddfde25346c4e528c5c30b
@mkasick: Could you please look over this? I'm afraid there's some good reason why you didn't do this in the first place, like rewriting some part of memory which shouldn't be rewritten or something like that. Thank you.
Click to expand...
Click to collapse
Perfect timing, just finished my last exam
Edit:
Also, this applies on top of the original patch right??
Edit2:
i can't seem to get it to kexec boot, but i didn't do much testing, maybe 2morrow night!
Edit3:
fixed, it was a problem with min-addr,
changed it to 0x82000000 and it worked
One more question...
TEGRA_PMC_BASE is also device specific, ain't it???
So, for a Qualcomm device, what should I be using? I am guessing it is MSM_RPM_BASE, which I got from here: http://forum.xda-developers.com/showpost.php?p=31127486&postcount=7
Yes, it is SoC-specific. This is using some special register to reset the chip, I'm not sure if that is available on msm chips - probably yes, but in some different form. Your best chance is to examine restart sequence in arch/arm/mach-msm/restart.c and port it to assembler.
Tasssadar said:
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0xA0000000 --command-line="$(cat /proc/cmdline)"
kexec -e
Click to expand...
Click to collapse
The address of 0xA0000000 is not necessarily the best choice going forward. It originally made perfect sense, as it is well above everything else. But now that we can boot unpatched guest kernels, we can hit the interesting situation where the guest decompression may take a full minute. At least it's when I've seen on the Ouya game console that's running the next chip after Grouper.
When I realized what's going on, I changed to 0x8E000000, as it gets me just below the 256 MB limit of cache-enabled memory that's present on a typical guest at that early decompression stage. It's enough to hold a typical 8 MB boot image kernel/ramdisk. Now the guest kernel startup is fast in all cases.
Thank you Tasssadar for continuing your work in this area, especially with finding that way to allow unpatched guests.
Indeed, that's actually what I'm using in MultiROM for flo and mako (and grouper, but it is useless 'cause not all 3rd-party kernels have been updated), I just kinda "forgot" to update these threads.
Would it work on devices with locked bootloaders (Xperias). I mean :does the idea of this patch would also work on bootloader unlock allowed :no devices?
Sent from my LT22i using xda app-developers app
I am trying to build a kexec patched kernel integrated into a ROM. I make sure that the following code is there in the defconfig:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_ATAGS_PROC=y
The ROM works well, except that it does not boot my secondary ROMs - kexec hardboot patch missing. I have multi ROM and TWRP recovery installed
What am I missing?
Logs or it didn't happen.
Show me dmesg from normal boot into android, with MultiROM and your kernel installed.
Code:
adb shell
su
dmesg > /data/local/tmp/dmesg.txt
exit
exit
adb pull /data/local/tmp/dmesg.txt
Porting?
Tassadar which things do I need to boot kexec kernel on my device (Motorola Electrify 2) .
@Tasssadar, Sorry for picking up this kinda "old topic" but I'm sadly experiencing some problems while trying to port kexec-hardboot to the Sony Xperia Z2 (aka sirius). I applyed all needed commits (cherry-picked from a apparently working Z1 repo for stock kernel) to my CM based custom kernel (https://github.com/Myself5/android_kernel_sony_msm8974/tree/kexec-cm-12.0) and it does not boot at all. It's stuck on the Sony Logo, and it seems like I can't get any log either. I also tryed the stock cm kernel with the patch (https://github.com/Myself5/android_kernel_sony_msm8974-kexec) cause I tought it might be some incompatibility, but sadly it wasn't. Hope you have any ideas to solve my problems, cause I'm out of ideas ATM. I also checked the kexec commits for other devices (namely the One Plus One) and it seems like I got everything needed.
Thanks in Advance
Tasssadar said:
In this post, I would like to explain what kexec-hardboot patch is and also bring it to light a bit more since until now, it was only burried in MultiROM thread.
@kernel developers: I would like to ask you to merge this patch to your kernels, because it is essential part of MultiROM - it allows me to boot any kernel without changing the boot partition. I realize that it is no small request, but the patch is not big, touches relatively stable parts of kernel and should not cause any problems. Thank you.
What is kexec?
It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 7. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a commong thing among Android devices, which is why kexec-hardboot was made.
What is the difference between normal and hardboot exec?
Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Another difference is that both kernels must be patched. The "host" kernel requires a full patch, the one which is being kexecd' requires only two small compatibility patches.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Patches:
Full kernel patch: https://gist.github.com/4558647, 4.1 kernel repo, cm 10.1 kernel repo
This is the full kernel patch. Kernels with this patch can be both "host" and "guest" kernels.
Related CONFIG options:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_ATAGS_PROC=y
CONFIG_GROUPER_HARDBOOT_RECOVERY=n
First three options must be enabled. Last one, GROUPER_HARDBOOT_RECOVERY, specifies if the kexec call should reboot to normal mode or to recovery. This can be useful if you don't have the kernel in boot partition but only as kernel in recovery partition. You usualy want to disable this option.​
Compatibility patch: https://gist.github.com/4458581
This patch only makes the kernel bootable via kexec, ie. it can't be the host kernel. This was made for Ubuntu kernel (and it was accepted), because I did not want to drag the whole patch in there. If your kernel is for Android ROMs, you should use the full patch.​
Userspace kexec binary: View attachment 1653562
That ZIP file contains kexec source, patches and README. It is from the original patch from Mike Kasick. It also contains precompiled, statically linked kexec binary, so you probably just want to use that.​
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0x85000000 --command-line="$(cat /proc/cmdline)"
kexec -e
Note the command line parameter - cmdline from bootloader is not added automatically, you have to put it there by yourself.
Currently used by:
MultiROM - I use it to boot different kernels (eg. Ubuntu).
MOSLO - Part of Plasma Active for Nexus 7, also usefull tool for every N7 developer - read more: http://ruedigergad.com/2012/12/09/nexus-7-easily-flashaccess-entire-userdata-partition/
Authors:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
Click to expand...
Click to collapse
I'm sorry for picking up this older topic as well, but I always played with the thought of merging kexec support into a kernel and I'm doing one right now.. But my secondary device is a LG G2 and since the era of Lollipop began, somehow MultiBoot just stopped working and nobody can figure out why. I think they even started to build some new concept now.. So before I spark a heated debated by Note 4 users I'd love to know if you have any idea if this patch is still applicable? Altough the only way to find out is to probably just try it lol.
Tasssadar said:
In this post, ....
Click to expand...
Click to collapse
Bro can you please mention on your wiki that kexec isnt supported for x64 devices? It will be great help and save developers hours! I was porting for oneplus 2 when a dev told me that kexec isnt there for x64. I was shocked
Is any alternative available for that? Please reply! Thanks.
All other devs, who cant make multirom to work (lollipop is the x64 era) stop working. Kexec isnt supported for x64. Find an alternative for it.
Can Anyone help me to port this? Here is my patched kernel (ignore arch/arm64) and this is /proc/iomem.
Code:
80000000-854fffff : System RAM
80008000-80fa43ef : Kernel code
81112000-817bf797 : Kernel data
8cb00000-9fefffff : System RAM
9ff00000-9ff3ffff : persistent_ram
9ff40000-9ff7ffff : persistent_ram
9ff80000-9fffffff : persistent_ram
a0000000-ffffefff : System RAM
For kexec_hb_page_addr the value i inseted is 85500000 coz as tasssadar said 884fffff + 1 = 85500000, but I don't know what value add for
Code:
#elif defined(CONFIG_ARCH_MSM8916)
/* Restart using the PMIC chip, see mach-msm/restart.c */
ldr r0, =MSM8916_HARDBOOT
mov r1, #0
str r1, [r0, #0]
loop: b loop
MSM8916_HARDBOOT, and if I compile the kernel it stucks on samsung logo.

Requesting Repository Forks

If you wish to request omni forks a repository from AOSP, in order to implement a patch into omni, please post this request here. Eventually this will be carried out via jira (http://jira.omnirom.org)
When posting, please give the path to the repository, and a link to what you want to merge, or a description.
For example if you wish to cherry pick a patch into it, a link to the patch and brief description of the reason for the patch.
We'll then have that repository forked and made available on github and gerrit, permitting you to submit your change.
Before you request, please check on github to ensure it isn't already forked!
For example :
frameworks/base - Needing forked so I can introduce multi window functionality (link here to information)
hardware/broadcom/libbt - Mainly for board-specific configurations (link), but newer CM commits also look promising.
If new device bringups aren't planned yet, ignore the followings:
device/lge/p880 and kernel/lge/p880 - Device bringup (kernel has a non-standard naming at CM repo, it should be android_kernel_lge_x3 (x3 is the board name))
vendor/lge (maybe Omni should create one from scratch)
Adam77Root said:
hardware/broadcom/libbt - Mainly for board-specific configurations (link), but newer CM commits also look promising.
If new device bringups aren't planned yet, ignore the followings:
device/lge/p880 and kernel/lge/p880 - Device bringup (kernel has a non-standard naming at CM repo, it should be android_kernel_lge_x3 (x3 is the board name))
vendor/lge (maybe Omni should create one from scratch)
Click to expand...
Click to collapse
We do have a vendor/lge with just mako, although I'm not sure if its current location.
Vendor blob repos are a legal mess, which is why CM kept them at TheMuppets. We'll likely do something similar if we haven't already (I haven't synced since coming home.) Among other reasons to keep them separate is in the case of a DMCA takedown - usually that happens only to a single repo (see the HTC vendor repos earlier this year) but there's always the risk that damage might be more widespread.
android_external_clang
http://review.cyanogenmod.org/#/c/29799/2
Needed for building my msm8960 device (Motorola Photon Q, xt897c).
arrrghhh said:
android_external_clang
http://review.cyanogenmod.org/#/c/29799/2
Needed for building my msm8960 device (Motorola Photon Q, xt897c).
Click to expand...
Click to collapse
CM bootable recovery and some commits over system core
Black_Prince said:
CM bootable recovery and some commits over system core
Click to expand...
Click to collapse
No for CWM - We're working on forking TWRP in, but some fixes still need to be made to allow it to work on devices with unified recovery/boot image. (Probably one of the biggest holdups for the exynos 4210 family - Sonys with unified boot/recovery can at least use Dees_Troy's FOTAKernel trick).
Getting CWM to build in a tree requires hacks all over the tree in multiple repositories. TWRP is much more self-contained, but needs some tweaks to the build system in order to get it to build properly on a userdebug (as opposed to eng) build.
Entropy512 said:
No for CWM - We're working on forking TWRP in, but some fixes still need to be made to allow it to work on devices with unified recovery/boot image. (Probably one of the biggest holdups for the exynos 4210 family - Sonys with unified boot/recovery can at least use Dees_Troy's FOTAKernel trick).
Getting CWM to build in a tree requires hacks all over the tree in multiple repositories. TWRP is much more self-contained, but needs some tweaks to the build system in order to get it to build properly on a userdebug (as opposed to eng) build.
Click to expand...
Click to collapse
Hmm but until the twrp is ported should i test build for some galaxy devices like SG S2 note 1 with cwm ?
It will make me to push changes to git in device tree ... and will be easy to add support
Black_Prince said:
Hmm but until the twrp is ported should i test build for some galaxy devices like SG S2 note 1 with cwm ?
It will make me to push changes to git in device tree ... and will be easy to add support
Click to expand...
Click to collapse
I'll pull up a remote to use for bootable/recovery until we fork (unless plodey already forked it) from TWRP, won't be able to provide it until tonight.
However, right now, it will only build a working recovery if you do an eng build instead of userdebug. If Dees_Troy's talk at BABBQ is ever posted, that's what I was talking about when I trolled him at the end.
Something like:
Code:
. build/envsetup.sh && brunch custom_n7000-eng
or something like that.
Old
def WriteRawImage(self, mount_point, fn):
"""Write the given package file into the partition for the given
mount point."""
fstab = self.info["fstab"]
if fstab:
p = fstab[mount_point]
partition_type = common.PARTITION_TYPES[p.fs_type]
args = {'device': p.device, 'fn': fn}
if partition_type == "MTD":
self.script.append(
'write_raw_image(package_extract_file("%(fn)s"), "%(device)s");'
% args)
elif partition_type == "EMMC":
self.script.append(
'package_extract_file("%(fn)s", "%(device)s");' % args)
Requested
def WriteRawImage(self, mount_point, fn):
"""Write the given package file into the partition for the given
mount point."""
fstab = self.info["fstab"]
if fstab:
p = fstab[mount_point]
partition_type = common.PARTITION_TYPES[p.fs_type]
args = {'device': p.device, 'fn': fn}
if partition_type == "MTD":
self.script.append(
'package_extract_file("%(fn)s", "/tmp/boot.img");'
'write_raw_image("/tmp/boot.img", "%(device)s");' % args
% args)
elif partition_type == "EMMC":
self.script.append(
'package_extract_file("%(fn)s", "%(device)s");' % args)
elif partition_type == "BML":
self.script.append(
('assert(package_extract_file("%(fn)s", "/tmp/%(device)s.img"),\n'
' write_raw_image("/tmp/%(device)s.img", "%(device)s"),\n'
' delete("/tmp/%(device)s.img"));') % args)
else:
raise ValueError("don't know how to write \"%s\" partitions" % (p.fs_type,))
Flash error in write raw image ...
Also can u cherry pick these commits https://github.com/CyanogenMod/android_system_core/commits/cm-10.2/mkbootimg/unpackbootimg.c
My internal SD card isnt got recognsied , there must be some commits missing in vold ...
I dont even know it got formatted or what in flashing ...
All things working WIFI BLUTOOTH TETHERING CALL DATA MSG MMS OMNITORCH
Also u may have look over https://github.com/CyanogenMod/andr...mmit/f22626cdbecfe27c96f205710173458eab14e1a1
and https://github.com/CyanogenMod/andr...mmit/aee5f78ddec238cec016849acaf1d3007b8b1507
https://android.googlesource.com/platform/hardware/broadcom/libbt
Must haz patch:
https://github.com/CyanogenMod/andr...mmit/4028192a4fe8289bf9b7fb202a2bb2c0d85d98c3
//edit: xplod sorted it out already.
android_packages_apps_PackageInstaller
For
HALO and a feat which enables us to see version of the installed and gonna install app
I need this to make it work with my Samsung galaxy s4
I'm not sure if this is the correct thread, but the following two would be great for i9305 support
smdk4412-qcom-common -> needed for i9305 and t0lte (EDIT: I see this one has now been added)
Thanks!
Hey @pulser_g2,
wondering if i could have the following repositories added in for jf devices,
all features are fully functional with these repositories : branch: cm-10.2 for all
device_samsung_jf-common
android_device_samsung_jflteatt
android_kernel_samsung_jf
CyanogenMod/android_hardware_samsung
CyanogenMod/android_device_samsung_msm8960-common
CyanogenMod/android_device_samsung_qcom-common
@pulser_g2
I just talked to @maxwen and he told me i should post here the needed stuff:
I managed to fix the radio issues today on m7, but i need additionally these commits:
https://github.com/TheMuppets/proprietary_vendor_htc/commit/7bbbe83823525090e7d94c47b439c09a254b380f
https://github.com/TheMuppets/proprietary_vendor_htc/commit/19ed957678d13b489da78d704b27811030688078
https://github.com/TheMuppets/proprietary_vendor_htc/commit/51b006bc8f05757c7dd82361ce6d985e996af360
and please DO NOT merge this: https://github.com/TheMuppets/proprietary_vendor_htc/commit/2b86687a460030199fa42d49207957ce285c1a53
as its not needed and breaks build (I allready have everything in m7-common so no need for vendor)
Thanks in advance
@pulser_g2
we dont need to update anything, please forget my post above, i managed to get it working without all these commits and the right vendor
hardware/qcom/gps - Needing forked so I can build the needed GPS module into my Omnirom build.
The link to this repository is: https://github.com/CyanogenMod/android_hardware_qcom_gps/tree/cm-10.2
I hope it gets included, this saves me a ton of time pulling stuff from other repositories.
Greetings PsychoGame
Galaxy S I9000 (galaxysmtd)
@pulser_g2 Device repos are already forked. Kernel is missing: https://github.com/OmniGalaxyS/android_kernel_samsung_aries
It has android-4.3 and android-4.4 branches up.
Device rocking with Omni!
See you!
Fail
PsychoGame said:
hardware/qcom/gps - Needing forked so I can build the needed GPS module into my Omnirom build.
The link to this repository is: https://github.com/CyanogenMod/android_hardware_qcom_gps/tree/cm-10.2
I hope it gets included, this saves me a ton of time pulling stuff from other repositories.
Greetings PsychoGame
Click to expand...
Click to collapse
I also need android_hardware_qcom_gps (probably best from https://github.com/markcs/android_hardware_qcom_gps/tree/cm-11.0)

[FAQ/HOWTO] An introduction to how-to-build a kernel for MT6589

Hi guys,
I was working on this since some time and here it is
Please read FAQ first
FAQ :
Can I compile a MT6589 kernel for every phone ?
As you know, a MT6589 kernel won't fit in every MT6589 smartphone because of specific configs/files in the kernel source tree.
So, if you compile my kernel which is expected to work on a Faea F2S don't expect it to work on a Acer Liquid E3 for example.
Conclusion : You have to get the kernel source for your phone​
How can I check my kernel source ?
Of course, this is not enough to see "source code for ZTE N986", you have to check if it's full or not and if it works.
Most people don't know what is working kernel source. You just have to read the GPL guidelines that every manufacturer have to complain with :
“ The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. ”
The part which has not to be included is the toolchain but there should reference to it (which toolchain to use)
For MT6589 kernel, the toolchains arm-eabi-4.6 and arm-linux-androideabi-4.6 should be used. (mtk used arm-linux-androideabi-4.6 for kernel but it should be arm-eabi-4.6)
So now you know which toolchain to grab and then for kernel source you have to check this minimal structure :
bionic
kernel
mediatek
build
config
custom
kernel
platform​README​
If I have kernel source, can I build it for my device ?
Erm... Sometimes the structure is here but the kernel source is messy... Why ?
Because you were not provided the matching source of the kernel used on your smartphone and the reasons are multiple (I won't give details).
So, the idea is to run a first build. If you get errors, then check the step above about toolchain and structure.
The next step for fixing errors is to play with source. Good luck for that.​
What are the benefits of a custom kernel for MT6589 ?
First big benefit is to introduce kitkat compatibility because there was an issue on android binder driver in mtk kernel source.
Next benefit is to be able to remove some stuff from mtk which is useless on user side and waste ressources (a lot of debug for example).
Others benefits will be in optimizations or new features (see frandom for example)​
HOWTO :
Build from my repo (specific devices supported) - It's not for compiling your kernel source but to understand how kernel build works​I explain how to build from my repo first because it can help you to understand how you should build kernel source
Prerequisites : A build environment (actually Ubuntu Saucy x64 with build-essentials, ccache, repo, java, perl v5.14+ and openssl) and I won't explain how to get one as there is multiple howto on the net.
For repo, the idea is to create a bin directory in your $HOME (usually /home/accountname/), copy repo binary inside it and then add this bin to $PATH var.
BE CAREFULL TO WHAT YOU DO WITH $PATH VAR ! I always see people doing :
Code:
export PATH=/home/foo/bin
this is erasing $PATH var, just check before and after with echo $PATH
So the idea is to introduce your path AFTER the actual $PATH var
This is easy...
Code:
export PATH=[COLOR="red"]$PATH:[/COLOR]/home/foo/bin
And of course, $PATH is reset once you close terminal and I won't explain how to set $PATH automatically.
Once you got this, everything should be working and it will be easy
Code:
mkdir workdir
cd workdir
repo init -u https://github.com/Dr-Shadow/android_kernel_mt6589_manifest.git -b master
repo sync
Then you should get this in your workdir :
kernel
manifest
mtk-tools
out
ramdisk
scripts
toolchain​Just do :
Code:
cd kernel
./certificates.sh
./build.sh
./certificates.sh is needed only once (it's for signing flashable zip and it will setup some keys for it, just reply to questions and don't add passphrase)
And of course, the build.sh contains most things you need to know on steps for building kernel (which commands to use) and you need to know how it works ​Build from your own kernel source​
I'm building the doc... I have to remind which vars need to be overriden
Reserved
Reserved #2
Thanks for making this thread brother it will help us to learn... Subscribed
Looking forward to the how-to to build with your own kernel source.
Dr-Shadow said:
Hi guys,
I was working on this since some time and here it is
Click to expand...
Click to collapse
Thank you Dr-Shadow! This is very cool. I'm going to try it out!
Great
It's always nice to see further development on MTK Based Devices.
Regards
I'll chip in and say thanks too. Finally getting around to trying to compile Alcatel's OneTouch Hero (aka TCL Y910) provided sources.
I might be in as well with A820, but I'm relatively new to Android and have only done porting of 4.1 and 4.2 so far.
Haven't built anything although I have some knowledge about the source code and SDK, which I've only used for reference purposes and the tools from it.
Will try to compile the stock kernel this weekend, but I'm not quite sure if something else is needed, even if the kernel source seems complete to me.
I'm a quick learner and have a lot of programming experience in other technologies, even thought I'm more of a front-end developer these days.

[ROM][GT-I9305][Marshmallow][6.0][Cyanogenmod 13.0][UNOFFICIAL]

Disclaimer (partially borrowed from MIT license) - WARNING:
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. If you loose your data, brick your device, any other damage or anything else happens (e.g. your cat eats your dog), it is YOUR PROBLEM and YOUR RESPONSIBILITY. Your device warranty is most probably void after installing this.
Although my original intention was just to help with porting CM 13 to i9305, I ended up with my build
To avoid any confusion a because I still have a felling that some people don`t understand this, I have to explain one more detail. I didn`t create this, I only built it. It is a big difference, similar to buying versus building a house. Buying a house is not a simple thing (at least in my country) and you`d probably need to do some changes and repairs before you can start living in it. But building a house is something completely different and much more difficult. The work I`ve done on this CM build is more like buying a house. The see the list of people who "built the house" go into Settings on your phone, section About phone and then Contributors. It is a really long list. Thanks to all of them
Also, please, keep in mind, that I am only sharing results of my hobby.
It is build mostly directly from CyanogenMod 13.0 sources. I only added support for i9305 and cm12 chroot for RIL support. See the original thread for some details. Anyway my work on this is really small, I fixed some problems a put all of this together.
You can download here:
cm-13.0-20160907-UNOFFICIAL-i9305.zip
There is also another builds from @evilracer123. (EDIT 31.3. 2016)
If you want you can also download unofficial build of TWRP with f2fs support TWRP-UNOFFICAIL-3.0.1.img
Changelog:
EDIT (17.1. 2016) - new build with bluetooth fixed
EDIT (19.1. 2016) - new build with bluetooth for non owner fixed, the code for this build downloaded yesterday
EDIT (22.1. 2016) - new build
EDIT (25.1. 2016) - new build - there is some bug in FileManager - see http://forum.xda-developers.com/showpost.php?p=64980000&postcount=150
EDIT (27.1. 2016) - new buld - FileManager bug fixed, Answer call with hardware HOME button commit included
EDIT (29.1. 2016) - new build
EDIT (1.2. 2016) - new build - attempt to fix bluetooth audio problem
EDIT (8.2. 2016) - new build - clock overflow fix (details)
EDIT (17.2. 2016) - new build - I added the SlimISP_PH.bin file, fixed the crashing gallery for non-owner (I added the INTERACT_ACROSS_USERS permission, I hope that it is a correct fix) and added rules for selinux denies @BMP007 reported for logcat.
EDIT (25.2. 2016) - new build with multiple RIL implementations, diff attached
EDIT (19.3. 2016) - new build, f2fs support (some hints here). I attached 2016-03-18_16-49-21-cm-13.0-20160318-UNOFFICIAL-i9305.tar.gz, which contains diff file, roomservice.xml and list of used commits.
EDIT (31.3. 2016) - new build
EDIT (18.4. 2016) - new build
EDIT (25.4. 2016) - new build
EDIT (20.5. 2016) - new build
EDIT (23.6. 2016) - new build
EDIT (7.9. 2016) - new build
EDIT (10.4. 2016) - new build, compiled with ArchiDriod optimizations (thanks to @JustArchi), fixed mDNIe settings
This ROM supports F2FS - you can find some hints, how to use it here. (EDIT 31.3. 2016)
If you want world writable sdcard, set property persist.world_writable_sdcard to true (search the thread to see how) , but be aware that this is not standard behavior.
Multiple RIL implementation
In this ROM, there are more then one RIL implementations. None of them is perfect, but you can choose, which one of them works better for you. The first RIL implementation is the usual CM 12.1 based one (this is the default one), the second one is based on proprietary files extracted from stock 4.4.4 ROM downloaded from sammobile.com (I9305XXUFOB2_I9305PHNFOB2_I9305XXUFOA1_HOME.tar.md5), the third is based on proprietary files from TheMuppets, with one small change (see here for details). To switch between them open shell (over adb, or using the build in app, or whatever you like) and execute command ril. You will see something like this:
Code:
Select RIL implementation:
* 1 - CM 12.1 based
2 - Stock 4.4.4 based
3 - TheMuppets based
x - quit
?
Type 1,2,3 or x and hit enter. The requires root, so be sure it is enabled. After switching, reboot the phone. If you don`t want bother with this, don`t. The default one is, based on my experience, the best
If you want gapps, use http://opengapps.org/. As mentioned several times elsewhere flash it RIGHT AFTER the ROM. I tried the nano version and it works fine.
As far as I know all hardware and RIL is working without problems (even barometer is correctly detected).
Know BUGs:
- sometimes after boot RIL is not started correctly (http://forum.xda-developers.com/galaxy-s3/development-i9305/rom-t3252492/post64740417#post64740417) - data connection (and maybe something else) is not working. In that case turn on and of flight mode (or go somewhere without signal). I trying to fix this, but it is difficult.
- the led flash light used as a torch goes off together with the display (http://forum.xda-developers.com/galaxy-s3/development-i9305/rom-t3252492/post64699946#post64699946)(fixed http://review.cyanogenmod.org/#/c/132783/)
- I suppose there is still msm_hsic_host wakelock bug (https://jira.cyanogenmod.org/browse/CYAN-2266). Supposedly unplugging the charger with display on should prevent this. EDIT (13.2. 2016) Some people are reporting that is fixed. I didn`t anyting specific to fix it, so I am not sure. One possibility is that this was also caused by the clock bug.
- if you have non FAT partition on you sdcard, you get a message that sdcard is corrupted. I`ll try to fix this one, it should not be difficult and it is annoying for me.
- gallery app is crashing for non owner (EDIT 19.1. 2016) (EDIT 17.2. 2016)
- there a problem with bluetooth audio - it occasionally stops for few seconds may be fixed in the today`s build (EDIT 1.2. 2016)
- on the first boot (after /data wipe) the SIM may not be found. Reboot should fix this. (EDIT 31.3. 2016)
Selinux is enforcing. If you used some of my previous builds from the original thread and there is something broken, what worked before, this may be the reason. In that case output of dmesg | grep 'avc.*denied' from the moment the problem happens, is a big help to solve it.
Code related to this can be found here:
https://github.com/p-an/i9305-cm13-device
https://github.com/p-an/android_system_core/tree/cm-13.0
https://github.com/p-an/android_build/
and some smaller changes in attached diffs (part of attached tar.gz archives as code.diff since 2016-3-18)
Build instructions:
This is definitely not the only way how to build CM13 for i9305, but it is the procedure, which I, more or less, use.
First of all read (and understand) the original guide. My build process is modified version of it. The modification is necessary, because there is no official CM13 for i9305, so the breakfast command won`t work. It is replaced by creating .repo/local_manifests/roomservice.xml file. Another change is that proprietary file are part of my github repo, so you don`t have to connect the phone.
Followe the guide mentioned above till the repo command setup. The next step is to initialize the CyanogenMod source repository - use the cm-13.0 branch:
Code:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
Now before you do repo sync, you have to create the roomservice.xml file (note the actual command is old, download the latest .tar.gz archive attached to this post and extract roomservice.xml from it):
Code:
$ mkdir .repo/local_manifests
$ wget "http://forum.xda-developers.com/attachment.php?attachmentid=3657032&d=1456237857" -O .repo/local_manifests/roomservice.xml
Now is time for downloading the code (it takes some time):
Code:
$ repo sync
After this is done you will probably need to sync the code from my github with upstream. It may up to date, but i can`t guarantee it. First add the upstream repo:
Code:
$ cd ~/android/system/system/core/
$ git remote add upstream https://github.com/CyanogenMod/android_system_core.git
And now sync the code:
Code:
$ cd ~/android/system/system/core/
$ git checkout cm-13.0
$ git fetch upstream
$ git merge upstream/cm-13.0 -m 'sync with upstream'
The checkout is necessary to have cm-13.0 branch active. Following two commands download the code from upstream and merge it. They can be replaced with one pull command. Now apply patches. I usually attach them either to this post, or the post, where I announce something new (like a fix). The reason why I share some changes this way, is that I don`t wan`t to fork whole big repository because of a small change. In the latest (cm-13.0-20160217-UNOFFICIAL-i9305.diff) diff there is only one change bigger than one line - delete 5 lines (2 of them are comments). This is usually easy to change manually, if patch fails. You can use this https://groups.google.com/forum/#!topic/repo-discuss/43juvD1qGIQ to apply the patch (store the script into ~/bin/repo_patch and make executable).
Code:
$ cd ~/android/system/
$ repo_patch cm-13.0-20160217-UNOFFICIAL-i9305.diff
Now proceed to the Extract proprietary blobs step. The commands are the same, but you don`t have to connect the phone to the computer:
Code:
$ cd ~/android/system/device/samsung/i9305
$ ./extract-files.sh
Since you skipped the breakfast step, you should now return to the ~/android/system/ directory and setup the environment:
Code:
$ cd ~/android/system/
$ source build/envsetup.sh
Now setup the ccache, if you want. See Turn on caching to speed up build in the original guide.
Start the build:
Code:
$ brunch i9305
If you find some problem let me know, I can try to fix it. But I can`t promise anything, this is only hobby for me and my original intention was just to help with porting CM 13 to i9305.
pAn
reserved
The bug whit the flashlight is on every CM12.1 rom.
2 min using the flashlight and the phone automaticly booting (bootloop).
Is there a chance the problem whit the sdcard to be permision problem?
Thanks i was start thinking that no one want we to have a marshmallow rom for our devices. Live long and prospect.
Sectorian said:
The bug whit the flashlight is on every CM12.1 rom.
2 min using the flashlight and the phone automaticly booting (bootloop).
Click to expand...
Click to collapse
This is new for me. I`ve probably newer used it for such a long time. I`ll put on my list
Sectorian said:
Is there a chance the problem whit the sdcard to be permision problem?
Click to expand...
Click to collapse
I don`t think so. I suppose that this is because there is ext2 partition (with Debian chroot) and Android has never designed to use sdcard with something like this. Until this version it was simply ignored. It is not a big problem, just annoying message.
Nvm sry for asking
russia101 said:
Are there some more changes then the build you already posted on the other thread ?
Click to expand...
Click to collapse
You quote entire OP and you can't read it ?
Please ...
russia101 said:
Are there some more changes then the build you already posted on the other thread ?
Click to expand...
Click to collapse
Edit your post please. No need to quote entire OP
@p.a.n gongrats for your first and the new thread with your rom and many thanks for uploading your sources.
But I am wondering, why you haven't pushed the changes in build and smdk-common, which are present in your posted diff file? Are they not needed (anymore?). And still not clear is, where to put mount_chroot.sh? In system/bin or cm12chroot/system/bin?
ok ... I tried it with usual cyanogenmod smdk-common cm-13.0 branch and original cyanogenmod build and without mount-croot.sh and: sim card and ril is working. But I still cannot hear something or anybody during a call . What vendor/samsung repo are you using? themuppets or crazyweazel and which branch? Maybe there is the problem located?
rodman01 said:
ok ... I tried it with usual cyanogenmod smdk-common cm-13.0 branch and original cyanogenmod build and without mount-croot.sh and: sim card and ril is working. But I still cannot hear something or anybody during a call . What vendor/samsung repo are you using? themuppets or crazyweazel and which branch? Maybe there is the problem located?
Click to expand...
Click to collapse
All the my changes from smdk-common are either in upstream (e.g. the incomminmg call fix) or I moved them to i9305. Script mount-croot.sh is not necessary anymore, the mounts are handled by init (init.target.rc). The only changes from the diffs which are not in those two repositories were in kernel and they are not necessary. The proprietary files which I am using are in the repo (https://github.com/p-an/i9305-cm13-device/tree/cm-13.0/proprietary, https://github.com/p-an/i9305-cm13-device/blob/cm-13.0/cm12chroot/cm12chroot.tgz), I don`t remember where I have it from Just execute extract-files.sh in device/samsung/i9305.
I really have no idea what could be wrong in your case You problems with audio or is it the still the problem with incoming calls (the phone doesn`t ring when someone calls)?
p.a.n. great work brother, installed this ROM with this Gapps (https://www.androidfilehost.com/?fid=24269982086993883) with my outdata Philz Touch 6.48 and works pretty damm good! GPS and wifi OK, incoming and outcoming calls smooth. Congratz!!!
Im expirience a slow charging whit your Rom whit agni kernel. Before that i was on Acip10 whit the same version of agni kernel and the charging work corectly. Hope im helpes.
Oher bugs: trebuchet crashing, skype is not working.
@p.a.n thanks for your all you've done,the rom works great for me,ril data 3g and lte works fine,many thanks ......
@rodman01 just and idea, you`ve probably tried it - do you have data connection, when you try the call? The bug which requires airplane mode on/off effects more than only data connection - if it happens also Llama doesn`t correctly detect area based on cell id. So it could be the reason for your problems.
Sectorian said:
Im expirience a slow charging whit your Rom whit agni kernel. Before that i was on Acip10 whit the same version of agni kernel and the charging work corectly. Hope im helpes.
Click to expand...
Click to collapse
What about cpu load, wakelocks? Did you check it?
Sectorian said:
Oher bugs: trebuchet crashing, skype is not working.
Click to expand...
Click to collapse
Could you provide some details - how to replicate it, logcat, etc. ? Trebuchet seems to be stable to me, but I using mostly another launcher. I don`t use skype, so I am afraid I can`t help with that one
Many thanks for the the tip, I will look at it and make some tests. Sim and ril is working, incoming and outgoing calls too...but no call audio, so I cannot hear the caller and he doesn't hear me neither.
rodman01 said:
Many thanks for the the tip, I will look at it and make some tests. Sim and ril is working, incoming and outgoing calls too...but no call audio, so I cannot hear the caller and he doesn't hear me neither.
Click to expand...
Click to collapse
Can you talk on a headset via the 3.5mm jack? If you can then it's related to RIL or the microphone and earpiece don't work in call.
Thanks for the awesome rom! Do I need to flash anything to get root?
floopyb said:
Thanks for the awesome rom! Do I need to flash anything to get root?
Click to expand...
Click to collapse
No, just enable the developer options, it is there
Sectorian said:
Im expirience a slow charging whit your Rom whit agni kernel. Before that i was on Acip10 whit the same version of agni kernel and the charging work corectly.
Click to expand...
Click to collapse
In AGNi control set 'Ignore unstable charging power', 'ignore safety margin', 'AC charge rate 1500mA'.
You won't damage anything, not phone nor charger.
There is a free app called Galaxy Charging Current which shows you the charging rate.
If you're too scared, just do the ignore unstable power and that will cure your issue. The other two things just make it charge even quicker.

Categories

Resources