Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coreboot-utils: init at 4.10 #67836

Merged
merged 1 commit into from Sep 3, 2019
Merged

coreboot-utils: init at 4.10 #67836

merged 1 commit into from Sep 3, 2019

Conversation

ghost
Copy link

@ghost ghost commented Aug 31, 2019

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@ghost ghost changed the title Feature/corebootutils corebootutils: init at 4.10 Aug 31, 2019
@ghost
Copy link
Author

ghost commented Aug 31, 2019

@worldofpeace
I am aware it is not best practise to use custom phases, but I think the advantage here is that new tools can be easily added. If you see any better way to do this, I would like to see it.

@ghost
Copy link
Author

ghost commented Aug 31, 2019

One alternative I see is putting each tool in an own derivation, but using a generic expression for them. Do you think that's preferable?

@ghost ghost changed the title corebootutils: init at 4.10 coreboot-utils: init at 4.10 Aug 31, 2019
@ghost
Copy link
Author

ghost commented Aug 31, 2019

I don't get why ofborg is failing

@ghost
Copy link
Author

ghost commented Aug 31, 2019

Ah, pmtools is an alias.

@worldofpeace
Copy link
Contributor

@worldofpeace
I am aware it is not best practice to use custom phases, but I think the advantage here is that new tools can be easily added. If you see any better way to do this, I would like to see it.

I'd say ideally, coreboot would just have a Makefile in the util directory with targets for each of the utilities.

One alternative I see is putting each tool in an own derivation, but using a generic expression for them. Do you think that's preferable?

I'm not sure about putting each tool into it's own derivation.
Current disadvantage of coreboot-utils is that you can't have just one utility, so maybe split it.
Though it does seem to be more popular

My only nit currently is that it looks a bit procedural, we could use loops to make it clearer.
Fake code looks like

makeFlags = [ 
  "PREFIX=${placeholder "out"}"
];

preBuild = ''
  cd util
'';

buildPhase = ''
  runHook preBuild

  for util in ...directories of tools; do
    make $makeFlags -C $util
  done

  runHook postBuild
'';

installPhase = ''
  ....similar thing as build phase
'';

postFixup = ''
  ...should wrap that program here
'';

@ghost
Copy link
Author

ghost commented Sep 2, 2019

@worldofpeace: I found it easier to solve it like this, please take a look

@ghost
Copy link
Author

ghost commented Sep 3, 2019

We should be good to go then :)

@worldofpeace
Copy link
Contributor

I noticed when building i had to unpack the archive multiple times, but I guess there's no way around that.

@worldofpeace
Copy link
Contributor

It looks like it tries to install things to sbin

├── bin
│   ├── acpidump-all -> /nix/store/50ydys5lgnqbv34rvpra2jwa7ys85g3l-acpidump-all-4.10/bin/acpidump-all
│   ├── amdfwtool -> /nix/store/b78wwi966a4an64gk19nhmkblzqp42wv-amdfwtool-4.10/bin/amdfwtool
│   ├── cbfs-compression-tool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/cbfs-compression-tool
│   ├── cbfstool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/cbfstool
│   ├── cbmem -> /nix/store/3nbj9bmrdnvg9s3a919kq3ns2wil93lz-cbmem-4.10/bin/cbmem
│   ├── ectool -> /nix/store/ypinf2l28mn05j5jdzx5szx5i0fx8dly-ectool-4.10/bin/ectool
│   ├── fmaptool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/fmaptool
│   ├── ifdtool -> /nix/store/skwh2bdgjppksr4sn5nmw0cp4h4qnpxk-ifdtool-4.10/bin/ifdtool
│   ├── ifittool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/ifittool
│   ├── ifwitool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/ifwitool
│   ├── intelmetool -> /nix/store/hsf1rgq5aqv2bhjhlka1n574wzjaa5i2-intelmetool-4.10/bin/intelmetool
│   ├── inteltool -> /nix/store/8m36y393g2ikfnk9y04h84kklvif8jyw-inteltool-4.10/bin/inteltool
│   ├── msrtool -> /nix/store/cayfmg47wgliwmwz5cn77hmvwphr2601-msrtool-4.10/bin/msrtool
│   ├── nvramtool -> /nix/store/kcysznlapfr4cj3vz8nd6k8hbhaz3pgv-nvramtool-4.10/bin/nvramtool
│   ├── rmodtool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/rmodtool
│   └── superiotool -> /nix/store/l28ay2p1ly63nz9dw3bddj8ls0z4r85d-superiotool-4.10/bin/superiotool
├── sbin
│   ├── cbmem -> /nix/store/3nbj9bmrdnvg9s3a919kq3ns2wil93lz-cbmem-4.10/sbin/cbmem
│   ├── ectool -> /nix/store/ypinf2l28mn05j5jdzx5szx5i0fx8dly-ectool-4.10/sbin/ectool
│   ├── intelmetool -> /nix/store/hsf1rgq5aqv2bhjhlka1n574wzjaa5i2-intelmetool-4.10/sbin/intelmetool
│   ├── inteltool -> /nix/store/8m36y393g2ikfnk9y04h84kklvif8jyw-inteltool-4.10/sbin/inteltool
│   ├── msrtool -> /nix/store/cayfmg47wgliwmwz5cn77hmvwphr2601-msrtool-4.10/sbin/msrtool
│   ├── nvramtool -> /nix/store/kcysznlapfr4cj3vz8nd6k8hbhaz3pgv-nvramtool-4.10/sbin/nvramtool
│   └── superiotool -> /nix/store/l28ay2p1ly63nz9dw3bddj8ls0z4r85d-superiotool-4.10/sbin/superiotool

and we have setup hook that moves these things, but it probably doesn't work because of duplication?
Perhaps look at which makefiles do this and install manually, or maybe there's a way to override it.

@ghost
Copy link
Author

ghost commented Sep 3, 2019

It looks like it tries to install things to sbin

├── bin
│   ├── acpidump-all -> /nix/store/50ydys5lgnqbv34rvpra2jwa7ys85g3l-acpidump-all-4.10/bin/acpidump-all
│   ├── amdfwtool -> /nix/store/b78wwi966a4an64gk19nhmkblzqp42wv-amdfwtool-4.10/bin/amdfwtool
│   ├── cbfs-compression-tool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/cbfs-compression-tool
│   ├── cbfstool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/cbfstool
│   ├── cbmem -> /nix/store/3nbj9bmrdnvg9s3a919kq3ns2wil93lz-cbmem-4.10/bin/cbmem
│   ├── ectool -> /nix/store/ypinf2l28mn05j5jdzx5szx5i0fx8dly-ectool-4.10/bin/ectool
│   ├── fmaptool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/fmaptool
│   ├── ifdtool -> /nix/store/skwh2bdgjppksr4sn5nmw0cp4h4qnpxk-ifdtool-4.10/bin/ifdtool
│   ├── ifittool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/ifittool
│   ├── ifwitool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/ifwitool
│   ├── intelmetool -> /nix/store/hsf1rgq5aqv2bhjhlka1n574wzjaa5i2-intelmetool-4.10/bin/intelmetool
│   ├── inteltool -> /nix/store/8m36y393g2ikfnk9y04h84kklvif8jyw-inteltool-4.10/bin/inteltool
│   ├── msrtool -> /nix/store/cayfmg47wgliwmwz5cn77hmvwphr2601-msrtool-4.10/bin/msrtool
│   ├── nvramtool -> /nix/store/kcysznlapfr4cj3vz8nd6k8hbhaz3pgv-nvramtool-4.10/bin/nvramtool
│   ├── rmodtool -> /nix/store/f1qvacrckyvnxshkdpl37gzf06zlhl2s-cbfstool-4.10/bin/rmodtool
│   └── superiotool -> /nix/store/l28ay2p1ly63nz9dw3bddj8ls0z4r85d-superiotool-4.10/bin/superiotool
├── sbin
│   ├── cbmem -> /nix/store/3nbj9bmrdnvg9s3a919kq3ns2wil93lz-cbmem-4.10/sbin/cbmem
│   ├── ectool -> /nix/store/ypinf2l28mn05j5jdzx5szx5i0fx8dly-ectool-4.10/sbin/ectool
│   ├── intelmetool -> /nix/store/hsf1rgq5aqv2bhjhlka1n574wzjaa5i2-intelmetool-4.10/sbin/intelmetool
│   ├── inteltool -> /nix/store/8m36y393g2ikfnk9y04h84kklvif8jyw-inteltool-4.10/sbin/inteltool
│   ├── msrtool -> /nix/store/cayfmg47wgliwmwz5cn77hmvwphr2601-msrtool-4.10/sbin/msrtool
│   ├── nvramtool -> /nix/store/kcysznlapfr4cj3vz8nd6k8hbhaz3pgv-nvramtool-4.10/sbin/nvramtool
│   └── superiotool -> /nix/store/l28ay2p1ly63nz9dw3bddj8ls0z4r85d-superiotool-4.10/sbin/superiotool

and we have setup hook that moves these things, but it probably doesn't work because of duplication?
Perhaps look at which makefiles do this and install manually, or maybe there's a way to override it.

It moves the files, and then creates a symlink from sbin to bin so that things don't break. Is this a problem?

@worldofpeace
Copy link
Contributor

It moves the files, and then creates a symlink from sbin to bin so that things don't break. Is this a problem?

Ahh, I forgot it was a buildEnv. So what happens is it works properly individually, but when they get merged with buildEnv sbin becomes an actual directory with symlinks to symlinks.
I think that's kinda messy for coreboot-utils, can you prune that away?

@ghost
Copy link
Author

ghost commented Sep 3, 2019

It moves the files, and then creates a symlink from sbin to bin so that things don't break. Is this a problem?

Ahh, I forgot it was a buildEnv. So what happens is it works properly individually, but when they get merged with buildEnv sbin becomes an actual directory with symlinks to symlinks.
I think that's kinda messy for coreboot-utils, can you prune that away?

Sure, done.

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you describe your changes in your commit body?

Build various tools from the coreboot tree with a generic builder for better
maintainability and provide a buildEnv with all of them, similar to other
distributions' coreboot-utils package.
@ghost
Copy link
Author

ghost commented Sep 3, 2019

LGTM, can you describe your changes in your commit body?

Done

@worldofpeace worldofpeace merged commit 62973dd into NixOS:master Sep 3, 2019
@worldofpeace
Copy link
Contributor

Thanks for fixing this @petabyteboy ✨

dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Sep 19, 2019
coreboot-utils: init at 4.10
(cherry picked from commit 62973dd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants