mkfile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # /sys/lib/dist/pc/mkfile
  2. <../defs
  3. out=outside # outside web server
  4. s=/sys/lib/dist/pc
  5. x=`{bind -b /sys/lib/dist/bin/$cputype /bin}
  6. default:V: cddisk
  7. SUB=`{ls sub inst}
  8. boot.raw:DQ: proto $SUB
  9. rfork n
  10. rm -rf boot
  11. mkdir boot
  12. bind /dev/null /sys/log/timesync
  13. # make files writable for now.
  14. sed 's!d000!d775!;s!000!664!;s!555!775!;s!444!664!' proto >proto.cp
  15. disk/mkfs -a proto.cp | disk/mkext -d boot
  16. @{
  17. cd boot/386
  18. strip init
  19. cd bin
  20. strip * */* >[2]/dev/null || status=''
  21. }
  22. sed 's!/.*!!' proto >proto.cp
  23. disk/mkfs -a -s boot proto.cp | tee >{wc -c >[1=2]} |
  24. touchfs 1000000000 >$target
  25. boot.bz2:DQ: boot.raw
  26. ls -l boot.raw
  27. bflz -n 32 <boot.raw >boot.bflz
  28. bzip2 -9 <boot.bflz >$target
  29. ls -l boot.bflz $target
  30. root.bz2:DQ: boot.bz2
  31. {
  32. echo bzfilesystem
  33. cat boot.bz2
  34. dd -if /dev/zero -bs 1024 -count 1 >[2]/dev/null
  35. } >$target
  36. ls -l $target
  37. /sys/src/9/pc/9pcflop.gz: root.bz2
  38. @{
  39. rfork n
  40. cd /sys/src/9/pc
  41. mk 'CONF=pcflop' 9pcflop.gz
  42. }
  43. /sys/src/9/pc/9pccd.gz:
  44. @{
  45. cd /sys/src/9/pc
  46. mk 'CONF=pccd' 9pccd.gz
  47. }
  48. # disk/format apparently uses stat to obtain a file's real name, so
  49. # binding 9loadusb onto 9load will store the name 9loadusb in the
  50. # generated fat filesystem. the same is true for plan9.ini.cd and plan9.ini.
  51. 9load: /386/9load
  52. cp $prereq $target
  53. cp /386/9loaddebug 9loaddebug
  54. # 9load no longer loads from floppies, and even if it did, this
  55. # no longer works, since 9load+9pcflop.gz won't fit on a floppy:
  56. # disk/format: data does not fit on disk (2849 2849)
  57. #ndisk: 9load /sys/src/9/pc/9pcflop.gz plan9.ini /lib/vgadb
  58. # dd -if /dev/zero -of ndisk -bs 1024 -count 1440 >[2]/dev/null
  59. # disk/format -f -b /386/pbs -d ndisk \
  60. # 9load /sys/src/9/pc/9pcflop.gz plan9.ini /lib/vgadb
  61. # ls -l ndisk
  62. # cannot list both 9pcflop.gz and 9pccd.gz because they cannot be built
  63. # in parallel. stupid mk
  64. cddisk:D: 9load /sys/src/9/pc/9pcflop.gz plan9.ini.cd /lib/vgadb
  65. mk -a /sys/src/9/pc/9pccd.gz
  66. mk -a /sys/src/9/pc/9pcflop.gz
  67. rfork n
  68. cp -x plan9.ini.cd subst/plan9.ini
  69. dd -if /dev/zero -of $target -bs 1024 -count 2880 >[2]/dev/null
  70. disk/format -t 3½QD -f -b /386/pbs -d $target \
  71. /sys/src/9/pc/^(9pcflop 9pccd)^.gz subst/plan9.ini /lib/vgadb
  72. ls -l $target
  73. $scr/usbdisk:D: $scr/plan9.iso.bz2 /n/sources/plan9
  74. @ {
  75. rfork n
  76. if (~ $#scr 0 || ~ $scr '') {
  77. echo '$scr unset' >[1=2]
  78. exit not-set-up
  79. }
  80. cd $scr
  81. bind /dev/null /dev/cons
  82. bind /dev/null /dev/consctl
  83. { mkusbboot -s 1900 -r /n/sources/plan9; mv image $target } >[2=1] |
  84. grep -v 'mkfs: /sys/lib/sysconfig/proto/.*can''t stat'
  85. exit ''
  86. }
  87. $scr/usbdisk.bz2:D: $scr/usbdisk
  88. @ {
  89. bzip2 <$prereq >$target && rm -f $prereq
  90. ls -l $target
  91. targsz = `{{ls -s $target; echo 0} | awk '{print $1; exit}'}
  92. if (test $targsz -lt 80000) {
  93. echo $target implausibly small: >[1=2]
  94. ls -l $target >[1=2]
  95. rm -f $target
  96. exit $target-too-small
  97. }
  98. exit ''
  99. }
  100. clean:V:
  101. if (! unmount 9load >[2]/dev/null)
  102. ;
  103. rm -rf boot boot.bz2 boot.bflz boot.raw root.bz2 9pcflop ndisk 9load cddisk proto.cp 9loaddebug
  104. install:V: 9loaddebug # ndisk
  105. 9fs $out
  106. dst=/n/$out/sys/lib/dist/web.protect
  107. cp 9loaddebug $dst
  108. # gzip -9 <ndisk > $dst/plan9.flp.gz
  109. # mk clean
  110. test:V: 9loaddebug # ndisk
  111. cp 9loaddebug ../web.protect2/n9loaddebug
  112. # cp ndisk ../web.protect2/ndisk
  113. cd0:D: cddisk
  114. rm -f cd0
  115. disk/mk9660 -9cj -v 'Plan 9 4th Edition' -s . -p cd0.proto -b cddisk cd0