Code Monkey home page Code Monkey logo

autokernel's People

Contributors

clotodex avatar dependabot[bot] avatar lovesegfault avatar oddlama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

autokernel's Issues

Does not work with older kernels

While working on #2, I found that autokernel will not work on some older kernel releases:

all versions
Get this warning:

linux-config> scripts/kconfig/autokernel_bridge.c: In function 'init':
linux-config> scripts/kconfig/autokernel_bridge.c:80:9: warning: ignoring return value of 'getcwd' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
linux-config>    80 |         getcwd(saved_working_directory, 2048);

5.10

linux-config> building
linux-config> scripts/kconfig/autokernel_bridge.c: In function 'init':
linux-config> scripts/kconfig/autokernel_bridge.c:80:9: warning: ignoring return value of 'getcwd' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
linux-config>    80 |         getcwd(saved_working_directory, 2048);
linux-config>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux-config>        Built bridge for . in 3.54s
linux-config> sh: ./scripts/ld-version.sh: not found
linux-config> init/Kconfig:39: syntax error
linux-config> init/Kconfig:38: invalid statement

4.19

linux-config> building
linux-config> scripts/kconfig/autokernel_bridge.c: In function 'init':
linux-config> scripts/kconfig/autokernel_bridge.c:80:9: warning: ignoring return value of 'getcwd' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
linux-config>    80 |         getcwd(saved_working_directory, 2048);
linux-config>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux-config>        Built bridge for . in 3.32s
linux-config> error: ./scripts/kconfig/autokernel_bridge.so: undefined symbol: sym_get_range_prop

4.14

linux-config> building
linux-config> scripts/kconfig/autokernel_bridge.c: In function 'init':
linux-config> scripts/kconfig/autokernel_bridge.c:80:9: warning: ignoring return value of 'getcwd' declared with attribute 'warn_unused_result' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-result-Wunused-result8;;]
linux-config>    80 |         getcwd(saved_working_directory, 2048);
linux-config>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux-config>        Built bridge for . in 3.29s
linux-config> error: ./scripts/kconfig/autokernel_bridge.so: undefined symbol: sym_get_range_prop

The last two failures seem to be due to a breaking change to the kconfig api at some point?

"Missing file extension" for ".config"

I get a "Missing file extension" error when I set the configuration to .config:

  • autokernel config:
script = "/home/user/Documents/git_dir/autokernel/linux-5.13/.config"
  • the error:
thread 'main' panicked at 'Missing file extension', /home/user/Documents/git_dir/autokernel/src/script/mod.rs:22:10

Looks like extension() here https://github.com/oddlama/autokernel/blob/main/src/script/mod.rs#L21 returns None. For instance: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e6a8356bb82aee51184f062595a4b871

How to encode names starting with numerals in Lua?

If a config option's name begins with a number, such as 8139TOO, and you encode it naively like so:

8139TOO_8129:satisfy { "y", recursive = true }

The lua parser will choke:

linux-config> error: syntax error: [string "/nix/store/ynk73z843z6fxvlq7fwlqrxfkx8g3vnn-l..."]:2: malformed number near '8139T'

The documentation/examples should probably include an example of how to handle such options

UnsupportedConstituents error is not helpful

Consider the following script, to be applied to kernel 6.1:

load_kconfig_unchecked(kernel_dir .. "/arch/x86/configs/x86_64_defconfig")
DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT:satisfy { y, recursive = true }

It fails with this error:

linux-config>  Initialized bridge [kernel 6.1.13, 17205 symbols] in 756.85ms
linux-config>      Loading config (/nix/store/bcy6jr6clfwx2viph2zr7dxdyychrmls-linux-6.1.13-autokernel.toml) [autokernel 2.0.2]
linux-config>     Applying configuration (/nix/store/bcy6jr6clfwx2viph2zr7dxdyychrmls-linux-6.1.13-autokernel.toml)
linux-config>     Applying script (/nix/store/xp8xhhs98j6ir1y8cqyvhcddlbkhrlnl-linux-6.1.13-autokernel.lua)
linux-config> error: failed to assign symbol DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT to Tristate(Yes) at this location...
linux-config>   --> /nix/store/xp8xhhs98j6ir1y8cqyvhcddlbkhrlnl-linux-6.1.13-autokernel.lua:2
linux-config>    |
linux-config>  2 | DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT:satisfy { y, recursive = true }
linux-config>    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hint: this did not change the previous value Boolean(false)
linux-config>    |
linux-config>    = note: cannot suggest solution because automatic dependency resolution failed (UnsupportedConstituents)
linux-config> error: aborting due to 1 previous errors

This, unfortunately, is extremely hard to debug, since no further information on which constituents are unsupported is given.

It'd be great if it would at least provide some information regarding where in the resolution process it encountered the issue.

No-op reassignments shouldn't warn

If two options cause a reassignment, but the value hasn't actually changed, we should not generate a warning.

Given the following script:

load_kconfig_unchecked(kernel_dir .. "/arch/x86/configs/x86_64_defconfig")
ACPI_APEI:satisfy { y, recursive = true }
ACPI_APEI_GHES:satisfy { y, recursive = true }
ACPI_DPTF:satisfy { y, recursive = true }
ACPI_FPDT:satisfy { y, recursive = true }
ACPI_HMAT:satisfy { y, recursive = true }
BPF_LSM:satisfy { y, recursive = true }
CPU_FREQ_DEFAULT_GOV_PERFORMANCE:satisfy { y, recursive = true }
CPU_FREQ_GOV_SCHEDUTIL:satisfy { y, recursive = true }
CRASH_DUMP:set(n)
DEBUG_DEVRES:set(n)
DEBUG_INFO_REDUCED:set(n)
DEBUG_KERNEL:satisfy { y, recursive = true }
DEBUG_STACK_USAGE:set(n)
DETECT_HUNG_TASK:satisfy { y, recursive = true }
DYNAMIC_DEBUG:satisfy { y, recursive = true }
INTEL_IDLE:satisfy { y, recursive = true }
INTEL_RAPL:satisfy { m, recursive = true }
PM_ADVANCED_DEBUG:satisfy { y, recursive = true }
PM_WAKELOCKS:satisfy { y, recursive = true }
POWERCAP:satisfy { y, recursive = true }
RCU_TORTURE_TEST:set(n)
SCHEDSTATS:set(n)
SCHED_DEBUG:satisfy { y, recursive = true }
SUNRPC_DEBUG:satisfy { y, recursive = true }
X86_AMD_PSTATE:satisfy { y, recursive = true }
X86_INTEL_LPSS:satisfy { y, recursive = true }
X86_INTEL_PSTATE:satisfy { y, recursive = true }

You see this warning:

linux-config> warning: reassignment of symbol POWERCAP to Tristate(Yes)
linux-config>   --> /nix/store/ivr7bxami3pcbmvlbvvc0nbmbjk0by98-linux-6.1.13-autokernel.lua:18
linux-config>    |
linux-config> 18 | INTEL_RAPL:satisfy { m, recursive = true }
linux-config>    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: previously assigned here to Tristate(Yes)
linux-config>    |                                            hint: this did not change the previous value Boolean(true)
linux-config>    |
linux-config> 21 | POWERCAP:satisfy { y, recursive = true }
linux-config>    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: reassigned here to Tristate(Yes)
linux-config>    |                                          hint: this did not change the previous value Boolean(true)
linux-config>    |

But no actual reassignment is taking place, since both eval to Boolean(true)

Usage in NixOS

Hi!

I'm working on a new approach to kernel builds for the NixOS project and wanted to try using autokernel, but have been struggling to make it work.

Firstly, I cannot get the integration tests to pass:

❯ cargo test --test integration_tests -- --nocapture integration_setup
    Finished test [unoptimized + debuginfo] target(s) in 0.07s
     Running tests/integration_tests.rs (target/debug/deps/integration_tests-718890ec49e56c32)

running 1 test
creating /tmp/autokernel-test directory
kernel tar already in cache
extracting kernel linux-5.19.1 ...
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
make: /tmp/autokernel-test/linux-5.19.1/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
Makefile:622: arch//Makefile: No such file or directory
make: *** No rule to make target 'arch//Makefile'.  Stop.
thread 'integration_setup' panicked at 'called `Result::unwrap()` on an `Err` value: Could not prepare bridge in /tmp/autokernel-test/linux-5.19.1

Caused by:
    Condition failed: `builder_output.status.success()`', tests/setup_teardown.rs:70:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test integration_setup ... FAILED

failures:

failures:
    integration_setup

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 3 filtered out; finished in 5.47s

error: test failed, to rerun pass `--test integration_tests`

This same problem is reflected when I try to use autokernel for our kernel builds, which fail:

linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> make: /build/linux-4.14.306/scripts/kconfig/autokernel_interceptor.sh: No such file or directory
linux-config> Makefile:516: arch//Makefile: No such file or directory
linux-config> make: *** No rule to make target 'arch//Makefile'.  Stop.
linux-config> error: Could not prepare bridge in .
linux-config> because: Condition failed: `builder_output.status.success()`

error: Failed to compile autokernel_bridge for autokernel bridge!

I am getting the following error when building a kernel:

~/Documents/playground/autokernel (main u=)$ ./target/debug/autokernel -c examples/myconfig.toml -k linux-5.13 build
scripts/kconfig/autokernel_bridge.c: In function ‘dev_null_message_callback’:
<command-line>: error: parameter name omitted
scripts/kconfig/autokernel_bridge.c:24:39: note: in expansion of macro ‘MESSAGE_CALLBACK_TYPE’
   24 | static void dev_null_message_callback(MESSAGE_CALLBACK_TYPE) {}
      |                                       ^~~~~~~~~~~~~~~~~~~~~
scripts/kconfig/autokernel_bridge.c: In function ‘init’:
scripts/kconfig/autokernel_bridge.c:80:2: warning: ignoring return value of ‘getcwd’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   80 |  getcwd(saved_working_directory, 2048);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: Failed to compile autokernel_bridge for autokernel bridge!
make[1]: *** [scripts/kconfig/Makefile:87: defconfig] Error 1
make: *** [Makefile:614: defconfig] Error 2
error: Could not prepare bridge in linux-5.13
because: Condition failed: `builder_output.status.success()`
  • examples/myconfig.toml is the same as examples/config.toml with the path to the configuration file modified
~/Documents/playground/autokernel (main u=)$ diff examples/config.toml examples/myconfig.toml
17c17
< script = "/etc/autokernel/config.lua"
---
> script = "~/Documents/playground/autokernel/linux-5.13/.config"

KConfigLib is broken for kernels newer than 5.12.1 (at least)

KConfigLib fails to parse the kconfig.include file from "newer" kernels, at least since version 5.12.1. This is very unfortunate and there is nothing we can do about it, until it gets fixed in the mentioned library (except from rewriting this tool in another language).

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.