Author: viric
Date: Tue Nov 23 21:34:45 2010
New Revision: 24830
URL: https://svn.nixos.org/websvn/nix/?rev=24830&sc=1
Log:
The little cross-nixos boots both in the nanonote and the qemu malta.
Modified:
configurations/trunk/misc/viric/cross/nixos/sim-packages.nix
configurations/trunk/misc/viric/cross/nixos/sim.nix
configurations/trunk/misc/viric/cross/nixos/ubifs-builder.sh
Modified: configurations/trunk/misc/viric/cross/nixos/sim-packages.nix
==============================================================================
--- configurations/trunk/misc/viric/cross/nixos/sim-packages.nix Tue Nov
23 20:47:23 2010 (r24829)
+++ configurations/trunk/misc/viric/cross/nixos/sim-packages.nix Tue Nov
23 21:34:45 2010 (r24830)
@@ -1,7 +1,14 @@
let
pkgs = import ./sim.nix;
- volSize = "61644800";
+ /*
+ volSize = "200000000";
+ logicalBlock = "516096";
+ subpage = "4096";
+ */
+ volSize = "70000000";
+ logicalBlock = "524160";
+ subpage = "1";
in
with pkgs;
rec {
@@ -13,20 +20,41 @@
paths = [
busybox.hostDrv
dropbear.hostDrv
+ sysvinit.hostDrv
+ bashInteractive.hostDrv
+ mingetty.hostDrv
+/*
+
+ fossil.hostDrv
+ nixUnstable.hostDrv
+ cscope.hostDrv
+ yacas.hostDrv
+ lynx.hostDrv
+ vim.hostDrv
+ # gcc.hostDrv
+ binutils.hostDrv
+ prboom.hostDrv
+ mpg123.hostDrv
+ alsaUtils.hostDrv
+ groff.hostDrv
+ patchelf.hostDrv
+ #elinks.hostDrv
+ strace.hostDrv
+ */
/*(glibcLocales.override {
allLocales = false;
locales = [ "ca_ES.UTF-8/UTF-8" ];
})*/
];
- pathsToLink = [ "/bin" "/sbin" "/lib" ];
+ pathsToLink = [ "/bin" "/usr" "/sbin" "/lib" ];
};
ubifs = let
storeContents = [
{
object = profile;
- symlink = "/var/run/current-system/sw";
+ symlink = "/profile";
}
];
contents = [
@@ -34,11 +62,109 @@
source = writeText "tmpfile" "";
target = "/proc/tmpfile";
}
+ {
+ source = writeText "tmpfile" "";
+ target = "/root/tmpfile";
+ }
+ {
+ source = writeScript "preinit" ''
+ #!/bin/sh
+ exec /profile/sbin/init
+ '';
+ target = "/etc/preinit";
+ }
+ {
+ source = writeText "inittab" ''
+ # Begin /etc/inittab
+
+ id:3:initdefault:
+
+ #su:S016:once:/profile/sbin/sulogin
+ bo::once:/etc/init.d/rc
+
+ vc1:3:respawn:/profile/sbin/mingetty
--loginprog=/profile/bin/login --noclear tty1
+ vc2:3:respawn:/profile/sbin/mingetty
--loginprog=/profile/bin/login --noclear tty2
+ vc3:3:respawn:/profile/sbin/mingetty
--loginprog=/profile/bin/login --noclear tty3
+ ss1:3:respawn:/profile/sbin/mingetty
--loginprog=/profile/bin/login --noclear ttyS0
+ #s1:3:respawn:/bin/sh
+ '';
+ target = "/etc/inittab";
+ }
+ {
+ source = writeText "passwd" ''
+ root::0:0:root:/root:/profile/bin/bash
+ '';
+ target = "/etc/passwd";
+ }
+ {
+ source = writeText "bashrc" ''
+ export
PATH=/bin:/profile/bin:/profile/usr/bin:/profile/sbin:/profile/usr/sbin
+ '';
+ target = "/etc/bashrc";
+ }
+ {
+ source = writeText "profile" ''
+ source /etc/bashrc
+ '';
+ target = "/etc/profile";
+ }
+ {
+ source = writeText "profile" ''
+ ttyS0
+ tty1
+ tty2
+ tty3
+ '';
+ target = "/etc/securetty";
+ }
+ {
+ source = writeText "nsswitch.conf" ''
+ passwd: ldap files
+ group: ldap files
+
+ hosts: files dns
+ networks: files dns
+ services: files
+ protocols: files
+ '';
+ target = "/etc/nsswitch.conf";
+ }
+ {
+ source = writeText "resolv.conf" ''
+ nameserver 192.168.0.1
+ '';
+ target = "/etc/resolv.conf";
+ }
+ {
+ source = writeText "hosts" ''
+ 127.0.0.1 localhost
+ '';
+ target = "/etc/hosts";
+ }
+ {
+ source = writeScript "rc" ''
+ #!/bin/sh
+ export
PATH=/bin:/profile/bin:/profile/usr/bin:/profile/sbin:/profile/usr/sbin
+ mount -t proc proc /proc
+ mount -o rw,remount /
+
+ ifconfig usb0 192.168.0.204 up
+
+ if [ ! -f /etc/dropbear/dropbear_dss_host_key ]; then
+ mkdir -p /etc/dropbear
+ dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
+ fi
+ dropbear
+
+ hostname nano
+ '';
+ target = "/etc/init.d/rc";
+ }
];
symlinks = [
{
name = "/bin/sh";
- target = "/var/run/current-system/sw/bin/sh";
+ target = "/profile/bin/bash";
}
];
in
@@ -46,9 +172,9 @@
name = "nanonote-ubifs";
builder = ./ubifs-builder.sh;
- inherit volSize;
+ inherit volSize subpage logicalBlock;
- deviceTable = "${mtdutils.src}/device_table.txt";
+ deviceTable = device_table;
sources = map (x: x.source) contents;
targets = map (x: x.target) contents;
@@ -70,6 +196,25 @@
buildInputs = [ perl ];
};
+ device_table = writeText "devicetable.txt" ''
+ /dev d 755 0 0 - - - - -
+ /dev/mem c 640 0 0 1 1 0 0 -
+ /dev/kmem c 640 0 0 1 2 0 0 -
+ /dev/null c 640 0 0 1 3 0 0 -
+ /dev/zero c 640 0 0 1 5 0 0 -
+ /dev/random c 640 0 0 1 8 0 0 -
+ /dev/urandom c 640 0 0 1 9 0 0 -
+ /dev/tty c 666 0 0 5 0 0 0 -
+ /dev/tty c 666 0 0 4 0 0 1 6
+ /dev/console c 640 0 0 5 1 0 0 -
+ /dev/ram b 640 0 0 1 1 0 0 -
+ /dev/ram b 640 0 0 1 0 0 1 4
+ /dev/loop b 640 0 0 7 0 0 1 2
+ /dev/ptmx c 666 0 0 5 2 0 0 -
+ /dev/ttyS c 640 0 0 4 64 0 1 4
+ /dev/rtc c 640 0 0 10 135 0 0 -
+ '';
+
ubifs_big = stdenv.mkDerivation {
name = "ubifs-big";
phases = [ "installPhase" ];
@@ -89,7 +234,7 @@
${qemu}/bin/qemu-system-mipsel -snapshot -hda ${ubifs_big}/rootfs.img \
-kernel ${kernel}/vmlinux \
-nographic \
- -append "root=ubi0:rootfs rootfstype=ubifs
block2mtd.block2mtd=/dev/hda,524288 ubi.mtd=0
init=/var/run/current-system/sw/sbin/init"
+ -append "root=ubi0:rootfs rootfstype=ubifs
block2mtd.block2mtd=/dev/hda,524288 ubi.mtd=0 init=/etc/preinit"
'';
}
Modified: configurations/trunk/misc/viric/cross/nixos/sim.nix
==============================================================================
--- configurations/trunk/misc/viric/cross/nixos/sim.nix Tue Nov 23 20:47:23
2010 (r24829)
+++ configurations/trunk/misc/viric/cross/nixos/sim.nix Tue Nov 23 21:34:45
2010 (r24830)
@@ -51,6 +51,8 @@
ARCH_WANTS_BIG_ENDIAN n
ARCH_WANTS_LITTLE_ENDIAN y
LINUXTHREADS_OLD y
+ UCLIBC_SUSV3_LEGACY y
+ UCLIBC_HAS_THREDS y
'';
gcc = {
abi = "32";
@@ -79,6 +81,15 @@
libao = pkgs.libao.override {
usePulseAudio = false;
};
+ busybox = pkgs.busybox.override {
+ extraConfig = ''
+ CONFIG_NSLOOKUP n
+ CONFIG_FEATURE_IPV6 n
+ CONFIG_INIT n
+ CONFIG_HALT n
+ CONFIG_ASH n
+ '';
+ };
};
};
Modified: configurations/trunk/misc/viric/cross/nixos/ubifs-builder.sh
==============================================================================
--- configurations/trunk/misc/viric/cross/nixos/ubifs-builder.sh Tue Nov
23 20:47:23 2010 (r24829)
+++ configurations/trunk/misc/viric/cross/nixos/ubifs-builder.sh Tue Nov
23 21:34:45 2010 (r24830)
@@ -51,8 +51,8 @@
PATH=$mtdutils/sbin:$PATH
-#mkfs.ubifs -r root -m 4096 -e 512KiB -c 4096 -o rootfs.ubifs
-mkfs.ubifs -D $deviceTable -r root -m 1 -e 524160 -c 4096 -o rootfs.ubifs
+mkfs.ubifs -U -D $deviceTable -r root -m $subpage -e $logicalBlock -c 4096 -o
rootfs.ubifs
+#mkfs.ubifs -D $deviceTable -r root -m $subpage -e 512KiB -c 4096 -o
rootfs.ubifs
cat > ubinize.cfg << EOF
[rootfs]
# Volume mode (other option is static)
@@ -64,17 +64,16 @@
# Allow for dynamic resize
vol_type=dynamic
#vol_type=static
-vol_size=$volSize
+#vol_size=$volSize
# Volume name
vol_name=rootfs
# Autoresize volume at first mount
vol_flags=autoresize
-vol_alignment=1
+#vol_alignment=1
EOF
ensureDir $out
-#ubinize -o $out/rootfs.img -m 4096 -p 512KiB ubinize.cfg
-ubinize -v -o $out/rootfs.img -m 1 -p 512KiB ubinize.cfg
+ubinize -v -o $out/rootfs.img -m $subpage -p 512KiB ubinize.cfg
cp rootfs.ubifs $out
ensureDir $out/nix-support
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits