Annotation of elwix/build_romfs.sh, revision 1.2.4.3
1.1 misho 1: #!/bin/sh
2: #
3: # ELWIX Build script for ELWIX userland RomFS firmware
4: #
5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
6: # by Michael Pounov <misho@elwix.org>
7: #
1.2.4.3 ! misho 8: # $Id: build_romfs.sh,v 1.2.4.2 2012/02/22 16:25:44 misho Exp $
1.1 misho 9: #
10:
11: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
12: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
13: echo
14: echo "ELWIX project is not configured !?!"
15: echo
16: exit 1
17: fi
18:
19: if [ ! -d ${BSDSRC} ]; then
20: echo
21: echo "ELWIX project is not configured - missing BSD sources !?!"
22: echo
23: exit 1
24: fi
25:
26: if [ "${USER}" != "root" ]; then
27: echo
28: echo "ELWIX project is not configured - RomFS must build under root !?!"
29: echo
30: exit 1
31: fi
32:
33: clean_romfs()
34: {
35: echo "+++ Clean ELWIX RomFS firmware ..."
36: chflags -Rf noschg $ROMFS
37: rm -rf $ROMFS
38:
39: echo "+++ Clean ELWIX RomFS image ..."
40: rm -f $REL/$ROMFS_IMG
41: }
42:
43: build_romfs()
44: {
45: echo "+++ Build ELWIX RomFS directory ..."
46: mkdir -p $ROMFS_USR
47:
48: cd $ROMFS_USR
49:
50: install -d bin;
51: install -d sbin;
52: install -d lib;
53: install -d lib/geom;
54: install -d libdata;
55: install -d libexec;
56: install -d share;
57: install -d share/misc;
58: install -d share/skel;
59: install -d share/zoneinfo;
60:
61: ln -s /elwix/local local;
62:
63: chown -hR root:wheel .
64: cd -
65: }
66:
67: install_romfs()
68: {
69: LIBS="${ROMFS_USR}/lib"
70: LIBEXEC="${ROMFS_USR}/libexec"
1.2 misho 71: LIBDATA="${ROMFS_USR}/libdata"
1.1 misho 72: SKEL="${ROMFS_USR}/share/skel"
73: MISC="${ROMFS_USR}/share/misc"
74: BIN="${ROMFS_USR}/bin"
75: SBIN="${ROMFS_USR}/sbin"
76:
77: echo "+++ Install ELWIX RomFS software ..."
78: if [ -r ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap ]; then
79: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap $MISC;
80: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/services $MISC;
81: else
82: install -v -m 644 ${BSDSRC}/etc/termcap.small $MISC/termcap;
83: install -v -m 644 ${BSDSRC}/etc/services $MISC;
84: fi
85:
86: install -v ${CFGDIR}/root.skel/cshrc $SKEL/dot.cshrc;
87: install -v ${CFGDIR}/root.skel/login $SKEL/dot.login;
88: install -v ${CFGDIR}/root.skel/logout $SKEL/dot.logout;
89: install -v ${CFGDIR}/root.skel/profile $SKEL/dot.profile;
90: install -v ${CFGDIR}/root.skel/vimrc $SKEL/dot.vimrc;
91:
92: find ${WORLD}/lib -type f -name \*.so.\* -exec install {} $LIBS \;
93: find ${WORLD}/lib -type f -name libalias_\*.so -exec install {} $LIBS \;
94: find ${WORLD}/lib/geom -type f -name \*.so -exec install {} $LIBS/geom \;
95: find ${WORLD}/usr/lib -type f -name \*.so.\* -exec install {} $LIBS \;
96:
97: InstallList ${ELWIX_ROMFS} ${WORLD} ${ROMFS}
98:
1.2 misho 99: InstallDir ${WORLD}/usr/local/bin $BIN
100: InstallDir ${WORLD}/usr/local/sbin $SBIN
1.2.4.3 ! misho 101: InstallDir ${WORLD}/usr/local/lib $LIBS
1.2 misho 102: InstallDir ${WORLD}/usr/local/libdata $LIBDATA
103:
104: InstallFiles \*.so\* ${PKG}/lib $LIBS
105: InstallFiles \* ${PKG}/libexec $LIBEXEC
106: InstallFiles \* ${PKG}/libdata $LIBDATA
107: InstallFiles \* ${PKG}/bin $BIN
108: InstallFiles \* ${PKG}/sbin $SBIN
109:
110: chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
1.1 misho 111: }
112:
113: build_image()
114: {
1.2 misho 115: echo "+++ Build ELWIX Firmware image ..."
116: makefs -ominfree=0,bsize=8192,fsize=1024,optimization=space -s${ROMFS_SIZE} \
117: ${REL}/${ROMFS_IMG} ${ROMFS_USR}
1.1 misho 118:
1.2 misho 119: MDDEV=$(mdconfig -a -t vnode -f ${REL}/${ROMFS_IMG});
1.1 misho 120: tunefs -L elwixFirmware /dev/$MDDEV;
121: # mount /dev/$MDDEV /mnt
122: # umount /mnt
123: mdconfig -d -u $MDDEV;
124:
1.2 misho 125: mkuzip -s 8192 -o ${REL}/${ROMFS_IMG}.uzip ${REL}/${ROMFS_IMG};
126: mv ${REL}/${ROMFS_IMG}.uzip ${REL}/${ROMFS_IMG}
1.1 misho 127: }
128:
129: ### main()
130: if SnitVer ${WORLD}/elwix.ver; then
131: clean_romfs
132:
133: build_romfs
134: install_romfs
135:
1.2 misho 136: build_image
1.1 misho 137: else
138: echo "Skipped ELWIX RomFS build ..."
139: fi
140:
141: echo "+++ Complete build ELWIX RomFS"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>