Annotation of elwix/build_romfs.sh, revision 1.3.2.1
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.3.2.1 ! misho 8: # $Id: build_romfs.sh,v 1.3 2012/10/12 08:22:43 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;
1.3 misho 56: install -d local;
57: install -d local/bin;
58: install -d local/lib;
59: install -d local/libexec;
60: install -d local/libdata;
61: install -d local/sbin;
1.1 misho 62: install -d share;
63: install -d share/misc;
64: install -d share/skel;
65: install -d share/zoneinfo;
66:
1.3 misho 67: ln -s /elwix/pkg pkg;
1.1 misho 68:
69: chown -hR root:wheel .
70: cd -
71: }
72:
73: install_romfs()
74: {
75: LIBS="${ROMFS_USR}/lib"
76: LIBEXEC="${ROMFS_USR}/libexec"
1.2 misho 77: LIBDATA="${ROMFS_USR}/libdata"
1.1 misho 78: BIN="${ROMFS_USR}/bin"
79: SBIN="${ROMFS_USR}/sbin"
1.3 misho 80: SHARE="${ROMFS_USR}/share"
81: SKEL="${SHARE}/skel"
82: MISC="${SHARE}/misc"
1.1 misho 83:
84: echo "+++ Install ELWIX RomFS software ..."
85: if [ -r ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap ]; then
86: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap $MISC;
87: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/services $MISC;
88: else
89: install -v -m 644 ${BSDSRC}/etc/termcap.small $MISC/termcap;
90: install -v -m 644 ${BSDSRC}/etc/services $MISC;
91: fi
92:
93: install -v ${CFGDIR}/root.skel/cshrc $SKEL/dot.cshrc;
94: install -v ${CFGDIR}/root.skel/login $SKEL/dot.login;
95: install -v ${CFGDIR}/root.skel/logout $SKEL/dot.logout;
96: install -v ${CFGDIR}/root.skel/profile $SKEL/dot.profile;
97: install -v ${CFGDIR}/root.skel/vimrc $SKEL/dot.vimrc;
98:
99: find ${WORLD}/lib -type f -name \*.so.\* -exec install {} $LIBS \;
100: find ${WORLD}/lib -type f -name libalias_\*.so -exec install {} $LIBS \;
101: find ${WORLD}/lib/geom -type f -name \*.so -exec install {} $LIBS/geom \;
102: find ${WORLD}/usr/lib -type f -name \*.so.\* -exec install {} $LIBS \;
103:
104: InstallList ${ELWIX_ROMFS} ${WORLD} ${ROMFS}
105:
1.2 misho 106: InstallDir ${WORLD}/usr/local/bin $BIN
107: InstallDir ${WORLD}/usr/local/sbin $SBIN
1.3 misho 108: InstallDir ${WORLD}/usr/local/lib $LIBS
1.2 misho 109: InstallDir ${WORLD}/usr/local/libdata $LIBDATA
110:
1.3 misho 111: chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
112: }
113:
114: build_image()
115: {
116: echo "+++ Build ELWIX Firmware system image ..."
117:
118: cd ${ROMFS_USR}
119: pax -w -z -v -f${REL}/${ROMFS_IMG} .
120: cd -
121:
122: # Stop using uzip fs
123: # makefs -ominfree=0,bsize=8192,fsize=1024,optimization=space -s${ROMFS_SIZE} \
124: # ${REL}/${ROMFS_IMG} ${ROMFS_USR}
125:
126: # MDDEV=$(mdconfig -a -t vnode -f ${REL}/${ROMFS_IMG});
127: # tunefs -L elwixFirmware /dev/$MDDEV;
128: # mdconfig -d -u $MDDEV;
129:
130: # mkuzip -s 8192 -o ${REL}/${ROMFS_IMG}.uzip ${REL}/${ROMFS_IMG};
131: # mv ${REL}/${ROMFS_IMG}.uzip ${REL}/${ROMFS_IMG}
132: }
133:
134: build_image2()
135: {
136: echo "+++ Build ELWIX Firmware secondary image ..."
137:
138: cd ${ROMFS_USR2}
139: pax -w -z -v -f${REL}/${ROMFS_IMG2} .
140: cd -
141:
142: # Stop using uzip fs
143: # makefs -ominfree=0,bsize=8192,fsize=1024,optimization=space -s${ROMFS_SIZE2} \
144: # ${REL}/${ROMFS_IMG2} ${ROMFS_USR2}
145:
146: # MDDEV=$(mdconfig -a -t vnode -f ${REL}/${ROMFS_IMG2});
147: # tunefs -L elwixFirmware2 /dev/$MDDEV;
148: # mdconfig -d -u $MDDEV;
149:
150: # mkuzip -s 8192 -o ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2};
151: # mv ${REL}/${ROMFS_IMG2}.uzip ${REL}/${ROMFS_IMG2}
152: }
153:
154: install_romfs2()
155: {
156: LIBS="${ROMFS_USR2}/lib"
157: LIBEXEC="${ROMFS_USR2}/libexec"
158: LIBDATA="${ROMFS_USR2}/libdata"
159: BIN="${ROMFS_USR2}/bin"
160: SBIN="${ROMFS_USR2}/sbin"
161:
162: echo "+++ Install ELWIX RomFS secondary software ..."
163:
164: install -d ${PKGDIR}/bin
165: # InstallDir ${PKGDIR}/bin $BIN
166: install -d ${PKGDIR}/sbin
167: InstallDir ${PKGDIR}/sbin $SBIN
168:
1.3.2.1 ! misho 169: StripFiles \*.so\* ${PKG}/lib
1.2 misho 170: InstallFiles \*.so\* ${PKG}/lib $LIBS
1.3.2.1 ! misho 171: StripFiles \* ${PKG}/libexec
1.2 misho 172: InstallFiles \* ${PKG}/libexec $LIBEXEC
1.3.2.1 ! misho 173: StripFiles \* ${PKG}/libdata
1.2 misho 174: InstallFiles \* ${PKG}/libdata $LIBDATA
1.3.2.1 ! misho 175: StripFiles \* ${PKG}/bin
1.2 misho 176: InstallFiles \* ${PKG}/bin $BIN
1.3.2.1 ! misho 177: StripFiles \* ${PKG}/sbin
1.2 misho 178: InstallFiles \* ${PKG}/sbin $SBIN
179:
180: chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
1.1 misho 181: }
182:
183: ### main()
1.3 misho 184: clean_romfs
185: build_romfs
1.1 misho 186:
1.3 misho 187: install_romfs
188: build_image
1.1 misho 189:
1.3 misho 190: install_romfs2
191: build_image2
1.1 misho 192:
193: echo "+++ Complete build ELWIX RomFS"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>