blob: 5a9a84f0f7af1c2539d2a6861a1bf2d1895a05ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# Makefile for hurd image frobnication.
export GNUTARGET=elf32-i386
export OBJCOPY=i386-gnu-objcopy
INSTALL=install
IMAGE=image
BF=bfloppy-image
RF=rfloppy-image
bfloppy-files = $(bfloppy-bootfs:%=hurd/%) $(bfloppy-bootprogs:%=boot/%) \
lib/ld.so boot/servers.boot
bfloppy-bootfs = ufs
bfloppy-bootprogs = kernel bootstrap
$(BF)/boot/servers.boot: $(IMAGE)/boot/floppy.boot
-rm -f $@
@test -d $(@D) || mkdir -p $(@D)
cp $< $@
$(BF)/%/: $(IMAGE)/%/
test -d $@ || mkdir -p $@
$(BF)/%: $(IMAGE)/%
-rm -f $@
@test -d $(@D) || mkdir -p $(@D)
ln $< $@ || cp $< $@
$(BF): $(bfloppy-files:%=$(BF)/%)
$(BF).tar: $(bfloppy-files:%=$(BF)/%)
rm -f $@
cd $(BF); tar covf ../$@ $(^:$(BF)/%=%)
rfloppy-files = $(rfloppy-hurd:%=hurd/%) $(rfloppy-progs:%=bin/%) \
$(rfloppy-solib:%=lib/%.so) hurd/exec \
lib/libc.so lib/libhurduser.so lib/libmachuser.so \
servers/exec servers/socket/1 \
README tmp/ dev/MAKEDEV
rfloppy-hurd = auth devio null init proc term
rfloppy-progs = sh ls cat settrans # mkfs
rfloppy-solib = libtrivfs libthreads libshouldbeinlibc libports \
libpager libioserver libihash libfshelp ld
libc-satisfies = $(rfloppy-hurd:%=hurd/%) $(rfloppy-progs:%=bin/%) $(rfloppy-solib:%=lib/%.so)
libc-obj-dir = /gd4/gnu/libc/i386
smallso-LDFLAGS = -Wl,-rpath-link=/lib
libc-USERS =
libc-DEPS =
$(RF)/lib/libc.so: $(IMAGE)/lib/libc.so $(IMAGE)/lib/libhurduser.so $(IMAGE)/lib/libmachuser.so $(libc-satisfies:%=$(IMAGE)/%)
mksmallso $(smallso-LDFLAGS) \
$@ $(libc-obj-dir)/libc_pic.a '-L$(IMAGE)/lib -lhurduser -lmachuser' \
$(filter-out $(firstword $^),$^)
$(RF)/lib/libhurduser.so: $(RF)/lib/libc.so $(libc-satisfies:%=$(IMAGE)/%)
mksmallso $(smallso-LDFLAGS) $@ $(libc-obj-dir)/libhurduser_pic.a -L$(IMAGE)/lib -lmachuser $(filter-out $(firstword $^),$^)
$(RF)/lib/libmachuser.so: $(RF)/lib/libc.so $(RF)/lib/libhurduser.so $(libc-satisfies:%=$(IMAGE)/%)
mksmallso $(smallso-LDFLAGS) $@ $(libc-obj-dir)/libmachuser_pic.a '' $(filter-out $(firstword $^),$^)
$(addprefix $(RF)/,$(rfloppy-hurd:%=hurd/%) $(rfloppy-progs:%=bin/%)): \
$(RF)/%: $(IMAGE)/%
@test -d $(@D) || mkdir -p $(@D)
gzip -9v -c $< > $@.new
chmod 555 $@.new
mv -f $@.new $@
$(RF)/%/: $(IMAGE)/%/
test -d $@ || mkdir -p $@
$(RF)/%: $(IMAGE)/%
-rm -f $@
@test -d $(@D) || mkdir -p $(@D)
ln $< $@ || cp $< $@
$(RF): $(rfloppy-files:%=$(RF)/%)
$(RF).tar: $(rfloppy-files:%=$(RF)/%)
rm -f $@
cd $(RF); tar covf ../$@ $(^:$(RF)/%=%)
MOUNT_POINT = /mnt
VND = vnd0
VND_DEV = /dev/${VND}a
VND_RDEV = /dev/r${VND}a
MDEC = /usr/mdec
floppy%-image.fs: /tmp/floppy%-image.fs; cp -f $< $@
/tmp/floppy%-image.fs: floppy%-image.tar
dd if=/dev/zero of=$@.new bs=10k count=144
vnconfig -v -c ${VND_DEV} $@.new
disklabel -w -B -b ${MDEC}/fdboot -s ${MDEC}/bootfd ${VND} floppy3
newfs -O -m 0 -o space -i 5120 -c 80 ${VND_RDEV} floppy3
mount ${VND_DEV} ${MOUNT_POINT}
tar -f $< -C ${MOUNT_POINT} -xv
df -i ${MOUNT_POINT}
umount ${MOUNT_POINT}
vnconfig -u ${VND_DEV} $@.new
mv -f $@.new $@
$(IMAGE).tar: $(IMAGE) $(IMAGE).stamp
tar cof $@ $<
%.gz: %
gzip -9v -c $< > $@.new
mv -f $@.new $@
%:: %.gz
gunzip -c $< > $@.new
mv -f $@.new $@
instdirs := $(patsubst $(INSTALL)/%,%,\
$(filter-out $(INSTALL),\
$(shell find $(INSTALL) -type d -print \
| sort -r)))
$(IMAGE)/%/.stamp: $(INSTALL)/%
@./install-stripped -N $@ $< $(@D)
@echo $< `date` > $@
@echo updated $(@D)/
$(IMAGE).stamp: $(instdirs:%=$(IMAGE)/%/.stamp); touch $@
$(IMAGE): $(IMAGE).stamp
|