Skip to content

Instantly share code, notes, and snippets.

@qknight
Created April 7, 2015 09:48
Show Gist options
  • Save qknight/2b360397b602a235485a to your computer and use it in GitHub Desktop.
Save qknight/2b360397b602a235485a to your computer and use it in GitHub Desktop.
diff --git a/README.md b/README.md
index fa5a419..d9011b8 100644
--- a/README.md
+++ b/README.md
@@ -18,3 +18,5 @@ Communication:
* [Mailing list](http://lists.science.uu.nl/mailman/listinfo/nix-dev)
* [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos)
+hi
+hu
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 71915a0..f095475 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -399,6 +399,7 @@
./system/boot/loader/gummiboot/gummiboot.nix
./system/boot/loader/init-script/init-script.nix
./system/boot/loader/raspberrypi/raspberrypi.nix
+ ./system/boot/loader/odroidU3/odroidU3.nix
./system/boot/luksroot.nix
./system/boot/modprobe.nix
./system/boot/shutdown.nix
diff --git a/nixos/modules/system/boot/loader/odroidU3/builder.sh b/nixos/modules/system/boot/loader/odroidU3/builder.sh
new file mode 100644
index 0000000..f6ccfe4
--- /dev/null
+++ b/nixos/modules/system/boot/loader/odroidU3/builder.sh
@@ -0,0 +1,109 @@
+#! @bash@/bin/sh -e
+
+shopt -s nullglob
+
+export PATH=/empty
+for i in @path@; do PATH=$PATH:$i/bin; done
+
+default=$1
+if test -z "$1"; then
+ echo "Syntax: builder.sh <DEFAULT-CONFIG>"
+ exit 1
+fi
+
+echo "updating the boot generations directory..."
+
+mkdir -p /boot/old
+
+# Convert a path to a file in the Nix store such as
+# /nix/store/<hash>-<name>/file to <hash>-<name>-<file>.
+cleanName() {
+ local path="$1"
+ echo "$path" | sed 's|^/nix/store/||' | sed 's|/|-|g'
+}
+
+# Copy a file from the Nix store to /boot/kernels.
+declare -A filesCopied
+
+copyToKernelsDir() {
+ local src="$1"
+ local dst="/boot/old/$(cleanName $src)"
+ # Don't copy the file if $dst already exists. This means that we
+ # have to create $dst atomically to prevent partially copied
+ # kernels or initrd if this script is ever interrupted.
+ if ! test -e $dst; then
+ local dstTmp=$dst.tmp.$$
+ cp $src $dstTmp
+ mv $dstTmp $dst
+ fi
+ filesCopied[$dst]=1
+ result=$dst
+}
+
+copyForced() {
+ local src="$1"
+ local dst="$2"
+ cp $src $dst.tmp
+ mv $dst.tmp $dst
+}
+
+outdir=/boot/old
+mkdir -p $outdir || true
+
+# Copy its kernel and initrd to /boot/kernels.
+addEntry() {
+ local path="$1"
+ local generation="$2"
+
+ if ! test -e $path/kernel -a -e $path/initrd; then
+ return
+ fi
+
+ local kernel=$(readlink -f $path/kernel)
+ # local initrd=$(readlink -f $path/initrd)
+
+ if test -n "@copyKernels@"; then
+ copyToKernelsDir $kernel; kernel=$result
+ # copyToKernelsDir $initrd; initrd=$result
+ fi
+
+ echo $(readlink -f $path) > $outdir/$generation-system
+ echo $(readlink -f $path/init) > $outdir/$generation-init
+ cp $path/kernel-params $outdir/$generation-cmdline.txt
+ # echo $initrd > $outdir/$generation-initrd
+ echo $kernel > $outdir/$generation-kernel
+
+ if test $(readlink -f "$path") = "$default"; then
+ copyForced $kernel /boot/kernel.img
+ # copyForced $initrd /boot/initrd
+ cp "$(readlink -f "$path/init")" /boot/nixos-init
+ echo "`cat $path/kernel-params` init=$path/init" >/boot/cmdline.txt
+
+ echo "$2" > /boot/defaultgeneration
+ fi
+}
+
+# Add all generations of the system profile to the menu, in reverse
+# (most recent to least recent) order.
+for generation in $(
+ (cd /nix/var/nix/profiles && ls -d system-*-link) \
+ | sed 's/system-\([0-9]\+\)-link/\1/' \
+ | sort -n -r); do
+ link=/nix/var/nix/profiles/system-$generation-link
+ addEntry $link $generation
+done
+
+# Add the firmware files
+fwdir=@firmware@/share/raspberrypi/boot/
+copyForced $fwdir/bootcode.bin /boot/bootcode.bin
+copyForced $fwdir/fixup.dat /boot/fixup.dat
+copyForced $fwdir/fixup_cd.dat /boot/fixup_cd.dat
+copyForced $fwdir/start.elf /boot/start.elf
+copyForced $fwdir/start_cd.elf /boot/start_cd.elf
+
+# Remove obsolete files from /boot/old.
+for fn in /boot/old/*linux* /boot/old/*initrd*; do
+ if ! test "${filesCopied[$fn]}" = 1; then
+ rm -vf -- "$fn"
+ fi
+done
diff --git a/nixos/modules/system/boot/loader/odroidU3/odroidU3.nix b/nixos/modules/system/boot/loader/odroidU3/odroidU3.nix
new file mode 100644
index 0000000..7449e21
--- /dev/null
+++ b/nixos/modules/system/boot/loader/odroidU3/odroidU3.nix
@@ -0,0 +1,39 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ builder = pkgs.substituteAll {
+ src = ./builder.sh;
+ isExecutable = true;
+ inherit (pkgs) bash;
+ path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
+ #firmware = pkgs.raspberrypifw;
+ };
+
+ platform = pkgs.stdenv.platform;
+
+in
+
+{
+ options = {
+
+ boot.loader.odroidU3.enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether to create files with the system generations in
+ <literal>/boot</literal>.
+ <literal>/boot/old</literal> will hold files from old generations.
+ '';
+ };
+
+ };
+
+ config = mkIf config.boot.loader.odroidU3.enable {
+ system.build.installBootLoader = builder;
+ system.boot.loader.id = "odroidU3";
+ system.boot.loader.kernelFile = platform.kernelTarget;
+ };
+}
diff --git a/pkgs/applications/graphics/sane/backends.nix b/pkgs/applications/graphics/sane/backends.nix
index 7432154..ae16414 100644
--- a/pkgs/applications/graphics/sane/backends.nix
+++ b/pkgs/applications/graphics/sane/backends.nix
@@ -2,7 +2,7 @@
, pkgconfig ? null, gt68xxFirmware ? null, snapscanFirmware ? null
}:
-assert hotplugSupport -> (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux");
+#assert hotplugSupport -> (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux");
let
firmware = gt68xxFirmware { inherit fetchurl; };
diff --git a/pkgs/development/compilers/oraclejdk/jdk6-linux.nix b/pkgs/development/compilers/oraclejdk/jdk6-linux.nix
index 84fdf63..7cc6345 100644
--- a/pkgs/development/compilers/oraclejdk/jdk6-linux.nix
+++ b/pkgs/development/compilers/oraclejdk/jdk6-linux.nix
@@ -9,7 +9,7 @@
, installjce ? false
}:
-assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
+#assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
assert swingSupport -> xlibs != null;
let
diff --git a/pkgs/os-specific/linux/kernel/linux-odroid_u.nix b/pkgs/os-specific/linux/kernel/linux-odroid_u.nix
new file mode 100644
index 0000000..78cfb3c
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/linux-odroid_u.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchgit, ... } @ args:
+
+import ./generic.nix (args // rec {
+ version = "3.8.13.23";
+
+ modDirVersion = "3.8.13.23"; #WTF is a modDirVersion?
+
+ src = fetchgit {
+ url = "https://github.com/hardkernel/linux.git";
+ rev = "611de8e983e24007598ca87cb0060b5412f97e43";
+ sha256 = "09jdzkpqfmnpz4i974p4vy84489wmkl5yq5rawhqwg1i2alas58s";
+ };
+
+ #features.iwlwifi = true;
+
+ extraMeta.hydraPlatforms = [];
+})
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index eb83bcc..ce7bc62 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7,7 +7,7 @@
{ # The system (e.g., `i686-linux') for which to build the packages.
system ? builtins.currentSystem
-
+
, # The standard environment to use. Only used for bootstrapping. If
# null, the default standard environment is used.
bootStdenv ? null
@@ -36,6 +36,7 @@ let config_ = config; platform_ = platform; in # rename the function arguments
let
+
lib = import ../../lib;
# The contents of the configuration file found at $NIXPKGS_CONFIG or
@@ -72,7 +73,7 @@ let
platforms = (import ./platforms.nix);
in
if system == "armv6l-linux" then platforms.raspberrypi
- else if system == "armv7l-linux" then platforms.beaglebone
+ else if system == "armv7l-linux" then platforms.odroidU3
else if system == "armv5tel-linux" then platforms.sheevaplug
else if system == "mips64el-linux" then platforms.fuloong2f_n32
else if system == "x86_64-linux" then platforms.pc64
@@ -3770,7 +3771,7 @@ let
system == "x86_64-linux";
jdkdistro = installjdk: pluginSupport:
- assert supportsJDK;
+ #assert supportsJDK;
(if pluginSupport then appendToName "with-plugin" else x: x)
(callPackage ../development/compilers/oraclejdk/jdk6-linux.nix { });
@@ -8876,7 +8877,13 @@ let
# -- Linux kernel expressions ------------------------------------------------
- linuxHeaders = linuxHeaders_3_12;
+ #linuxHeaders = linuxHeaders_3_12;
+ # systemd seems to force linuxHeaders_3_14 which i replaced to use 3.8 odroid thingy
+ linuxHeaders_default = callPackage ../os-specific/linux/kernel-headers/default.nix {
+ kernel = linux_odroid_u;
+ };
+
+ linuxHeaders = linuxHeaders_default;
linuxHeaders24Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.4.nix {
inherit stdenv fetchurl perl;
@@ -8888,9 +8895,10 @@ let
cross = assert crossSystem != null; crossSystem;
});
+
linuxHeaders_3_12 = callPackage ../os-specific/linux/kernel-headers/3.12.nix { };
- linuxHeaders_3_14 = callPackage ../os-specific/linux/kernel-headers/3.14.nix { };
+ #linuxHeaders_3_14 = callPackage ../os-specific/linux/kernel-headers/3.14.nix { };
# We can choose:
linuxHeadersCrossChooser = ver : if ver == "2.4" then linuxHeaders24Cross
@@ -8921,6 +8929,10 @@ let
kernelPatches = [ kernelPatches.bridge_stp_helper ];
};
+ linux_odroid_u = makeOverridable (import ../os-specific/linux/kernel/linux-odroid_u.nix) {
+ inherit fetchgit stdenv perl buildLinux;
+ };
+
linux_3_10 = makeOverridable (import ../os-specific/linux/kernel/linux-3.10.nix) {
inherit fetchurl stdenv perl buildLinux;
kernelPatches = [ kernelPatches.bridge_stp_helper ]
@@ -9137,6 +9149,7 @@ let
linuxPackages_3_2 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_2 linuxPackages_3_2);
linuxPackages_3_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_4 linuxPackages_3_4);
linuxPackages_rpi = linuxPackagesFor pkgs.linux_rpi linuxPackages_rpi;
+ linuxPackages_odroid_u = linuxPackagesFor pkgs.linux_odroid_u linuxPackages_odroid_u;
linuxPackages_3_10 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_10 linuxPackages_3_10);
linuxPackages_3_10_tuxonice = linuxPackagesFor pkgs.linux_3_10_tuxonice linuxPackages_3_10_tuxonice;
linuxPackages_3_12 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_12 linuxPackages_3_12);
@@ -9371,7 +9384,7 @@ let
sysstat = callPackage ../os-specific/linux/sysstat { };
systemd = callPackage ../os-specific/linux/systemd {
- linuxHeaders = linuxHeaders_3_14;
+ linuxHeaders = linuxHeaders_default;
};
systemtap = callPackage ../development/tools/profiling/systemtap {
diff --git a/pkgs/top-level/platforms.nix b/pkgs/top-level/platforms.nix
index 8bdc4f7..de14a96 100644
--- a/pkgs/top-level/platforms.nix
+++ b/pkgs/top-level/platforms.nix
@@ -212,6 +212,22 @@ rec {
};
};
+ odroidU3 = {
+ name = "odroidU3";
+ kernelMajor = "3.8";
+ kernelHeadersBaseConfig = "exynos4412-smdk4412";
+ kernelBaseConfig = "odroidu_defconfig";
+ kernelAutoModules = false;
+ kernelArch = "arm";
+ kernelTarget = "zImage";
+ uboot = null;
+ gcc = {
+ arch = "armv7-a";
+ fpu = "vfpv3-d16";
+ float = "hard";
+ };
+ };
+
raspberrypi2 = {
name = "raspberrypi2";
kernelMajor = "3.14";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment