get grub right, also copy all the packages needed for a nice booting system
svn path=/nixu/trunk/; revision=3575
This commit is contained in:
parent
fdab68ff43
commit
c7bd0ec473
@ -1,7 +1,7 @@
|
||||
{ stdenv, kernel, bash, coreutils, findutils, utillinux, sysvinit, e2fsprogs
|
||||
, nettools, nix, subversion, gcc, wget, which, vim, less, screen, openssh
|
||||
, binutils, strace, shadowutils, iputils, gnumake, curl, gnused, gnugrep
|
||||
, gnutar, gzip, mingetty, grub, parted, modutils}:
|
||||
, gnutar, gzip, mingetty, grubWrapper, parted, modutils}:
|
||||
|
||||
derivation {
|
||||
name = "boot";
|
||||
@ -14,5 +14,5 @@ derivation {
|
||||
inherit stdenv kernel bash coreutils findutils utillinux sysvinit
|
||||
e2fsprogs nettools nix subversion gcc wget which vim less screen
|
||||
openssh binutils strace shadowutils iputils gnumake curl gnused
|
||||
gnutar gnugrep gzip mingetty grub parted modutils;
|
||||
gnutar gnugrep gzip mingetty grubWrapper parted modutils;
|
||||
}
|
||||
|
51
fill-disk.sh
51
fill-disk.sh
@ -1,6 +1,8 @@
|
||||
#! @bash@/bin/sh -e
|
||||
|
||||
export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin
|
||||
export PATH=@bash@/bin:@coreutils@/bin:@findutils@/bin:@utillinux@/bin:@utillinux@/sbin:@e2fsprogs@/sbin:@grub@/sbin:@sysvinitPath@/sbin
|
||||
|
||||
kernel=@kernel@
|
||||
|
||||
sysvinitPath=@sysvinitPath@
|
||||
bootPath=@bootPath@
|
||||
@ -9,8 +11,6 @@ modutils=@modutils@
|
||||
mount -t proc proc /proc
|
||||
mount -t sysfs sys /sys
|
||||
|
||||
#mount -t /dev/hdc /installimage
|
||||
|
||||
# make a complete /dev filesystem
|
||||
# ripped permissions and everything from anaconda (loader2/devices.h)
|
||||
|
||||
@ -73,11 +73,15 @@ mknod -m 0660 /dev/hdd3 b 22 67
|
||||
#mknod -m 0660 /dev/sda2 b 8 2
|
||||
#mknod -m 0660 /dev/sda3 b 8 3
|
||||
|
||||
mknod -m 0600 /dev/initctl p
|
||||
|
||||
echo "dev"
|
||||
cd /dev; echo *
|
||||
|
||||
mkfs.ext2 /dev/hda1
|
||||
mkswap /dev/hda2
|
||||
targetdrive=/dev/hda
|
||||
device=${targetdrive}1
|
||||
mkfs.ext2 ${device}
|
||||
mkswap ${targetdrive}2
|
||||
|
||||
|
||||
#if ! test -n "$1"
|
||||
@ -88,9 +92,6 @@ mkswap /dev/hda2
|
||||
# device=$1
|
||||
#fi
|
||||
|
||||
device=/dev/hda1
|
||||
#device=/dev/sda1
|
||||
|
||||
|
||||
make_dir() {
|
||||
mode=$1
|
||||
@ -121,11 +122,12 @@ cd /sys; echo *
|
||||
make_dir 00755 /bin
|
||||
make_dir 00755 /boot
|
||||
make_dir 00755 /dev
|
||||
make_dir 00755 /proc
|
||||
make_dir 01777 /tmp
|
||||
make_dir 00755 /etc # global non-constant configuration
|
||||
make_dir 00755 /etc-secret
|
||||
make_dir 00755 /var
|
||||
make_dir 00755 /home
|
||||
make_dir 00755 /home/root
|
||||
make_dir 00755 /mnt
|
||||
make_dir 00755 /mnt/host
|
||||
make_dir 00755 /nix
|
||||
make_dir 00755 /nix/store
|
||||
make_dir 00755 /nix/var
|
||||
@ -136,16 +138,18 @@ make_dir 00755 /nix/var/log
|
||||
make_dir 00755 /nix/var/log/nix
|
||||
make_dir 00755 /nixpkgs
|
||||
make_dir 00755 /nixpkgs/trunk
|
||||
make_dir 00755 /mnt
|
||||
make_dir 00755 /mnt/host
|
||||
make_dir 00755 /home
|
||||
make_dir 00755 /home/root
|
||||
make_dir 00755 /proc
|
||||
make_dir 00755 /sbin
|
||||
make_dir 01777 /tmp
|
||||
make_dir 00755 /usr
|
||||
make_dir 00755 /var
|
||||
|
||||
##
|
||||
## Add a few devices to /dev on the install disk. This is by far complete.
|
||||
##
|
||||
|
||||
mknod $root/dev/null c 1 3
|
||||
mknod -m 0600 $root/dev/console c 5 1
|
||||
|
||||
touch_file /etc/passwd
|
||||
touch_file /etc/shadow
|
||||
@ -232,11 +236,11 @@ unset NIX_CONF_DIR
|
||||
|
||||
echo copying store
|
||||
|
||||
(while read storepaths; do
|
||||
cp -fa $storepaths $root/nix/store
|
||||
done) < /cdrom/mystorepaths
|
||||
#(while read storepaths; do
|
||||
#cp -fa $storepaths $root/nix/store
|
||||
#done) < /cdrom/mystorepaths
|
||||
|
||||
#cp -fa ../nix/store/* $root/nix/store
|
||||
cp -fa /nix/store/* $root/nix/store
|
||||
|
||||
#echo registering valid paths...
|
||||
#(while read storepath; do
|
||||
@ -274,7 +278,16 @@ rm -f $root/etc/hosts
|
||||
echo "127.0.0.1 localhost" >> $root/etc/hosts
|
||||
echo "192.168.150.1 uml" >> $root/etc/hosts
|
||||
|
||||
|
||||
###
|
||||
### Do funky stuff with grub here.
|
||||
###
|
||||
|
||||
ln -s @kernel@/vmlinuz /tmp/mnt/boot/vmlinuz
|
||||
ln -s @sysvinitPath@/sbin/init /tmp/mnt/sbin/init
|
||||
|
||||
grub-install --root-directory=/tmp/mnt --no-floppy ${targetdrive}
|
||||
|
||||
echo install done
|
||||
telinit 0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grub, parted, modutils}:
|
||||
{ stdenv, bash, coreutils, utillinux, e2fsprogs, nix, shadowutils, mingetty, grubWrapper, parted, modutils}:
|
||||
|
||||
derivation {
|
||||
name = "init";
|
||||
@ -7,5 +7,5 @@ derivation {
|
||||
stage1 = ./prepare-disk.sh;
|
||||
stage2 = ./install-disk.sh;
|
||||
inherit stdenv bash coreutils utillinux e2fsprogs nix shadowutils
|
||||
mingetty grub parted modutils;
|
||||
mingetty grubWrapper parted modutils;
|
||||
}
|
||||
|
32
make-disk.sh
32
make-disk.sh
@ -25,10 +25,10 @@ storeExpr=$(echo '(import ./pkgs.nix).everything' | $NIX_CMD_PATH/nix-instantiat
|
||||
#$NIX_CMD_PATH/nix-push --copy $archivesDir $manifest $(nix-store -r $storeExpr) $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
|
||||
# Location of sysvinit?
|
||||
sysvinitPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
sysvinitPath=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
|
||||
# Location of Nix boot scripts?
|
||||
bootPath=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
bootPath=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
|
||||
nix=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).nix' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
|
||||
@ -47,6 +47,12 @@ utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.ni
|
||||
coreUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
e2fsProgs=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
modUtils=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
Grub=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
#gnuSed=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
#gnuGrep=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
Kernel=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).kernel' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
SysVinit=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).sysvinit' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
BootPath=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).boot' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
|
||||
bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
coreutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).coreutils' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
@ -54,7 +60,9 @@ findutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).findutils' |
|
||||
utillinux=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
e2fsprogs=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).e2fsprogs' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
modutils=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).modutils' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grub' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
grub=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).grubWrapper' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
#gnused=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnused' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
#gnugrep=$($NIX_CMD_PATH/nix-store -r $(echo '(import ./pkgs.nix).gnugrep' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
|
||||
(while read storepath; do
|
||||
cp -fa --parents ${storepath} ${archivesDir}
|
||||
@ -95,9 +103,16 @@ cp -fa ${nixpkgs} ${archivesDir}
|
||||
|
||||
echo copying packges from store
|
||||
|
||||
echo GRUB ${Grub}
|
||||
|
||||
#cp -fa --parents ${nixDeps} ${archivesDir}
|
||||
cp -fau --parents ${utilLinux} ${archivesDir}
|
||||
#cp -fau --parents ${kernel} ${archivesDir}
|
||||
cp -fau --parents ${Grub} ${archivesDir}
|
||||
#cp -fau --parents ${gnuSed} ${archivesDir}
|
||||
#cp -fau --parents ${gnuGrep} ${archivesDir}
|
||||
cp -fau --parents ${Kernel} ${archivesDir}
|
||||
cp -fau --parents ${SysVinit} ${archivesDir}
|
||||
cp -fau --parents ${BootPath} ${archivesDir}
|
||||
|
||||
bashdeps=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
|
||||
@ -115,6 +130,7 @@ sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \
|
||||
-e "s^@e2fsprogs\@^$e2fsprogs^g" \
|
||||
-e "s^@modutils\@^$modutils^g" \
|
||||
-e "s^@grub\@^$grub^g" \
|
||||
-e "s^@kernel\@^$kernel^g" \
|
||||
< $fill_disk > $fill_disk.tmp
|
||||
mv $fill_disk.tmp $fill_disk
|
||||
|
||||
@ -141,7 +157,7 @@ echo creating ramdisk
|
||||
|
||||
rm -f ${initrd}
|
||||
cp ${archivesDir}/scripts/fill-disk.sh ${initdir}/init
|
||||
cp ${bash}/bin/* ${initdir}/bin
|
||||
ln -s ${bash}/bin/bash ${initdir}/bin/sh
|
||||
chmod u+x ${initdir}/init
|
||||
cp -fau --parents ${bashdeps} ${initdir}
|
||||
cp -fau --parents ${utilLinux} ${initdir}
|
||||
@ -152,7 +168,6 @@ cp -fau --parents ${modUtils} ${initdir}
|
||||
touch ${initdir}/NIXOS
|
||||
|
||||
(cd ${initdir}; find . |cpio -c -o) | gzip -9 > ${initrd}
|
||||
#(cd ${archivesDir}/initdir; find . |cpio -c -o) | gzip -9 > ${initrd}
|
||||
|
||||
cp ${initrd} ${archivesDir}/isolinux
|
||||
|
||||
@ -162,4 +177,7 @@ mkisofs -rJ -o ${bootiso} -b isolinux/isolinux.bin -c isolinux/boot.cat \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
${archivesDir}
|
||||
|
||||
echo ${kernel}
|
||||
# cleanup, be diskspace friendly
|
||||
rm -f ${initrd}
|
||||
chmod -f -R +w ${archivesDir}/*
|
||||
rm -rf ${archivesDir}/*
|
||||
|
6
pkgs.nix
6
pkgs.nix
@ -3,15 +3,15 @@ rec {
|
||||
stdenv kernel bash coreutils findutils utillinux sysvinit e2fsprogs
|
||||
nettools nix subversion gcc wget which vim less screen openssh binutils
|
||||
strace shadowutils iputils gnumake curl gnused gnutar gnugrep gzip
|
||||
mingetty grub syslinux parted modutils;
|
||||
mingetty grubWrapper syslinux parted modutils;
|
||||
|
||||
boot = (import ./boot) {inherit stdenv kernel bash coreutils findutils
|
||||
utillinux sysvinit e2fsprogs nettools nix subversion gcc wget which vim
|
||||
less screen openssh binutils strace shadowutils iputils gnumake curl
|
||||
gnused gnutar gnugrep gzip mingetty grub parted modutils;};
|
||||
gnused gnutar gnugrep gzip mingetty grubWrapper parted modutils;};
|
||||
|
||||
init = (import ./init) {inherit stdenv bash coreutils
|
||||
utillinux e2fsprogs nix shadowutils mingetty grub parted modutils;};
|
||||
utillinux e2fsprogs nix shadowutils mingetty grubWrapper parted modutils;};
|
||||
|
||||
everything = [boot init sysvinit kernel];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user