Sat 26 May 2018

Filed under Android

Tags android linux kernel gentoo

Preface

To run LXC, we need a kernel that has the options required by LXC on. This article shows how to build an Android kernel that has the required options on, built by Gentoo's latest stable cross-compile toolchain built by crossdev.

Install Cross-Compile Toolchain

We'll use crossdev, a set of wrapper scripts that provides cross-compilation capability to Portage. The following instructions assume that the workstation is a Gentoo machine.

First, install sys-devel/crossdev:

emerge -av sys-devel/crossdev

Install the latest stable toolchain:

crossdev --stable -t aarch64-unknown-linux-gnu

Clone the kernel sources and compile

The kernel source repository for Nexus 6P with my patches for compiling with GCC 6 as well as LXC-enabled config is at KireinaHoro/android_kernel_huawei_angler. Clone this repository and compile the kernel:

git clone https://github.com/KireinaHoro/android_kernel_huawei_angler
cd android_kernel_huawei_angler
make sharkbait_angler_defconfig
make -j8

The target kernel image will be available at arch/arm64/Image.gz-dtb. Copy this to the preinit repository to continue following Starting Android in LXC to build the preinit boot.img.

Notes

Linux kernel's make savedefconfig doesn't really save a working defconfig, at least it's not the case for Android kernels. When changes are made to .config (via make menuconfig or so), copy .config back to arch/arm64/configs instead of relying on the savedefconfig target, otherwise you may encounter problems such as missing drivers or things that should be built-in turned out to be built as a module.

GCC 6 support was accomplished by introducing compiler-gcc6.h from SaberMod/android-kernel-lge-hammerhead on GitLab. A few fixes regarding the static inline behavior change since GCC 6 has been made to make the source compile without problem. Warning checks in gcc-wrapper.py was disabled as well.

Comment

Sat 05 May 2018

Filed under Gentoo

Tags gentoo linux virtualization

The story

After struggling with HiDPI issues on native GNU/Linux and battery life issues on macOS, I resorted to using Windows 10 as the main operating system on my laptop. Though there's WSL, it's not running Gentoo and has a severely degraded performance. As crossdev is really easy to …

Read More

Fri 04 May 2018

Filed under GSoC 2018

Tags android gentoo gsoc linux

Preface

This week was about getting the Gentoo stage3 to work on Android (as a subsystem of Android currently), and replacing init located in the initramfs, which was part of the boot.img that was used to boot the system. To ease the process of compiling for a different architecture …

Read More

KireinaHoro (jsteward) 's place © KireinaHoro Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome and Font Awesome More