Annotation of elwix/build_uboot.sh, revision 1.1.2.2
1.1.2.1 misho 1: #!/bin/sh
2: #
3: # ELWIX Build script for ELWIX u-boot base firmware
4: #
5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
6: # by Michael Pounov <misho@elwix.org>
7: #
1.1.2.2 ! misho 8: # $Id: build_uboot.sh,v 1.1.2.1 2014/01/20 13:05:17 misho Exp $
1.1.2.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 - base must build under root !?!"
29: echo
30: exit 1
31: fi
32:
33: clean_ubfs()
34: {
35: echo "+++ Clean ELWIX u-boot firmware ..."
36: chflags -Rf noschg $UBFS $UBOOT_FS
37: rm -rf $UBFS $UBOOT_FS ${REL}/${UBOOT_OS} ${REL}/kernel.lzma
38: }
39:
40: build_ubfs()
41: {
42: echo "+++ Build ELWIX u-boot directory ..."
43: mkdir -p $UBFS
44:
45: cd $UBFS
46:
47: install -d bin;
48: install -d boot;
49: install -d boot/firmware;
50: install -d boot/modules;
51: install -d dev;
52: install -d elwix;
53: install -d elwix/altroot;
54: install -d elwix/altroot/var;
55: install -d elwix/cf;
56: install -d elwix/etc;
57: install -d -o 883 -g 883 elwix/etc/mqtt;
58: install -d elwix/exports;
59: install -d elwix/home;
60: install -d -m 0750 elwix/root;
61: install -d -m 0750 elwix/root/.ssh;
62: install -d elwix/system;
63: install -d elwix/tftpboot;
64: ln -fs /elwix/etc etc;
65: ln -fs /elwix/exports exports;
66: ln -fs /elwix/home home;
67: ln -fs /elwix/root root;
68: ln -fs /elwix/system system;
69: ln -fs /elwix/tftpboot tftpboot;
70: install -d mnt;
71: install -d -m 0555 proc;
72: install -d sbin;
73: install -d tmp;
74: install -d usr;
75: install -d usr/bin;
76: install -d usr/lib;
77: ln -fs /usr/lib lib;
78: install -d usr/lib/engines;
79: install -d usr/lib/geom;
80: install -d usr/lib32;
81: install -d usr/libdata;
82: install -d usr/libexec;
83: ln -fs /usr/libexec libexec;
84: install -d usr/local;
85: install -d usr/local/bin;
86: install -d usr/local/lib;
87: install -d usr/local/libexec;
88: install -d usr/local/libdata;
89: install -d usr/local/sbin;
90: install -d usr/sbin;
91: install -d usr/share;
92: install -d usr/share/misc;
93: install -d usr/share/skel;
94: install -d usr/share/zoneinfo;
95: install -d var;
96:
97: chown -hR root:wheel .
98: cd -
99: }
100:
101: install_ubfs()
102: {
103: LIBS="${BASEFS}/usr/lib"
104: LIBEXEC="${BASEFS}/usr/libexec"
105: LIBDATA="${BASEFS}/usr/libdata"
106: BIN="${BASEFS}/bin"
107: UBIN="${BASEFS}/usr/bin"
108: SBIN="${BASEFS}/sbin"
109: USBIN="${BASEFS}/usr/sbin"
110: SHARE="${BASEFS}/usr/share"
111: SKEL="${SHARE}/skel"
112: MISC="${SHARE}/misc"
113:
114: echo "+++ Install ELWIX u-boot software ..."
115: if [ -r ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap ]; then
116: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap $MISC;
117: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/services $MISC;
118: else
119: install -v -m 644 ${BSDSRC}/etc/termcap.small $MISC/termcap;
120: install -v -m 644 ${BSDSRC}/etc/services $MISC;
121: fi
122:
123: install -v ${CFGDIR}/root.skel/cshrc $SKEL/dot.cshrc;
124: install -v ${CFGDIR}/root.skel/login $SKEL/dot.login;
125: install -v ${CFGDIR}/root.skel/logout $SKEL/dot.logout;
126: install -v ${CFGDIR}/root.skel/profile $SKEL/dot.profile;
127: install -v ${CFGDIR}/root.skel/vimrc $SKEL/dot.vimrc;
128:
129: find ${WORLD}/libexec -type f -name ld-elf.so\* -exec install {} $LIBEXEC \;
130:
131: find ${WORLD}/lib -type f -name \*.so.\* -exec install {} $LIBS \;
132: find ${WORLD}/lib -type f -name libalias_\*.so -exec install {} $LIBS \;
133: find ${WORLD}/lib/geom -type f -name \*.so -exec install {} $LIBS/geom \;
134: find ${WORLD}/usr/lib -type f -name \*.so.\* -exec install {} $LIBS \;
135: find ${WORLD}/usr/lib/engines -type f -name \*.so -exec install {} $LIBS/engines \;
136:
1.1.2.2 ! misho 137: InstallList ${ELWIX_UBOOTFS} ${WORLD} ${UBFS}
1.1.2.1 misho 138:
139: InstallDir ${WORLD}/usr/local/bin $UBIN
140: InstallDir ${WORLD}/usr/local/sbin $USBIN
141: InstallFiles \*.so\* ${WORLD}/usr/local/lib $LIBS
142: InstallDir ${WORLD}/usr/local/libdata $LIBDATA
143:
144: chown -R root:wheel $SBIN $BIN $USBIN $UBIN $LIBDATA $LIBEXEC $LIBS
145: }
146:
147: prepare_fs()
148: {
149: echo "+++ Prepare ELWIX fs ..."
150: mkdir -p $1
151:
1.1.2.2 ! misho 152: if [ -d ${UBFS} ]; then
! 153: cd ${UBFS}
1.1.2.1 misho 154: pax -rw -pe -X . $1
155: cd -
156: fi
157: }
158:
159: create_etc_fstab()
160: {
161: cat >$1/etc/fstab <<_EOF
162: # Automatic generated fstab for ELWIX $2 at ${BUILD_DATE}
163: #
164: /dev/map/rootfs / ufs ro 0 1
165: md0 /tmp mfs rw,-s8m,-oasync,-S 0 0
166: md1 /var mfs rw,-s16m,-S 0 0
167: _EOF
168: }
169:
170: install_fs()
171: {
172: echo "+++ Install ELWIX u-boot $1 in bundle OS install file ..."
173: OSZ=""
174:
175: case "$2" in
176: *)
177: OSZ=${REL}/${UBOOT_OS}
178: ;;
179: esac
180:
181: cd $1
182: tar -czvf $OSZ .
183: }
184:
185: ### main()
186: clean_basefs
187: build_basefs
188:
189: install_basefs
190:
191: # build fs
1.1.2.2 ! misho 192: prepare_fs ${UBOOT_FS}
! 193: MakeFS_home ${UBOOT_FS}/elwix
! 194: MakeFS_var ${UBOOT_FS}/elwix ${UBOOT_ETC}
! 195: MakeFS_etc ${UBOOT_FS}/elwix ${UBOOT_ETC} uboot
! 196: create_etc_fstab ${UBOOT_FS}/elwix uboot
! 197: install_fs ${UBOOT_FS}
1.1.2.1 misho 198:
199: echo "+++ Complete build ELWIX u-boot"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>