Another thing: > The next step is to run > > ```shell > make localmodconfig > ``` > > and note the output. Do note that the '.config' file is still empty. > The output generally contains two types of warnings. The first start > with "WARNING" and can actually be ignored in our case. The second read: > ```shell > module pcspkr did not have configs CONFIG_INPUT_PCSPKR > ``` > > For each of these lines, copy the CONFIG_XXXX_XXXX portion into the > '.config' in the directory, and append "=m", so in the end it looks > like this: > ```shell > CONFIG_INPUT_PCSPKR=m > CONFIG_VIRTIO=m Since I'm not starting from a blank .config, I wanted to compare the output of `make localmodconfig' and, even better, automatically enable all the missing modules. In my case there was some 150 modules and that would have been a lot of work. So I wrote those quick and dirty Emacs functions: --8<---------------cut here---------------start------------->8--- (defun kernel-compare-configs (file1 file2) "Go through all CONFIG_* variables in FILE1 and report those in file2 which are not set." (interactive "f\nf") (let ((buffer1 (find-file-noselect file1)) (buffer2 (find-file-noselect file2)) result) (with-current-buffer buffer1 (goto-char (point-min)) (while (search-forward "CONFIG_" nil 'noerror) (let ((var (symbol-name (sexp-at-point)))) (with-current-buffer buffer2 (goto-char (point-min)) (when (search-forward var nil 'noerror) (forward-char) (let ((value (word-at-point))) (unless (or (string= value "m") (string= value "y")) (push var result)))))))) result)) (defun kernel-enable-configs (file variables) "Variables must be a list of strings. Example: (\"CONFIG_MODULES\")" (let ((buffer (find-file-noselect file))) (with-current-buffer buffer (dolist (var variables) (goto-char (point-min)) ;; Match exact variable only, e.g. CONFIG_MODULES should not match ;; CONFIG_MODULES_TREE_LOOKUP. (if (not (re-search-forward (concat var "[= ]") nil 'noerror)) (warn "Variable %S not found" var) (beginning-of-line) (let ((kill-whole-line nil)) (kill-line)) (insert (format "%s=y" var))))))) ;; Example: ; (kernel-enable-configs ; "/home/ambrevar/.guix-packages/ambrevar/linux-laptop.conf" ; (compare-kernel-configs ; "localmodconfig.config" ; "/home/ambrevar/.guix-packages/ambrevar/linux-laptop.conf")) --8<---------------cut here---------------end--------------->8--- The above is not general enough but that's a start. I wonder if there aren't some dedicated tools out there already. Anyone? -- Pierre Neidhardt https://ambrevar.xyz/