Skip to content
Snippets Groups Projects
  • Caleb Connolly's avatar
    8400fffe
    postmarketos-initramfs: refactor cmdline parsing · 8400fffe
    Caleb Connolly authored
    
    Currently the initramfs is littered with various code snippets which
    read /proc/cmdline. This is error prone and results in more complicated
    code especially as we want to standardise all the pmos specific cmdline
    arguments, and where some arguments have the same behaviour as
    deviceinfo variables.
    
    Let's do the parsing correctly, once, and set global variables to
    enable/disable/configure parts of the initramfs. At the same time
    introduce namespaced and standard versions of the remaining arguments
    which haven't been standardised yet.
    
    Now (for example) to check if the splash is disabled, rather than
    grepping /proc/cmdline for PMOS_NOSPLASH AND checking if
    deviceinfo_no_framebuffer is true, you can just check if "$nosplash" =
    "y".
    
    This will drastically simplify the process of adding additional
    configuration options in the future.
    
    Most of the code here was taken from the Arch Linux initramfs and
    simplified/adjusted to better fix our use case.
    
    Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
    Part-of: !6172
    postmarketos-initramfs: refactor cmdline parsing
    Caleb Connolly authored
    
    Currently the initramfs is littered with various code snippets which
    read /proc/cmdline. This is error prone and results in more complicated
    code especially as we want to standardise all the pmos specific cmdline
    arguments, and where some arguments have the same behaviour as
    deviceinfo variables.
    
    Let's do the parsing correctly, once, and set global variables to
    enable/disable/configure parts of the initramfs. At the same time
    introduce namespaced and standard versions of the remaining arguments
    which haven't been standardised yet.
    
    Now (for example) to check if the splash is disabled, rather than
    grepping /proc/cmdline for PMOS_NOSPLASH AND checking if
    deviceinfo_no_framebuffer is true, you can just check if "$nosplash" =
    "y".
    
    This will drastically simplify the process of adding additional
    configuration options in the future.
    
    Most of the code here was taken from the Arch Linux initramfs and
    simplified/adjusted to better fix our use case.
    
    Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
    Part-of: !6172
init.sh 1.90 KiB