- Saved searches
- Use saved searches to filter your results more quickly
- License
- TranceLove/android-x86-kernel
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README
- Android-x86
- Prepare the source tree
- Build the target default kernel
- Build and update kernel solely
- Specify kernel architecture
- Force recompilation of the kernel
- Replace the kernel
- Build a customized kernel
- Customize the kernel configuration
- Use a prebuilt kernel
- Compile kernel for ARM (deprecated)
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Maurossi kernel (https://github.com/maurossi/linux) for Android-x86 plus improvements by Hans de Goede (https://github.com/jwrdegoede/linux-sunxi). TESTING ONLY — THIS REPOSITORY IS NOT SUPPORTED BY ANY MEANS
License
TranceLove/android-x86-kernel
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README
Linux kernel ============ This file was moved to Documentation/admin-guide/README.rst Please notice that there are several guides for kernel developers and users. These guides can be rendered in a number of formats, like HTML and PDF. In order to build the documentation, use ``make htmldocs`` or ``make pdfdocs``. There are various text files in the Documentation/ subdirectory, several of them using the Restructured Text markup notation. See Documentation/00-INDEX for a list of what is contained in each file. Please read the Documentation/process/changes.rst file, as it contains the requirements for building and running the kernel, and information about the problems which may result by upgrading your kernel.
Android-x86
The Android build system doesn’t compile kernel on-fly. It just contains a prebuilt kernel binary which will be added to the target image. This approach may be good enough for the arm emulator target, but not suitable for x86 platforms. The x86 platforms have various hardware. The kernel binary and its modules may need to be adjusted at compile time or runtime.
This article explains an extra feature of the android-x86 build system. That is, the ability to build kernel and modules by a predefined or customized config during the building process.
Prepare the source tree
We have modified the Android build system to compile a kernel image on-fly. You need to use our repository to get this feature. Read the article for details.
Build the target default kernel
We put default configs of supported targets of android-x86 in kernel/arch/x86/configs/. The corresponding defconfig of a selected target will be used automatically. For example,
By specifying the TARGET_PRODUCT to android_x86_64, the build system automatically selects the config android-x86_64_defconfig to compile the kernel binary and its modules. The binary will be generated in out/target/product/x86_64/kernel, and the modules is put under out/target/product/x86_64/system/lib/modules/. The final target out/target/product/x86_64/android_x86_64.iso will contain the kernel binary and its modules.
Build and update kernel solely
To build the kernel and its modules solely, change the goal iso_img to kernel:
Then you can copy $OUT/kernel and $OUT/system/lib/modules/ to the target device. Put the former to the android-x86 installation directory, and the latter to /system/lib/modules. Note the /system must be installed as read-write mode.
Specify kernel architecture
Since Android 5.0 it supports both 32-bit and 64-bit images. Usually 32-bit userspace works with 32-bit kernel, while 64-bit userspace must work with 64-bit kernel. Android-x86 build system supports both since lollipop-x86.
Sometimes you may want to run 32-bit userspace with 64-bit kernel. In this case, you may specify kernel architecture by TARGET_KERNEL_ARCH:
Force recompilation of the kernel
Android and kernel use entirely different build systems. Though we combine them together, the integration doesn’t work very well. An example is if you modify the kernel tree, Android build system won’t notice the change. That means, the kernel won’t be rebuilt automatically if you rebuild the image.
There are several ways to overcome that. One is to touch the defconfig like:
Or remove the kernel config in the out/ directory:
Or remove the kernel image:
Replace the kernel
Since we build kernel with modules support, to replace the kernel of an installed system, you have to replace the corresponding modules as well. To do that, copy the kernel image to the android-x86 installation directory, and copy modules to /system/lib/modules. You can do that by booting to debug mode like:
Detecting Android-x86. found at /dev/sda1
Type ‘exit’ to continue booting.
Running MirBSD Korn Shell.
exit
Use Alt-F1/F2/F3 to switch between virtual consoles
Type ‘exit’ to enter Android.
Running MirBSD Korn Shell.
mount /dev/sdb1 /hd
cp /hd/kernel /src
rm -rf /system/lib/modules/*
cp -a /hd/modules/* /system/lib/modules
sync; umount /hd; reboot -f
The example assumes the new kernel image and the corresponding modules are in a USB disk /dev/sdb1, and the /system/ was installed as read-write mode.
Build a customized kernel
Suppose you already have a workable kernel config for you hardware, it’s easy to tell the build system to use your config to build the iso. Just put your config file to kernel/arch/x86/configs/, and run (suppose the name of your config is my_defconfig)
Note you cannot use a kernel config from a normal linux distribution (e.g, ubuntu) for android-x86. You need to enable android kernel features to make it work. See android/configs/android-base.cfg for a list of required configuration options for a kernel to support an Android system. (but removes arm specific options for android-x86, e.g., PMEM)
Customize the kernel configuration
It is never advisable to edit the kernel config file directly, as it may generate faulty configuration (dependencies not met etc.). The correct way to customize the kernel config is (on the top of android-x86 tree)
. build/envsetup.sh; lunch android_x86_64-userdebug
make -C kernel O=$OUT/obj/kernel ARCH=x86 menuconfig
If you get an error message Unknown option: -C, change make to /usr/bin/make. That’s because since Android 8 the build system overrides the default make command of the system by its own make function (to invoke soong rules) which doesn’t recognize the -C option. To overcome that, just use the make command of the system.
The generated config is $OUT/obj/kernel/.config. Copy it to where you want it to be.
DO NOT issue make menuconfig in the kernel/ directory directly. If you do so, the build rules may be broken. In this case, try this way to recover it (on the top of android-x86 tree):
Use a prebuilt kernel
If you have a workable prebuilt kernel binary for your hardware, you can generate the iso with it:
Compile kernel for ARM (deprecated)
The kernel build system can also be used to compile kernel for ARM. For example, to compile kernel 2.6.29 for the goldfish CPU of the arm emulator, run
cd kernel
git checkout x86/android-goldfish-2.6.29
cd ..
make kernel TARGET_KERNEL_CONFIG=goldfish_defconfig TARGET_NO_KERNEL=
The kernel binary will be generated in out/target/product/generic/kernel.
Set TARGET_NO_KERNEL to be empty is important, otherwise the kernel building steps will be skipped.