[HTC One X+] aureljared:
Frequently Asked Questions (FAQ)

My device won't boot after flashing this kernel / I have no reception.​

Make sure you flashed boot.img via fastboot AND copied the .ko files inside the zip onto the "/system/lib/modules" folder inside your device.

Remember, this kernel only works on the ROMs outlined in the downloads section.

My SIM card disconnects at random.​

http://xdaforums.com/showpost.php?p=35224237&postcount=6

SetCPU/No-frills/etc won't work!​

Use Kernel Adiutor. (It's free.)

How to build on Linux?​

There are already lots of tutorials on this, just use Google.

How to build on Mac OS X?​

Setting up a working build environment on Mac proved difficult as there aren't that many tutorials available on the internet, and the ones that did exist didn't help me solve the weird errors I got when building. This stumped me for a good two weeks, but finally figured it out. :cowboy:

So here goes:

Get the XCode commandline tools.

If you already have XCode installed, good for you. You can skip this step.

If you don't have XCode, there's no need to waste hours of your time on downloading this 6GB app when all you need is 200MB of it. Open Terminal and enter

xcode-select --install

If that takes too long, you can also try downloading the XCode Command Line Developer Tools from here (log in with your Apple ID first).

Once you have that installed, proceed to the next step.

Install build dependencies using Homebrew

Homebrew is a very important tool for developers on Mac. If you don't have it yet, install it by entering this in Terminal.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

When that's done, enter this:

brew update
brew install findutils gnu-sed gnupg xz ccache android-platform-tools libmpc
brew install homebrew/dupes/ncurses

Once it's done, proceed.

Make a disk image

The default filesystem in OS X isn't case-sensitive, and the Linux kernel source doesn't like that. Enter this in Terminal:

hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 15g -volname "enrc2b" -attach ~/Desktop/Android

You can change "15g" to any size you want, but at least 20 GB is recommended.

You can also change "enrc2b" to any volume name you want. Just make sure you remember it!

Download the kernel source and toolchain

Replace "enrc2b" below with your chosen name if you used something else.

cd /Volumes/enrc2b
git clone https://github.com/jareddantis/pulsar-kernel_enrc2b -b master kernel
git clone https://android.googlesource.com/platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8 toolchain
git clone https://github.com/CyanogenMod/android_external_elfutils.git elfutils

If that takes too long, hit Ctrl+C to stop the Git processes as needed. Repeat this step, but use "git clone --depth 1" instead of "git clone".

Use ccache

ccache greatly speeds up subsequent compilations by caching compiled code files in a specified directory. Make that directory by

cd /Volumes/enrc2b
mkdir ccache

To enable ccache, go to the next step.

Prepare environment

Edit your Bash variables by

nano ~/.bash_profile

Insert these lines at the end of the file:

export LANG=C
export LC_CTYPE=C
export ARCH=arm
export SUBARCH=arm
export KBUILD_BUILD_USER="YourNameHere"
export KBUILD_BUILD_HOST="YourComputerCodenameHere"
export CROSS_COMPILE="ccache /Volumes/enrc2b/toolchain/bin/arm-eabi-"
export USE_CCACHE=1
export CCACHE_DIR=/Volumes/enrc2b/ccache

KBUILD_BUILD_USER and KBUILD_BUILD_HOST can be anything you want. Just don't forget the quotes.

Enable ccache by

source ~/.bash_profile
ccache -M 10G

Cache sizes of at least 5 GB are recommended, but don't forget to leave space for the kernel compilation itself!

Compile

cd /Volumes/enrc2b/kernel
make clean && make mrproper
make cm_enrc2b_defconfig
make menuconfig # Optional - only if you're changing kernel settings
make -j4 HOSTCFLAGS="-I/Volumes/enrc2b/elfutils/libelf"

Replace the "4" in "make -j4" with the number of CPU cores (physical and logical) that your Mac has.

Your kernel should now be compiling.

It took about 8 minutes to finish on my 2014 base-model MacBook Air. :cool:

Prepare for flashing

cd /Volumes/enrc2b
mkdir flashing
cd flashing

Download mkbootimg and unmkbootimg from here. Unzip inside the "flashing" folder we just created.

Your just-compiled kernel will be located at kernel/arch/arm/boot/zImage, copy that here by

cp /Volumes/enrc2b/kernel/arch/arm/boot/zImage ./

Now you'll need a copy of the boot.img in the Lollipop ROM you're currently using. Either extract that from the ROM zip or get "boot.emmc.win" from your TWRP backup.

My boot image is called "boot.img". Assuming I've already copied boot.img inside the "flashing" folder, I do

unmkbootimg -i boot.img

Two new files, ramdisk.cpio.gz and kernel, will be created. Delete ramdisk.cpio.gz and do this to put together your freshly-built kernel:

mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x10008000 --ramdisk_offset 0x11000000 --second_offset 0x10f00000 --tags_offset 0x10000100 [B]--kernel zImage[/B] --ramdisk ramdisk.cpio.gz [B]-o boot.img.new[/B]

Reboot your phone into fastboot, connect it via USB, and do this to test your kernel.

fastboot flash boot boot.img.new
fastboot reboot

If everything goes right,

you should now be booting your very own kernel.

:highfive: :good:

If not, you can just reboot back into fastboot and flash back the original boot.img...

fastboot flash boot boot.img
fastboot reboot

...and try to see where the kernel went wrong.

How to report bugs?​

If it's just the usual lag, don't report it here. The HOX+ is an old device running new software, we have to live with these quirks. Try using apps like Greenify and changing your kernel settings to keep your hardware resources in check. Regularly running fstrim on your partitions also helps.

If it's kernel-specific, like random reboots, make sure you can reproduce the problem.

Once you have reproduced the problem, immediately reboot into recovery and adb pull /proc/last_kmsg. Attach that here and I'll try to take a look at it when I have time.

I can't promise a fix, though - I'm only a high school student, not an expert C developer. :laugh: