Annotation of elwix/build_uboot.sh, revision 1.1.2.17
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.17! misho 8: # $Id: build_uboot.sh,v 1.1.2.16 2014/02/25 22:23:16 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/tftpboot;
63: ln -fs /elwix/etc etc;
64: ln -fs /elwix/exports exports;
65: ln -fs /elwix/home home;
66: ln -fs /elwix/root root;
67: ln -fs /elwix/tftpboot tftpboot;
68: install -d mnt;
69: install -d -m 0555 proc;
70: install -d sbin;
71: install -d tmp;
72: install -d usr;
73: install -d usr/bin;
74: install -d usr/lib;
75: ln -fs /usr/lib lib;
76: install -d usr/lib/engines;
77: install -d usr/lib/geom;
1.1.2.4 misho 78: install -d usr/libdata;
1.1.2.1 misho 79: install -d usr/libexec;
80: ln -fs /usr/libexec libexec;
81: install -d usr/local;
82: install -d usr/local/bin;
83: install -d usr/local/lib;
84: install -d usr/local/libdata;
1.1.2.3 misho 85: install -d usr/local/libexec;
1.1.2.1 misho 86: install -d usr/local/sbin;
87: install -d usr/sbin;
88: install -d usr/share;
89: install -d usr/share/misc;
90: install -d usr/share/skel;
91: install -d usr/share/zoneinfo;
92: install -d var;
93:
94: chown -hR root:wheel .
95: cd -
96: }
97:
98: install_ubfs()
99: {
1.1.2.3 misho 100: LIBS="${UBFS}/usr/lib"
101: LIBEXEC="${UBFS}/usr/libexec"
102: LIBDATA="${UBFS}/usr/libdata"
103: BIN="${UBFS}/bin"
104: UBIN="${UBFS}/usr/bin"
105: SBIN="${UBFS}/sbin"
106: USBIN="${UBFS}/usr/sbin"
107: SHARE="${UBFS}/usr/share"
1.1.2.1 misho 108: SKEL="${SHARE}/skel"
109: MISC="${SHARE}/misc"
110:
111: echo "+++ Install ELWIX u-boot software ..."
112: if [ -r ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap ]; then
113: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap $MISC;
114: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/services $MISC;
115: else
116: install -v -m 644 ${BSDSRC}/etc/termcap.small $MISC/termcap;
117: install -v -m 644 ${BSDSRC}/etc/services $MISC;
118: fi
119:
120: install -v ${CFGDIR}/root.skel/cshrc $SKEL/dot.cshrc;
121: install -v ${CFGDIR}/root.skel/login $SKEL/dot.login;
122: install -v ${CFGDIR}/root.skel/logout $SKEL/dot.logout;
123: install -v ${CFGDIR}/root.skel/profile $SKEL/dot.profile;
124: install -v ${CFGDIR}/root.skel/vimrc $SKEL/dot.vimrc;
125:
126: find ${WORLD}/libexec -type f -name ld-elf.so\* -exec install {} $LIBEXEC \;
127:
1.1.2.3 misho 128: InstallList ${ELWIX_UBFS} ${WORLD} ${UBFS}
1.1.2.4 misho 129: InstallLibs ${WORLD} ${UBFS}
130:
1.1.2.1 misho 131: chown -R root:wheel $SBIN $BIN $USBIN $UBIN $LIBDATA $LIBEXEC $LIBS
132: }
133:
134: prepare_fs()
135: {
136: echo "+++ Prepare ELWIX fs ..."
137: mkdir -p $1
138:
1.1.2.2 misho 139: if [ -d ${UBFS} ]; then
140: cd ${UBFS}
1.1.2.1 misho 141: pax -rw -pe -X . $1
142: cd -
143: fi
144: }
145:
146: create_etc_fstab()
147: {
148: cat >$1/etc/fstab <<_EOF
149: # Automatic generated fstab for ELWIX $2 at ${BUILD_DATE}
150: #
1.1.2.11 misho 151: /dev/map/rootfs.uncompress / ufs ro 0 0
1.1.2.13 misho 152: md0 /tmp mfs rw,-s1m,-oasync,-S 0 0
153: md1 /var mfs rw,-s2m,-S 0 0
1.1.2.15 misho 154: /var/db /elwix/etc unionfs rw,noauto,-onoatime 0 0
1.1.2.1 misho 155: _EOF
156: }
157:
158: install_fs()
159: {
1.1.2.11 misho 160: cd $1
1.1.2.1 misho 161: echo "+++ Install ELWIX u-boot $1 in bundle OS install file ..."
1.1.2.9 misho 162: tar -czvf ${REL}/${UBOOT_OS} .
1.1.2.11 misho 163: cd -
1.1.2.1 misho 164: }
165:
166: ### main()
1.1.2.3 misho 167: clean_ubfs
168: build_ubfs
1.1.2.1 misho 169:
1.1.2.3 misho 170: install_ubfs
1.1.2.1 misho 171:
172: # build fs
1.1.2.2 misho 173: prepare_fs ${UBOOT_FS}
174: MakeFS_home ${UBOOT_FS}/elwix
175: MakeFS_var ${UBOOT_FS}/elwix ${UBOOT_ETC}
1.1.2.8 misho 176: MakeFS_etc ${UBOOT_FS}/elwix ${UBOOT_ETC} uboot
177: create_etc_fstab ${UBOOT_FS}/elwix uboot
1.1.2.9 misho 178: install_fs ${UBOOT_FS}
1.1.2.1 misho 179:
180: echo "+++ Complete build ELWIX u-boot"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>