mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.8 KiB

  1. pkgloop
  2. echo_header "Creating the router ramdisk..."
  3. echo_status "Creating the directory structure."
  4. outdir="$build_dir/router"
  5. rm -rf $outdir
  6. mkdir -p $outdir/initrd/bin
  7. mkdir -p $outdir/initrd/lib
  8. mkdir -p $outdir/initrd/etc
  9. mkdir -p $outdir/initrd/tmp
  10. mkdir -p $outdir/initrd/dev
  11. mkdir -p $outdir/initrd/proc
  12. mkdir -p $outdir/initrd/share
  13. mkdir -p $outdir/initrd.mnt
  14. ln -s . $outdir/initrd/usr
  15. ln -s bin $outdir/initrd/sbin
  16. chmod 700 $outdir
  17. cd $outdir
  18. echo_status "Copying program binaries."
  19. for x in bash modprobe modprobe.old lsmod lsmod.old uname awk lspci find \
  20. sysctl mount umount sshd ssh-keygen agetty sleep cat ls ps ln strace
  21. do
  22. for y in bin sbin usr/bin usr/sbin; do
  23. [ -f $build_root/$y/$x ] && cp $build_root/$y/$x initrd/bin/
  24. done
  25. [ ! -f initrd/bin/$x ] &&
  26. echo_error "Did not find program binary for '$x'."
  27. done
  28. for x in iproute2 iptables
  29. do
  30. echo_status "Copy entire $x package."
  31. while read dummy fn
  32. do
  33. mkdir -p $( dirname initrd/$fn )
  34. cp $build_root/$fn initrd/$fn
  35. done < $build_root/var/adm/flists/$x
  36. done
  37. echo_status "Copying library files."
  38. for x in $( ls initrd/bin/ )
  39. do
  40. while read a b c d
  41. do
  42. [ "$b" = "=>" ] && \
  43. cp $build_root/${c#/} initrd/lib/
  44. done < <( chroot $build_root /bin/bash -c \
  45. "cd /; ldd \`type -p $x\`"; )
  46. done
  47. echo_status "Copying kernel modules."
  48. cp -a $build_root/lib/modules initrd/lib/
  49. cd initrd/lib/modules/*/
  50. rm -rf pcmcia kernel/fs kernel/drivers/{bluetooth,cdrom,pcmcia,scsi,sound,usb}
  51. rm -rf kernel/net/{8021q,appletalk,bluetooth,irda,khttpd,decnet,econet,ipx}
  52. rm -rf kernel/drivers/{video,telephony,mtd,message,media,md,input,ide,i2c}
  53. rm -rf kernel/drivers/{hotplug,char,block}
  54. cd $outdir
  55. echo_status "Create init script."
  56. echo -e '#!/bin/bash\ncd; exec /bin/bash --login' > initrd/bin/login-shell
  57. cp $base/target/$target/init.sh initrd/bin/init
  58. chmod +x initrd/bin/login-shell initrd/bin/init
  59. cp $build_root/sbin/{hwscan,dumpnetcfg} initrd/bin/
  60. cp $build_root/usr/share/pci.ids initrd/share/
  61. ln -s bash initrd/bin/sh
  62. echo_status "Creating initrd image."
  63. dd if=/dev/zero of=initrd.img count=16384 bs=1024 2>/dev/null
  64. mke2fs -qF initrd.img 2>/dev/null
  65. mount -o loop initrd.img initrd.mnt
  66. cp -a initrd/* initrd.mnt/
  67. umount initrd.mnt/
  68. gzip -9 initrd.img
  69. mv initrd.img.gz initrd.img
  70. echo_status "Copy kernel image."
  71. cp $build_root/boot/vmlinuz .
  72. echo_status "Create isolinux setup."
  73. tar --use-compress-program=bzip2 \
  74. -xf $base/download/router/syslinux-2.02.tar.bz2 \
  75. syslinux-2.02/isolinux.bin -O > isolinux.bin
  76. cp $base/target/$target/isolinux.cfg .
  77. echo_status "Create iso description."
  78. cat > ../isofs.txt <<- EOT
  79. BOOT -b isolinux.bin -c boot.catalog
  80. BOOTx -no-emul-boot -boot-load-size 4 -boot-info-table
  81. DISK1 build/${ROCKCFG_ID}/router /
  82. EOT
  83. if [ "$ROCK_DEBUG_ROUTER_NOCLEANUP" != 1 ]; then
  84. echo_status "Cleaning up."
  85. rm -rf initrd.mnt/ initrd
  86. fi