Fixing the nanonote kernel expressions so they work.

In fact only 2.6.34 boots fine, while 2.6.35 needs a fetchsvn new revision,
waiting for an upstream patch.

svn path=/nixpkgs/branches/stdenv-updates/; revision=23039
This commit is contained in:
Lluís Batlle i Rossell 2010-08-08 18:46:57 +00:00
parent f2de89336b
commit eddc9d6ab5
5 changed files with 146 additions and 81 deletions

View File

@ -74,75 +74,81 @@ installPhase() {
cp vmlinux $out
# Install the modules in $out/lib/modules with matching paths
# in modules.dep (i.e., refererring to $out/lib/modules, not
# /lib/modules). The depmod_opts= is to prevent the kernel
# from passing `-b PATH' to depmod.
export MODULE_DIR=$out/lib/modules/
substituteInPlace Makefile --replace '-b $(INSTALL_MOD_PATH)' ''
make modules_install \
DEPMOD=$module_init_tools/sbin/depmod depmod_opts= \
$makeFlags "${makeFlagsArray[@]}" \
$installFlags "${installFlagsArray[@]}"
if grep -q "CONFIG_MODULES=y" .config; then
# Install the modules in $out/lib/modules with matching paths
# in modules.dep (i.e., refererring to $out/lib/modules, not
# /lib/modules). The depmod_opts= is to prevent the kernel
# from passing `-b PATH' to depmod.
export MODULE_DIR=$out/lib/modules/
substituteInPlace Makefile --replace '-b $(INSTALL_MOD_PATH)' ''
make modules_install \
DEPMOD=$module_init_tools/sbin/depmod depmod_opts= \
$makeFlags "${makeFlagsArray[@]}" \
$installFlags "${installFlagsArray[@]}"
if test -z "$dontStrip"; then
# Strip the kernel modules.
echo "Stripping kernel modules..."
if [ -z "$crossConfig" ]; then
find $out -name "*.ko" -print0 | xargs -0 strip -S
else
find $out -name "*.ko" -print0 | xargs -0 $crossConfig-strip -S
fi
if test -z "$dontStrip"; then
# Strip the kernel modules.
echo "Stripping kernel modules..."
if [ -z "$crossConfig" ]; then
find $out -name "*.ko" -print0 | xargs -0 strip -S
else
find $out -name "*.ko" -print0 | xargs -0 $crossConfig-strip -S
fi
fi
# move this to install later on
# largely copied from early FC3 kernel spec files
version=$(cd $out/lib/modules && ls -d *)
# remove symlinks and create directories
rm -f $out/lib/modules/$version/build
rm -f $out/lib/modules/$version/source
mkdir $out/lib/modules/$version/build
# copy config
cp .config $out/lib/modules/$version/build/.config
ln -s $out/lib/modules/$version/build/.config $out/config
if test "$arch" != um; then
# copy all Makefiles and Kconfig files
ln -s $out/lib/modules/$version/build $out/lib/modules/$version/source
cp --parents `find -type f -name Makefile -o -name "Kconfig*"` $out/lib/modules/$version/build
cp Module.symvers $out/lib/modules/$version/build
if test "$dontStrip" = "1"; then
# copy any debugging info that can be found
cp --parents -rv `find -name \*.debug -o -name debug.a` \
"$out/lib/modules/$version/build"
fi
# weed out unneeded stuff
rm -rf $out/lib/modules/$version/build/Documentation
rm -rf $out/lib/modules/$version/build/scripts
rm -rf $out/lib/modules/$version/build/include
# copy architecture dependent files
cp -a arch/$archDir/scripts $out/lib/modules/$version/build/ || true
cp -a arch/$archDir/*lds $out/lib/modules/$version/build/ || true
cp -a arch/$archDir/Makefile*.cpu $out/lib/modules/$version/build/arch/$archDir/ || true
cp -a --parents arch/$archDir/kernel/asm-offsets.s $out/lib/modules/$version/build/arch/$archDir/kernel/ || true
# copy scripts
rm -f scripts/*.o
rm -f scripts/*/*.o
cp -a scripts $out/lib/modules/$version/build
# copy include files
includeDir=$out/lib/modules/$version/build/include
mkdir -p $includeDir
(cd include && cp -a * $includeDir)
(cd arch/$archDir/include && cp -a * $includeDir || true)
(cd arch/$archDir/include && cp -a asm/* $includeDir/asm/ || true)
(cd arch/$archDir/include/asm/mach-generic && cp -a * $includeDir/ || true)
fi
fi
# move this to install later on
# largely copied from early FC3 kernel spec files
version=$(cd $out/lib/modules && ls -d *)
# remove symlinks and create directories
rm -f $out/lib/modules/$version/build
rm -f $out/lib/modules/$version/source
mkdir $out/lib/modules/$version/build
# copy config
cp .config $out/lib/modules/$version/build/.config
ln -s $out/lib/modules/$version/build/.config $out/config
if test "$arch" != um; then
# copy all Makefiles and Kconfig files
ln -s $out/lib/modules/$version/build $out/lib/modules/$version/source
cp --parents `find -type f -name Makefile -o -name "Kconfig*"` $out/lib/modules/$version/build
cp Module.symvers $out/lib/modules/$version/build
if test "$dontStrip" = "1"; then
# copy any debugging info that can be found
cp --parents -rv `find -name \*.debug -o -name debug.a` \
"$out/lib/modules/$version/build"
fi
# weed out unneeded stuff
rm -rf $out/lib/modules/$version/build/Documentation
rm -rf $out/lib/modules/$version/build/scripts
rm -rf $out/lib/modules/$version/build/include
# copy architecture dependent files
cp -a arch/$archDir/scripts $out/lib/modules/$version/build/ || true
cp -a arch/$archDir/*lds $out/lib/modules/$version/build/ || true
cp -a arch/$archDir/Makefile*.cpu $out/lib/modules/$version/build/arch/$archDir/ || true
cp -a --parents arch/$archDir/kernel/asm-offsets.s $out/lib/modules/$version/build/arch/$archDir/kernel/ || true
# copy scripts
rm -f scripts/*.o
rm -f scripts/*/*.o
cp -a scripts $out/lib/modules/$version/build
# copy include files
includeDir=$out/lib/modules/$version/build/include
mkdir -p $includeDir
(cd include && cp -a * $includeDir)
(cd arch/$archDir/include && cp -a * $includeDir || true)
(cd arch/$archDir/include && cp -a asm/* $includeDir/asm/ || true)
(cd arch/$archDir/include/asm/mach-generic && cp -a * $includeDir/ || true)
if test -n "$postInstall"; then
eval "$postInstall";
fi
}

View File

@ -37,6 +37,7 @@
, preConfigure ? ""
, extraMeta ? {}
, ubootChooser ? null
, postInstall ? ""
, ...
}:
@ -70,7 +71,7 @@ stdenv.mkDerivation {
generateConfig = ./generate-config.pl;
inherit preConfigure src module_init_tools localVersion;
inherit preConfigure src module_init_tools localVersion postInstall;
patches = map (p: p.patch) kernelPatches;

View File

@ -1,4 +1,4 @@
args @ { stdenv, fetchgit, userModeLinux ? false, extraConfig ? ""
args @ { stdenv, fetchurl, fetchsvn, userModeLinux ? false, extraConfig ? ""
, ... }:
let
@ -194,14 +194,43 @@ in
import ./generic.nix (
rec {
version = "jz-2.6.34";
version = "qi_lb60-2.6.34.1-openwrt-22513";
src = fetchgit {
url = "git://projects.qi-hardware.com/qi-kernel.git";
rev = "f42d987a04d6f9366c47edf794f66796151867b9";
sha256 = "bc9da0af30d5bf4c7be7495e052b328e72ab6a7f8a57e201720e3198cd6afb22";
src = fetchurl {
url = "mirror://kernel/linux/kernel/v2.6/linux-2.6.34.1.tar.bz2";
sha256 = "0v78yvkwr100v7bnrkkabxmpv5hjg1ngrjbr5d0kkzsw4d7bmm5x";
};
srcPatch = fetchsvn {
url = "svn://svn.openwrt.org/openwrt/trunk/target/linux";
rev = 22513;
sha256 = "0b7wzgqnbq8sq32z9ik08n1b7fnc9v9d91zwvb6qz7vj3dlrxw3g";
};
preConfigure = ''
cp -R ${srcPatch}/generic/files/* .
chmod +w -R *
GLOBIGNORE='.:..:*preinit_as_init*'
for a in ${srcPatch}/generic/patches-2.6.34/* ${srcPatch}/xburst/patches-2.6.34/* ; do
echo applying patch $a
patch -p1 < $a
done
unset GLOBIGNORE
cat ${srcPatch}/generic/config-2.6.34 ${srcPatch}/xburst/config-2.6.34 \
${srcPatch}/xburst/qi_lb60/config-2.6.34 > arch/mips/configs/qi_lb60_defconfig
'';
postInstall = ''
set -x
gzip -9 -c $out/vmlinux.bin > $out/vmlinux.bin.gz
KERNEL_ENTRY="0x`$crossConfig-nm $out/vmlinux 2>/dev/null |
grep " kernel_entry" | cut -f1 -d ' '`"
mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \
-e $KERNEL_ENTRY -n "MIPS Nix Linux-2.6.34" \
-d $out/vmlinux.bin.gz $out/uImage
set +x
'';
config = configWithPlatform stdenv.platform;
configCross = configWithPlatform stdenv.cross.platform;

View File

@ -1,4 +1,4 @@
args @ { stdenv, fetchgit, userModeLinux ? false, extraConfig ? ""
args @ { stdenv, fetchurl, fetchsvn, userModeLinux ? false, extraConfig ? ""
, ... }:
let
@ -194,14 +194,43 @@ in
import ./generic.nix (
rec {
version = "jz-2.6.35";
version = "qi_lb60-2.6.35-openwrt-22513";
src = fetchgit {
url = "git://projects.qi-hardware.com/qi-kernel.git";
rev = "4a5edaeef89037e288d8ae6c81eca1c6bda753da";
sha256 = "42778cf871473bebc609eb26441591318b8396b03671360193bbe0e50cc29082";
src = fetchurl {
url = "mirror://kernel/linux/kernel/v2.6/linux-2.6.35.tar.bz2";
sha256 = "1kxz87nwksx4hvq1i45i9w1zq1fb09rvf8i6jin3cbh36v1y5chq";
};
srcPatch = fetchsvn {
url = "svn://svn.openwrt.org/openwrt/trunk/target/linux";
rev = 22513;
sha256 = "0b7wzgqnbq8sq32z9ik08n1b7fnc9v9d91zwvb6qz7vj3dlrxw3g";
};
preConfigure = ''
cp -R ${srcPatch}/generic/files/* .
chmod +w -R *
GLOBIGNORE='.:..:*preinit_as_init*'
for a in ${srcPatch}/generic/patches-2.6.35/* ${srcPatch}/xburst/patches-2.6.35/* ; do
echo applying patch $a
patch -p1 < $a
done
unset GLOBIGNORE
cat ${srcPatch}/generic/config-2.6.35 ${srcPatch}/xburst/config-2.6.35 \
${srcPatch}/xburst/qi_lb60/config-2.6.35 > arch/mips/configs/qi_lb60_defconfig
'';
postInstall = ''
set -x
gzip -9 -c $out/vmlinux.bin > $out/vmlinux.bin.gz
KERNEL_ENTRY="0x`$crossConfig-nm $out/vmlinux 2>/dev/null |
grep " kernel_entry" | cut -f1 -d ' '`"
mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \
-e $KERNEL_ENTRY -n "MIPS Nix Linux-2.6.35" \
-d $out/vmlinux.bin.gz $out/uImage
set +x
'';
config = configWithPlatform stdenv.platform;
configCross = configWithPlatform stdenv.cross.platform;

View File

@ -4497,12 +4497,12 @@ let
linux_nanonote_jz_2_6_34 = makeOverridable
(import ../os-specific/linux/kernel/linux-nanonote-jz-2.6.34.nix) {
inherit fetchurl fetchgit stdenv perl mktemp module_init_tools ubootChooser;
inherit fetchurl fetchsvn stdenv perl mktemp module_init_tools ubootChooser;
};
linux_nanonote_jz_2_6_35 = makeOverridable
(import ../os-specific/linux/kernel/linux-nanonote-jz-2.6.35.nix) {
inherit fetchurl fetchgit stdenv perl mktemp module_init_tools ubootChooser;
inherit fetchurl fetchsvn stdenv perl mktemp module_init_tools ubootChooser;
};
/* Linux kernel modules are inherently tied to a specific kernel. So