@ -13,6 +13,9 @@
# chips and can also write to the embedded controller (EC) flash,
# chips and can also write to the embedded controller (EC) flash,
# which is a separate chip
# which is a separate chip
, forChromebook ? false
, forChromebook ? false
, writeProtectSupport ? true
, overlappingFmapRegionSupport ? false
} :
} :
stdenv . mkDerivation {
stdenv . mkDerivation {
@ -36,12 +39,13 @@ stdenv.mkDerivation {
buildInputs = lib . optional ( ! stdenv . hostPlatform . isStatic ) libftdi1
buildInputs = lib . optional ( ! stdenv . hostPlatform . isStatic ) libftdi1
++ [ libusb1 pciutils ] ;
++ [ libusb1 pciutils ] ;
patches =
patches = lib . optionals ( writeProtectSupport && ! forChromebook ) [
if ! forChromebook then [
# the forChromebook fork already has (Google's version of) the enableWriteProtect patches
./0001-implement-wp-enable-disable-for-gigadevice-flash-chi.patch
./0001-implement-wp-enable-disable-for-gigadevice-flash-chi.patch
./0002-layout.c-allow-nested-regions.patch
] ++ lib . optionals forChromebook [
] else [
../../platform/kevin/chromebook-flashrom-kludges.patch
../../platform/kevin/chromebook-flashrom-kludges.patch
] ++ lib . optionals overlappingFmapRegionSupport [
./0002-layout.c-allow-nested-regions.patch
] ;
] ;
makeFlags = if ! forChromebook then [
makeFlags = if ! forChromebook then [
@ -54,6 +58,10 @@ stdenv.mkDerivation {
mv $ out/sbin/flashrom $ out/sbin/flashrom-chromebook
mv $ out/sbin/flashrom $ out/sbin/flashrom-chromebook
'' ;
'' ;
passthru = {
inherit forChromebook writeProtectSupport overlappingFmapRegionSupport ;
} ;
meta = with lib ; {
meta = with lib ; {
homepage = " h t t p s : / / w w w . f l a s h r o m . o r g " ;
homepage = " h t t p s : / / w w w . f l a s h r o m . o r g " ;
description = " U t i l i t y f o r r e a d i n g , w r i t i n g , e r a s i n g a n d v e r i f y i n g f l a s h R O M c h i p s " ;
description = " U t i l i t y f o r r e a d i n g , w r i t i n g , e r a s i n g a n d v e r i f y i n g f l a s h R O M c h i p s " ;