[wip] kernel: attempt to rerun unpackPhase if sthg fishy (e.g. buildRoot unset)#31463
[wip] kernel: attempt to rerun unpackPhase if sthg fishy (e.g. buildRoot unset)#31463teto wants to merge 17 commits intoNixOS:masterfrom
Conversation
|
I'd just move this from |
|
I tried on a nix build but I don't think it works. buildRoot seems to be useful mostly to grab the config but I don't fully grasp where/when the config is generated, only related link #14721. Isn't it possible to defer the config generation or reregenerate it if it can't be found ? that would solve my problem and kinda makes sense. I would expect the kernel configurePhase to generate it (while it does nothing now) |
|
So Ive defined an overlay and when I run |
|
So I got some more understanding of the problem also thanks to clever, i.e., even if your Now it compiles but I notice it compiles a lot of things. I intend to build a minimal image for qemu testing purpose. How can I prevent config generation and use my own, there seems to be the config Back to the initial issue, it might be best during the configPhase to not assume any specific folder and ask the user instead where he wants to build, sthg like |
layus
left a comment
There was a problem hiding this comment.
Oops. My review was never submitted apparently...
There was a problem hiding this comment.
This should go into the shellHook attribute. The shellHook is executed at the begining of every nix-shell invocation.
There was a problem hiding this comment.
This looks like something you do not want to commit ;-)
|
I forgot this branch was a PR and started pushing some random stuff but I tried just the initial patch with nix-build it won't work. So I can't remove the preUnpack phase, at least not without doing some extra debugging The patch |
When trying to compile/hack the kernel, it would keep asking me to generate the .config file. That was because I had skipped the unpackPhase. Also if one exit the nix-shell (voluntarely or because of an error) and wants to resume the configure phase, it would fail because '$buildRoot' is not set; it is set during the unpackPhase. My tackle on that is that there is a great chance the nix-shell was resumed from the unpacked folder. Then the configurePhase sets the buildRoot accordingly. I could have done it via a preConfigure hook but either way the current situation is not good since one doesn"t know why he is asked to generate the config. Dying with a message "set $buildRoot" could be an option.
…ell etc wip in pkgs/os-specific/linux/kernel/config.nix
===========
En gros on a linux_mptcp = callPackage generic.nix (linux_mptcp.nix)
generic.nix fait appel a buildLinux qui est defini dans manual-config.nix
generic.nix importe aussi kernelPlatform: import ./common-config.nix
extraConfig (optional) is a string specifying extra options to be concatenated to the kernel configuration file (.config)
===========
kernelPatches is a set of
bridge_stp_helper =
{ name = "bridge-stp-helper";
patch = ./bridge-stp-helper.patch;
};
'make oldconfig' It reads the existing .config file and prompts the user for options in the current kernel source that are not found in the file. This is useful when taking an existing configuration and moving it to a new kernel
configfile est un chemin vers le fichier au format '.config' tandis que 'config'
pcBase = {
name = "pc";
kernelHeadersBaseConfig = "defconfig";
kernelBaseConfig = "defconfig";
# Build whatever possible as a module, if not stated in the extra config.
kernelAutoModules = true;
kernelTarget = "bzImage";
};
pc64 = pcBase // { kernelArch = "x86_64"; };
kernelTargets
kernelExtraConfig =
''
# Ubi for the mtd
MTD_UBI y
UBIFS_FS y
UBIFS_FS_XATTR y
UBIFS_FS_ADVANCED_COMPR y
UBIFS_FS_LZO y
UBIFS_FS_ZLIB y
UBIFS_FS_DEBUG n
'';
dans la phase de build du noyau
make -C ../$sourceRoot O=$PWD $kernelBaseConfig ARCH=$arch
warning: dumping very large path (> 256 MiB); this may run out of memory
Using .. as source for kernel
- merge config/kernel and have a stopAtConfig boolean ? - override src of config ? - have 2 different configs ? embedded/inplace
fixed perl script. this works in nix-shell but now fails with nix-build,
aka nixops fails .
…for crossplatform comiplation only
|
Closing this, there are so many ways kernel building could be improved, this deserves a more comprehensive approach. |
When trying to compile/hack the kernel, nixos would keep asking me to
generate the .config file. That was because I had skipped the
unpackPhase.
Also if one exits the nix-shell (voluntarely or because of an error) and wants to resume the configure phase, it fails too because '$buildRoot' is not set; it is set during the unpackPhase.
My tackle on that is that there is a great chance the nix-shell was resumed from the unpacked folder.
Then the configurePhase sets the buildRoot accordingly, assuming we are in the unpacked folder.
I could have done it via a preConfigure hook but either way the current
situation is not good since one doesn"t know why he is asked to generate
the config. Dying with a message "set $buildRoot" could be an option.
Motivation for this change
Things done
build-use-sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)