Annotation of elwix/build_romfs.sh, revision 1.9.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.9.2.1 ! misho 8: # $Id: build_romfs.sh,v 1.9 2017/02/13 16:52:46 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: {
1.9 misho 35: echo "+++ Clean ELWIX RomFS firmware ... $ROMFS"
1.1 misho 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: {
1.9 misho 45: echo "+++ Build ELWIX RomFS directory ... $ROMFS_USR"
1.1 misho 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;
1.9.2.1 ! misho 63: install -d share/keys;
1.1 misho 64: install -d share/misc;
65: install -d share/skel;
66: install -d share/zoneinfo;
67:
1.3 misho 68: ln -s /elwix/pkg pkg;
1.1 misho 69:
70: chown -hR root:wheel .
71: cd -
72: }
73:
74: install_romfs()
75: {
76: LIBS="${ROMFS_USR}/lib"
77: LIBEXEC="${ROMFS_USR}/libexec"
1.2 misho 78: LIBDATA="${ROMFS_USR}/libdata"
1.1 misho 79: BIN="${ROMFS_USR}/bin"
80: SBIN="${ROMFS_USR}/sbin"
1.3 misho 81: SHARE="${ROMFS_USR}/share"
82: SKEL="${SHARE}/skel"
83: MISC="${SHARE}/misc"
1.9.2.1 ! misho 84: KEYS="${SHARE}/keys"
1.1 misho 85:
1.9 misho 86: echo "+++ Install ELWIX RomFS software ... $ROMFS_USR"
1.1 misho 87: if [ -r ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap ]; then
88: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap $MISC;
89: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/services $MISC;
90: else
91: install -v -m 644 ${BSDSRC}/etc/termcap.small $MISC/termcap;
92: install -v -m 644 ${BSDSRC}/etc/services $MISC;
93: fi
94:
95: install -v ${CFGDIR}/root.skel/cshrc $SKEL/dot.cshrc;
96: install -v ${CFGDIR}/root.skel/login $SKEL/dot.login;
97: install -v ${CFGDIR}/root.skel/logout $SKEL/dot.logout;
98: install -v ${CFGDIR}/root.skel/profile $SKEL/dot.profile;
99: install -v ${CFGDIR}/root.skel/vimrc $SKEL/dot.vimrc;
1.9.2.1 ! misho 100:
! 101: ln -sf /var/pkg/keys ${KEYS}/pkg
1.1 misho 102:
1.9 misho 103: find ${WORLD}/lib -type f -name \*.so.\* ! -name \*.debug -exec install {} $LIBS \;
1.1 misho 104: find ${WORLD}/lib -type f -name libalias_\*.so -exec install {} $LIBS \;
105: find ${WORLD}/lib/geom -type f -name \*.so -exec install {} $LIBS/geom \;
1.9 misho 106: find ${WORLD}/usr/lib -type f -name \*.so.\* ! -name \*.debug -exec install {} $LIBS \;
107: find ${WORLD}/usr/lib/engines -type f -name \*.so -exec install {} $LIBS/engines \;
1.1 misho 108:
109: InstallList ${ELWIX_ROMFS} ${WORLD} ${ROMFS}
110:
1.2 misho 111: InstallDir ${WORLD}/usr/local/bin $BIN
112: InstallDir ${WORLD}/usr/local/sbin $SBIN
1.3 misho 113: InstallDir ${WORLD}/usr/local/lib $LIBS
1.2 misho 114: InstallDir ${WORLD}/usr/local/libdata $LIBDATA
115:
1.3 misho 116: chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
1.9 misho 117: echo "+++ Completed ELWIX RomFS software ... $ROMFS_USR"
1.3 misho 118: }
119:
120: build_image()
121: {
1.9 misho 122: echo "+++ Build ELWIX Firmware system image ... $ROMFS_USR --> ${REL}/${ROMFS_IMG}"
1.3 misho 123:
124: cd ${ROMFS_USR}
125: pax -w -z -v -f${REL}/${ROMFS_IMG} .
126: cd -
127:
128: # Stop using uzip fs
129: # makefs -ominfree=0,bsize=8192,fsize=1024,optimization=space -s${ROMFS_SIZE} \
130: # ${REL}/${ROMFS_IMG} ${ROMFS_USR}
131:
132: # MDDEV=$(mdconfig -a -t vnode -f ${REL}/${ROMFS_IMG});
133: # tunefs -L elwixFirmware /dev/$MDDEV;
134: # mdconfig -d -u $MDDEV;
135:
136: # mkuzip -s 8192 -o ${REL}/${ROMFS_IMG}.uzip ${REL}/${ROMFS_IMG};
137: # mv ${REL}/${ROMFS_IMG}.uzip ${REL}/${ROMFS_IMG}
1.9 misho 138:
139: echo "+++ Completed ELWIX Firmware system image ... $ROMFS_USR --> ${REL}/${ROMFS_IMG}"
1.3 misho 140: }
141:
1.1 misho 142: ### main()
1.8 misho 143: clean_romfs || exit 1
144: build_romfs || exit 1
1.1 misho 145:
1.8 misho 146: install_romfs || exit 1
147: build_image || exit 1
1.1 misho 148:
149: echo "+++ Complete build ELWIX RomFS"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>