paulgazz / kmax

A collection of analysis tools for Kconfig and Kbuild constraints.
42 stars 21 forks source link

kextract error when generating formulas for BusyBox #249

Closed garandria closed 6 months ago

garandria commented 6 months ago

As mentioned in the Advanced usage documentation, it is possible to use Kmax with Busybox. However, following the instructions, the first call to kextract gives an error:

$ git clone https://git.busybox.net/busybox && cd busybox
$ mkdir .kmax
$ kextract --module-version 3.19 --extract Config.in > .kmax/kextract
$ cat .kmax/kextract
    Config.in:727: can't open file "libbb/Config.in"

In fact, the Config.in files that contain the description of the options are generated by Busybox during the build with the gen_build_files rule (with Kbuild files as well). To get rid of this error, have to generate the Config.in files first then call kextract. I would suggest to add the generation Config.in files before the call to kextract, as follows:

$ git clone https://git.busybox.net/busybox && cd busybox
$ mkdir .kmax
$ make gen_build_files
$ kextract --module-version 3.19 --extract Config.in > .kmax/kextract
$ kclause --remove-orphaned-nonvisible < .kmax/kextract > .kmax/kclause

Now, .kmax/extract has the right content and ./kmax/clause has been generated successfully.

paulgazz commented 6 months ago

Thanks @garandria !