Code Monkey home page Code Monkey logo

compile-kernel-from-source's Introduction

compile-kernel-from-source

Scripts to be able to automate compiling procedures. Eg. if you need to add .config options to your kernel sources like android (ASHMEM, BINDER, etc.)

Can be used to address the anbox modules issue, explained in this thread: anbox/anbox-modules#75 (comment)

Everything is work in progress .. (Should be working though as expected now..)

Explanation of the scripts:

createscriptenv.sh

Adds the ability to use my scripts directly in your bash/terminal by just typing the scripts name. Make sure you copy your/my scripts to your ~/.scripts folder. (I will be extending this script somehow sometime to update-check itself and offer a installation menu for my scripts. I really love creating workflow that enables to speed up things that beeing frequently used..)

cfs_nogui.sh (deprecated) and cfs_noguimerge.sh

It automates the steps to compile your kernel on ubuntu/debian based systems (such as linux mint for example) while asking the user some questions interactively

cfs_gui.sh

Same as the no GUI version but you will get a graphical interface which lets you change your config file before you re-build your kernel. Here you need to activate all those 'android' and 'ashmem' options yourself. Make sure to do so or you will miss the ashmem and binder modules in your kernel..

Change these configuration parameters manually in the gui version and save it: CONFIG_ASHMEM=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y CONFIG_ANDROID_BINDERFS=y CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder,binderfs" CONFIG_ANDROID_BINDER_IPC_SELFTEST=y CONFIG_SYSTEM_TRUSTED_KEYS="" CONFIG_SYSTEM_REVOCATION_KEYS="" CONFIG_LOCALVERSION="-android"

Instructions:

  1. Download the nogui/noguimerge (recommended version) or gui script and make it executable if it's not:

chmod +x cfs_gui.sh cfs_nogui.sh cfs_noguimerge.sh

  1. execute it:

./cfs_gui.sh or ./cfs_nogui.sh or ./cfs_noguimerge.sh

Note:

You will be asked which version you want to compile which then will be pulled from kernel.org. You can also look on https://kernel.org/ if you are unsure and want the latest kernel version compiled and installed.

  1. After the kernel has been compiled you can install it with: sudo dpkg -i ../linux-*.deb

  2. After installing the kernel you may need to sign it for booting with UEFI / Secure Boot. -->> Go Here for a script which can assist you: https://github.com/SoulInfernoDE/compile-kernel-from-source#generate-mok-file-and-sign-your-kernel-with-automation-script

  3. Base reading article is: https://github.com/jakeday/linux-surface/blob/3267e4ea1f318bb9716d6742d79162de8277dea2/SIGNING.md

::: Summary what will be done ::: These are the steps you need to take:

  • Create a configuration file named MOK
  • enroll the MOK file with a password you choose into your linux and bios
  • sign your newly installed kernel with it
  • reboot the system - you will get a blue MOKManager screen
  • select enroll, enroll key and enter your password which you had choosen

-->> Your custom MOK signing key is now installed in your bios, your kernel is signed with it and your linux system is verifying it

Kernel 5.18+ and 6.x+

Has the ASHMEM module removed completely. Therefore we need to reverse that changes until Anbox switches to MEMFD instead of ASHMEM.

Steps to do that:

commands:

  1. wget -O remove_ashmem.patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=721412ed3d819e767cac2b06646bf03aa158aaec
  2. interdiff -q remove_ashmem.patch /dev/null > enable_ashmem.patch
  3. patch -p1 -i enable_ashmem.patch

Updated the scripts to patch ashmem module back into the sources. It checks if ashmem code is still present and skips the patchset if not needed.

Generate MOK file and sign your kernel with automation script:

  1. Download the signkernel script and make it executable if it's not:

chmod +x cfs_signkernel.sh

  1. execute it: ./cfs_signkernel.sh

    • You will be asked to generate key files and enroll/import them into your linux / bios.
    • If you already created the key files once and did set a password, you can say "NO" and only sign your fresh installed custom kernel. Note that you need to do this also after creating your key files and before rebooting. Otherwise you cannot boot your unsigned kernel.

Please report any bugs or errors found..

compile-kernel-from-source's People

Contributors

soulinfernode avatar

Stargazers

serem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.