Code Monkey home page Code Monkey logo

kernel_dev_tools's Introduction

Kernel Development Tools

Kernel Development Tools (kdt) is a set of tools to help with the daily tasks of a kernel developer interacting with single-board computers (SBCs). It aims to unify the process of configuring, building, testing and upstreaming kernel code.

Features

  • Faster build times: Uses of Ccache if available in the system.
  • Finds SBCs IPs by MAC address: Finds SBCs IP by searching into the local network and creates a host entry into /etc/hosts for easy access.
  • Build Isolation: Each different board uses its build folder for building the kernel, making it faster switch and build the kernel for different boards.
  • Builds Arch Linux Packages: It also builds Arch Linux Kernel packages if the board has a PKGBUILD folder configured.
  • Removes Gerrit Change-Ids when formatting patches: Removes "Change-Id:" lines when generating patches for upstream.
  • Helps Eclipse Kernel indexing: Creates symbolics links for autogenerated headers in the kernel to help Eclipse code indexing.
  • Per board configuration: Each board can have its own configure, build and install parameters, like cross-compiler, kernel targets, configuration, installation files.
  • Many ways to Install kernels: Supports installation of the kernel into sdcard, sdcard images, folders and IP addresses.
  • Uses meld to visualise git diffs: If configured translates the git diff command to use the Meld.
  • Mount images: Mounts a disk image with the detected partition sizes.
  • Script ready: Returns 1 in any error case for configuring, building or installing the kernel.

Usage

Before doing any work export the name for the board being used:

$ export board=vim4

Now check the current build parameters:

$ kb env
Board:             vim4
ARCH:              arm64
CROSS_COMPILE:     aarch64-none-linux-gnu-
Build Path:        /home/tanureal/.kdt_kernel_builds/vim4/kernel
Config File:       /home/tanureal/workspace/kernel_dev_tools/boards/vim4_arm64_defconfig
PATH:              ~/.local/bin/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/ccache:~/.local/bin/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/:$PATH

To configure the kernel:

$ kb config

To build the kernel, device trees (if configured) and modules:

$ kb build

Or to build a Arch Linux Package:

$ kb build -p

To install the kernel into the SBCs using the network: Note: Better to have root ssh access using ssh keys that don't request passwords.

$ kb scp IP

Or to install the Arch Linux Package into the SBC using the network:

$ kb scp -p IP

Turn On/Off the selected board:

$ kb on
$ kb off

For more options use --help:

$ kb --help
$ kb scp --help
$ kb config --help

Get IP for know SBCs configured in get_ip section:

$ gip

Or add a hostname and mac address for gip scan.

$ gip add hostname aa:bb:cc:dd:ee:ff

or

$ gip add # For adding more than one

Installing

Execute kdt_install. This will modify your bashrc and create ~/.local/bin if it doesn't exist. As this set of tools is still under development, symbolic links will be created in ~/.local/bin for this repo.

Board Configuration

Each board has a section in the config file. Example for board vim4 using arm64 arch:

[vim4_arm64]
cc             = aarch64-none-linux-gnu-
cc_path        = ~/.local/bin/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin
kernel_target  = Image
kernel_file    = Image-devel
dtb_path       = dtbs_devel
config_file    = $kdt_boards/vim4_arm64_defconfig
ramfs_file     = initramfs-linux-devel.img
update_ramfs   = mkinitcpio -k $version -g $ramfs_file
on             = kasa --alias Strip_9BA6 --type strip on --name P2
off            = kasa --alias Strip_9BA6 --type strip off --name P2
Parameter Explanation
cc Cross compiler prefix. Ex: aarch64-linux-gnu-
cc_path Cross compiler folder inside the bin_folder. Ex: gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu
kernel_target Linux kernel make target for the kernel image. Ex: Image or Image.gz
kernel_file Filename expected inside /boot/. Ex: kernel8.img
config_file Default config file used to configure the kernel
config_target Make target used to configure the kernel
overlays yes, if the board uses overlays. The overlays folder will be copied into /boot
vendor Vendor name, like broadcom. If set the contents of arch/ARCH/boot/dts/VENDOR will be copied into /boot (Raspberry Pi style)
dtb_path Device tree binary folder inside /boot where dtbs will be copied
ramfs_file File name for the initramfs file inside /boot
update_ramfs Command used to create the initramfs file, where $ramfs_file will be replaced by ramfs_file and $version by the kernel version
on Command line used to turn this board on
off Command line used to turn this board off
pkg_folder Folder PKGBUILD files necessary to build the Arch Linux Kernel package

kernel_dev_tools's People

Contributors

lucastanure 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.