Giter VIP home page Giter VIP logo

clr-init's Introduction

clr-init

Initrd created using systemd as init program

Luks Encryption support

The systemd rd parameters for luks most be added to the kernel cmdline to know who is the encrypted root partition: https://www.freedesktop.org/software/systemd/man/systemd-cryptsetup-generator.html#Kernel%20Command%20Line

This initrd most not be using with LVM partitons, how ever it could be complemented adding services in an additional initrd

How this works

This is the flow of an initrd with systemd:

    +----------------+
    | systemd (init) |
    +----------------+
               +
               v
    +--------------------------------+
    | system-generators              |
    |--------------------------------|
    | nfs-server-generator           |
    | rpc-pipefs-generator           |
    | systemd-cryptsetup-generator   |
    | systemd-debug-generator        |
    | systemd-fstab-generator        |
    | systemd-getty-generator        |
    | systemd-gpt-auto-generator     |
    | systemd-system-update-generator|
    | systemd-veritysetup-generator  |
    +--------------------------------+
               +
               |
               v
     +-------------------+
     |local-fs-pre.target|
     +-------------------+
               +
               |
               |
               |
               v
 +-----------------------------+        +-----------------+         +-----------------------+
 |  local-fs.target            |        |  swap.target    |         |  cryptsetup.target    |
 |-----------------------------|        |-----------------|         |-----------------------|
 |                             |        |                 |         |                       |
 |  tmp.mount                  |        |  (various swap  |         |  (various cryptsetup  |
 |  systemd-remount-fs.service |        |   devices...)   |         |      devices...)      |
 |                             |        |                 |         |                       |
 +-----------------------------+        +-----------------+         +-----------------------+
               +                               |                               |
               |                               |                               |
               +------------------------------>|<------------------------------+
                                               v
                           +--------------------------------------+
                           |  sysinit.target                      |
                           |--------------------------------------|
                           |  systemd-ask-password-console.path   |
                           |  systemd-tmpfiles-setup-dev.service  |
                           |  systemd-tmpfiles-setup.service      |
                           |  systemd-udevd.service               |
                           |  systemd-udev-trigger.service        |
                           +--------------------------------------+
                                               +
                                               |
         +------------------+-----------------+|+---------------+------------------------+
         |                  |                  |                |                        |
         |                  |                  |                |                        |
         v                  v                  |                v                        v
 +----------------+ +----------------+         |  +------------------------------++---------------+
 |  timers.target | |  paths.target  |         |  |  sockets.target              || rescue.target |
 |----------------| |----------------|         |  |------------------------------|+---------------+
 |   (various     | |  (various      |         |  |  systemd-udevd-control.socket|
 |  timers...)    | |  paths...)     |         |  |  systemd-udevd-kernel.socket |
 |                | |                |         |  |                              |
 +----------------+ +----------------+         |  +------------------------------+
                           +                   |                +
                           |                   |                |
                           |                   |                |
                           +------------------>|<---------------+
                                               |
                                               |
                                               |
                                               v
                                        +------------+
                                        |basic.target|
                                        +------------+
                                               +
                                               |
                                               v
                                +--------------------------------+              +----------------+
                                |  initrd-root-device.target     |              |emergency.target|
                                |--------------------------------|              +----------------+
                                |         sysroot.mount          |
                                +--------------------------------+
                                               +
                                               |
                                               v
                                +--------------------------------+
                                |    initrd-root-fs.target       |
                                |--------------------------------|
                                |   initrd-parse-etc.service     |
                                +--------------------------------+
                                               +
                                               |
                                               v
                                +--------------------------------+
                                |      initrd-fs.target          |
                                |--------------------------------|
                                |   (sysroot-usr.mount and       |
                                |    various mounts marked       |
                                |      with fstab option         |
                                |     x-initrd.mount...)         |
                                +--------------------------------+
                                               +
                                               |
                                               v
                              +------------------------------------+
                              |           initrd.target            |
                              |------------------------------------|
                              |      initrd-cleanup.service        |
                              | initrd-udevadm-cleanup-db.service  |
                              +------------------------------------+
                                               +
                                               |
                                               v
                                +-------------------------------+
                                |  initrd-switch-root.target    |
                                |-------------------------------|
                                |                               |
                                |  initrd-switch-root.service   |
                                |                               |
                                +-------------------------------+
                                               +
                                               |
                                               v
                                   +------------------------+
                                   | Transition to Host OS  |
                                   +------------------------+

Create and Install

This will install clr-init.cpio.gz in /usr/lib/initrd

make && make install

clr-init's People

Contributors

ahkok avatar bwarden avatar josuedhg avatar mdhorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clr-init's Issues

clr-init pulls /usr/lib64/haswell versions of libraries, won't work on non-AVX2 systems.

The initrd Makefile code relies on ldd which will provide the AVX2 optimized libraries as link targets if it runs on a machine that has AVX2.

This makes the initrd nonfunctional on all non-AVX2 systems, such as IVB.

The code can not rely on ldd plain output for finding required libraries. It should remain functional on older platforms.

$ python3 /usr/share/clr-avx-tools/avxjudge.py libcryptsetup.so.12
Analyzing libcryptsetup.so.12
Top SSE functions by instruction count
    crypt_benchmark_pbkdf@@CRYPTSETUP_2.0	17.14 %s
    crypt_benchmark@@CRYPTSETUP_2.0	5.88 %s
    crypt_convert@@CRYPTSETUP_2.0 	3.36 %s
    crypt_get_integrity_info@@CRYPTSETUP_2.0	2.9 %s
    .fini                         	2.84 %s

Top SSE functions by value
    .fini                         	116.76
    crypt_token_register@@CRYPTSETUP_2.0	103.78
    crypt_set_debug_level@@CRYPTSETUP_2.0	25.02
    crypt_wipe@@CRYPTSETUP_2.0    	22.17
    crypt_set_pbkdf_type@@CRYPTSETUP_2.0	9.05

Top AVX2 functions by instruction count
    .fini                         	1.7 %s
    crypt_benchmark@@CRYPTSETUP_2.0	0.74 %s
    crypt_token_register@@CRYPTSETUP_2.0	0.46 %s
    crypt_init_by_name_and_header@@CRYPTSETUP_2.0	0.13 %s
    crypt_set_pbkdf_type@@CRYPTSETUP_2.0	0.03 %s

Top AVX2 functions by value
    .fini                         	16.23
    crypt_token_register@@CRYPTSETUP_2.0	12.88
    crypt_benchmark@@CRYPTSETUP_2.0	2.0
    crypt_init_by_name_and_header@@CRYPTSETUP_2.0	0.2
    crypt_set_pbkdf_type@@CRYPTSETUP_2.0	0.1

Top AVX512 functions by instruction count

Top AVX512 functions by value


File total (SSE):  652 instructions with score 313
File total (AVX2):  342 instructions with score 31
File total (AVX512):  0 instructions with score 0

An smaller and simple initrd

instead load systemd and all its stuffs clear could have a custom init process, just doing the needed things to mount root

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.