support for initrd. Right now the image is *WAY* too big, so it boots with
a kernel panic. initrd should be brought back to a few megabytes instead so it can be safely unzipped in memory. Ideas: - klibc instead of glibc - leave out a lot of packages in the initrd: - gcc - linux-headers - ... - have a minimal "stage 1", which mounts the CD (figure out how) and remounts part of the CD on /nix and /nixpkgs svn path=/nixu/trunk/; revision=3502
This commit is contained in:
parent
b9617c9541
commit
9c56696e75
3 changed files with 38 additions and 8 deletions
11
fill-disk.sh
11
fill-disk.sh
|
@ -1,4 +1,5 @@
|
|||
#! /bin/sh -e
|
||||
#! @bash@ -e
|
||||
## #! /bin/sh -e
|
||||
|
||||
sysvinitPath=@sysvinitPath@
|
||||
bootPath=@bootPath@
|
||||
|
@ -31,12 +32,12 @@ mkdir -p /tmp/mnt
|
|||
|
||||
mount $device /tmp/mnt
|
||||
|
||||
mkdir -p /nix
|
||||
mkdir -p /nixpkgs/trunk/pkgs
|
||||
# mkdir -p /nix
|
||||
# mkdir -p /nixpkgs/trunk/pkgs
|
||||
|
||||
# temporary hack
|
||||
mount --bind /mnt/cdrom1/nix /nix
|
||||
mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs
|
||||
# mount --bind /mnt/cdrom1/nix /nix
|
||||
# mount --bind /mnt/cdrom1/pkgs /nixpkgs/trunk/pkgs
|
||||
|
||||
make_dir 00755 /bin
|
||||
make_dir 00755 /dev
|
||||
|
|
|
@ -3,4 +3,4 @@ prompt 1
|
|||
timeout 600
|
||||
label linux
|
||||
kernel vmlinuz
|
||||
append root=/dev/hdc
|
||||
append initrd=initram.img ramdisk_size=1000000
|
||||
|
|
33
make-disk.sh
33
make-disk.sh
|
@ -10,6 +10,8 @@ fill_disk=$archivesDir/scripts/fill-disk.sh
|
|||
storePaths=$archivesDir/mystorepaths
|
||||
validatePaths=$archivesDir/validatepaths
|
||||
bootiso=/tmp/nixos.iso
|
||||
#initrd=/tmp/initrd.img
|
||||
initrd=/tmp/initram.img
|
||||
|
||||
# keep chmod happy
|
||||
touch ${archivesDir}/blah
|
||||
|
@ -42,6 +44,8 @@ echo $($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).ni
|
|||
|
||||
utilLinux=$($NIX_CMD_PATH/nix-store -qR $(nix-store -r $(echo '(import ./pkgs.nix).utillinux' | $NIX_CMD_PATH/nix-instantiate -)))
|
||||
|
||||
bash=$($NIX_CMD_PATH/nix-store -q $(echo '(import ./pkgs.nix).bash' | $NIX_CMD_PATH/nix-instantiate -))
|
||||
|
||||
(while read storepath; do
|
||||
cp -fa --parents ${storepath} ${archivesDir}
|
||||
done) < $storePaths
|
||||
|
@ -58,6 +62,18 @@ for i in $utilLinux; do
|
|||
fi
|
||||
done
|
||||
|
||||
echo creating directories for bootimage
|
||||
|
||||
mkdir ${archivesDir}/bin
|
||||
mkdir ${archivesDir}/sbin
|
||||
mkdir -p ${archivesDir}/usr/bin
|
||||
mkdir -p ${archivesDir}/usr/sbin
|
||||
mkdir ${archivesDir}/tmp
|
||||
mkdir ${archivesDir}/proc
|
||||
mkdir ${archivesDir}/var
|
||||
mkdir ${archivesDir}/etc
|
||||
mkdir ${archivesDir}/dev
|
||||
|
||||
echo copying nixpkgs
|
||||
|
||||
cp -fa ${nixpkgs} ${archivesDir}
|
||||
|
@ -67,6 +83,8 @@ echo copying packges from store
|
|||
#cp -fa --parents ${nixDeps} ${archivesDir}
|
||||
cp -fau --parents ${utilLinux} ${archivesDir}
|
||||
|
||||
echo bash $bash
|
||||
|
||||
echo copying scripts
|
||||
|
||||
mkdir ${archivesDir}/scripts
|
||||
|
@ -74,6 +92,7 @@ cp -fa * ${archivesDir}/scripts
|
|||
sed -e "s^@sysvinitPath\@^$sysvinitPath^g" \
|
||||
-e "s^@bootPath\@^$bootPath^g" \
|
||||
-e "s^@NIX_CMD_PATH\@^$nix^g" \
|
||||
-e "s^@bash\@^$bash^g" \
|
||||
< $fill_disk > $fill_disk.tmp
|
||||
mv $fill_disk.tmp $fill_disk
|
||||
|
||||
|
@ -92,8 +111,18 @@ cp -L $kernel/vmlinuz ${archivesDir}/isolinux
|
|||
|
||||
# echo making ramdisk
|
||||
# todo!
|
||||
mkdir ${archivesDir}/sbin
|
||||
ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init
|
||||
# mkdir ${archivesDir}/sbin
|
||||
# ln -s /scripts/fill-disk.sh ${archivesDir}/sbin/init
|
||||
ln -s /scripts/fill-disk.sh ${archivesDir}/init
|
||||
|
||||
echo creating ramdisk
|
||||
|
||||
rm -f ${initrd}
|
||||
(cd ${archivesDir}; find . |cpio -c -o) | gzip -9 > ${initrd}
|
||||
|
||||
#mkcramfs ${archivesDir} /tmp/initramdisk.img
|
||||
|
||||
cp ${initrd} ${archivesDir}/isolinux
|
||||
|
||||
echo creating ISO image
|
||||
|
||||
|
|
Loading…
Reference in a new issue