From 9c56696e75fec0130f03c39fdef7a3869e29bbdb Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Mon, 1 Aug 2005 17:30:45 +0000 Subject: [PATCH] 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 --- fill-disk.sh | 11 ++++++----- isolinux.cfg | 2 +- make-disk.sh | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/fill-disk.sh b/fill-disk.sh index 5dfb264884ce..2f5ac0e117d8 100755 --- a/fill-disk.sh +++ b/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 diff --git a/isolinux.cfg b/isolinux.cfg index 1b69bafd4a9c..40bd01868804 100755 --- a/isolinux.cfg +++ b/isolinux.cfg @@ -3,4 +3,4 @@ prompt 1 timeout 600 label linux kernel vmlinuz - append root=/dev/hdc + append initrd=initram.img ramdisk_size=1000000 diff --git a/make-disk.sh b/make-disk.sh index 4e76b5aac69a..b44861a27a69 100755 --- a/make-disk.sh +++ b/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