-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (72 loc) · 1.82 KB
/
Makefile
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
.PHONY: sync imageg2h
# === ~/.ssh/config: ===
# Host localhost
# Port 5555
# IdentityFile ~/.ssh/hurd.private
MAKE = make
HOST = $(PWD)
GUEST = la@localhost
REMOTE_CMD = ssh -tt $(GUEST) $1
IMG = ext2.img
# compile code
default:
$(MAKE) sync
$(REMOTE_CMD) "cd ~/hurd/ext2fs; rm xattr.o xattr_test.o inode.o; make"
# sync git repo from host -> guest
sync:
rsync -avzP $(HOST)/hurd $(GUEST):
rsync -avzP $(HOST)/glibc $(GUEST):
start:
./run.sh
# sync test image from host -> guest
img2host:
rsync -avzP $(GUEST):$(IMG) $(HOST)
img2guest:
rsync -avzP $(HOST)/$(IMG) $(GUEST):
fsck:
$(MAKE) img2host
LANG= fsck.ext2 -fy $(IMG)
xattr:
$(MAKE) img2host
sudo mount $(IMG) /mnt
getfattr /mnt/test || true
getfattr -n user.key_123 /mnt/test || true
getfattr -n user.key_456 /mnt/test || true
sudo umount /mnt
mkfs:
dd if=/dev/zero of=$(IMG) bs=4M count=10
mkfs.ext2 -b 4096 $(IMG)
EXT2FS_CODE = ~/hurd/ext2fs
TEST_NODE = ~/test
TEST_IMG = ~/ext2.img
settrans:
$(REMOTE_CMD) "cp $(EXT2FS_CODE)/{ext2fs.static,_ext2fs}; \
settrans -a $(TEST_NODE) $(EXT2FS_CODE)/_ext2fs $(TEST_IMG)"
unsettrans:
$(REMOTE_CMD) "settrans -g $(TEST_IMG)"
testimg1:
$(MAKE) mkfs
mkdir -p tmp
sudo mount $(IMG) ./tmp
sudo mkdir ./tmp/tmp || true
sudo chmod 1777 ./tmp/tmp || true
touch ./tmp/tmp/test || true
chmod 777 ./tmp/tmp/test || true
chown la:users ./tmp/tmp/test || true
sudo setfattr -n user.key_123 -v val_123 ./tmp/tmp/test || true
sudo setfattr -n user.key_456 -v val_456 ./tmp/tmp/test || true
sudo umount ./tmp
rm -rf ./tmp
$(MAKE) img2guest
testimg2:
$(MAKE) mkfs
mkdir -p tmp
sudo mount $(IMG) ./tmp
sudo mkdir ./tmp/tmp || true
sudo chmod 1777 ./tmp/tmp || true
touch ./tmp/tmp/test || true
chmod 777 ./tmp/tmp/test || true
chown la:users ./tmp/tmp/test || true
sudo umount ./tmp
rm -rf ./tmp
$(MAKE) img2guest