-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkfile-host-Linux
55 lines (51 loc) · 1.64 KB
/
mkfile-host-Linux
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
MNT=MISC/MNT
UID=`id -u`
GID=`id -g`
# the offset is to skip the sector containing the partition table
OPTIONS='offset=512,uid='$UID',gid='$GID
IMG=dosdisk.img
#coupling: if you change the size of the image, you need
# to adjust kernel/init/user/boot/xxx/boot.rc line about
# 'part dos 1 204801' where the last number must match the
# number of sectors in dosdisk.img (see the output of
# 'dd if=dosdisk.img of=/tmp/xxx' to see the number of sectors)
# and remake the kernel file (because boot.rc changed)
# In theory you should also update MISC/pc/bootsector but this may
# not be necessary in practice.
IMGSIZE=512 #in MB
#pad: I need the quote arount the 'xx=yy' below because of rc
# otherwise you will get a syntax error
disk-pc:V:
rm -f $IMG
dd 'if=/dev/zero' 'of='x$IMG 'bs=1M' 'count='$IMGSIZE
mkfs.vfat x$IMG
cat MISC/pc/bootsector x$IMG > $IMG
rm -f x$IMG
sudo mount dosdisk.img -t vfat $MNT -o $OPTIONS
cp -a ROOT/* $MNT/
sudo umount $MNT
disk-pi:V:
rm -f $IMG
dd 'if=/dev/zero' 'of='x$IMG 'bs=1M' 'count='$IMGSIZE
mkfs.vfat x$IMG
cat MISC/pc/bootsector x$IMG > $IMG
rm -f x$IMG
sudo mount dosdisk.img -t vfat $MNT -o $OPTIONS
cp -a ROOT/* $MNT/
cp -a MISC/pi/* $MNT/
cp -a $KERNEL $MNT/
sudo umount $MNT
disksrc:V:
sudo mount dosdisk.img -t vfat $MNT -o $OPTIONS
rm -rf $MNT/*
cp -a ROOT/* $MNT/
# not dosdisk.img!
cp -a [a-ce-z]* database debuggers $MNT/src || echo some errors are ok
# symlinks not supported on vfat
cp include/ALL/* $MNT/src/include/ALL/ || echo some errors are ok
cp -a ROOT $MNT/src/
sudo umount $MNT
mount:V:
sudo mount dosdisk.img -t vfat $MNT -o $OPTIONS
umount:V:
sudo umount $MNT