Annotation of elwix/build_uboot.sh, revision 1.1.2.3
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.3 ! misho 8: # $Id: build_uboot.sh,v 1.1.2.2 2014/01/20 13:25:07 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;
78: install -d usr/libexec;
79: ln -fs /usr/libexec libexec;
80: install -d usr/local;
81: install -d usr/local/bin;
82: install -d usr/local/lib;
83: install -d usr/local/libdata;
1.1.2.3 ! misho 84: install -d usr/local/libexec;
1.1.2.1 misho 85: install -d usr/local/sbin;
86: install -d usr/sbin;
87: install -d usr/share;
88: install -d usr/share/misc;
89: install -d usr/share/skel;
90: install -d usr/share/zoneinfo;
91: install -d var;
92:
93: chown -hR root:wheel .
94: cd -
95: }
96:
97: install_ubfs()
98: {
1.1.2.3 ! misho 99: LIBS="${UBFS}/usr/lib"
! 100: LIBEXEC="${UBFS}/usr/libexec"
! 101: LIBDATA="${UBFS}/usr/libdata"
! 102: BIN="${UBFS}/bin"
! 103: UBIN="${UBFS}/usr/bin"
! 104: SBIN="${UBFS}/sbin"
! 105: USBIN="${UBFS}/usr/sbin"
! 106: SHARE="${UBFS}/usr/share"
1.1.2.1 misho 107: SKEL="${SHARE}/skel"
108: MISC="${SHARE}/misc"
109:
110: echo "+++ Install ELWIX u-boot software ..."
111: if [ -r ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap ]; then
112: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/termcap $MISC;
113: install -v -m 644 ${BSDSRC}/release/picobsd/mfs_tree/etc/services $MISC;
114: else
115: install -v -m 644 ${BSDSRC}/etc/termcap.small $MISC/termcap;
116: install -v -m 644 ${BSDSRC}/etc/services $MISC;
117: fi
118:
119: install -v ${CFGDIR}/root.skel/cshrc $SKEL/dot.cshrc;
120: install -v ${CFGDIR}/root.skel/login $SKEL/dot.login;
121: install -v ${CFGDIR}/root.skel/logout $SKEL/dot.logout;
122: install -v ${CFGDIR}/root.skel/profile $SKEL/dot.profile;
123: install -v ${CFGDIR}/root.skel/vimrc $SKEL/dot.vimrc;
124:
125: find ${WORLD}/libexec -type f -name ld-elf.so\* -exec install {} $LIBEXEC \;
126:
1.1.2.3 ! misho 127: # find ${WORLD}/lib -type f -name \*.so.\* -exec install {} $LIBS \;
! 128: # find ${WORLD}/lib -type f -name libalias_\*.so -exec install {} $LIBS \;
! 129: # find ${WORLD}/lib/geom -type f -name \*.so -exec install {} $LIBS/geom \;
! 130: # find ${WORLD}/usr/lib -type f -name \*.so.\* -exec install {} $LIBS \;
! 131: # find ${WORLD}/usr/lib/engines -type f -name \*.so -exec install {} $LIBS/engines \;
1.1.2.1 misho 132:
1.1.2.3 ! misho 133: InstallList ${ELWIX_UBFS} ${WORLD} ${UBFS}
1.1.2.1 misho 134:
135: InstallDir ${WORLD}/usr/local/bin $UBIN
136: InstallDir ${WORLD}/usr/local/sbin $USBIN
137: InstallFiles \*.so\* ${WORLD}/usr/local/lib $LIBS
138: InstallDir ${WORLD}/usr/local/libdata $LIBDATA
139:
140: chown -R root:wheel $SBIN $BIN $USBIN $UBIN $LIBDATA $LIBEXEC $LIBS
141: }
142:
143: prepare_fs()
144: {
145: echo "+++ Prepare ELWIX fs ..."
146: mkdir -p $1
147:
1.1.2.2 misho 148: if [ -d ${UBFS} ]; then
149: cd ${UBFS}
1.1.2.1 misho 150: pax -rw -pe -X . $1
151: cd -
152: fi
153: }
154:
155: create_etc_fstab()
156: {
157: cat >$1/etc/fstab <<_EOF
158: # Automatic generated fstab for ELWIX $2 at ${BUILD_DATE}
159: #
1.1.2.3 ! misho 160: /dev/map/rootfs / ufs ro 0 0
1.1.2.1 misho 161: md0 /tmp mfs rw,-s8m,-oasync,-S 0 0
162: md1 /var mfs rw,-s16m,-S 0 0
163: _EOF
164: }
165:
166: install_fs()
167: {
168: echo "+++ Install ELWIX u-boot $1 in bundle OS install file ..."
169: OSZ=""
170:
171: case "$2" in
172: *)
173: OSZ=${REL}/${UBOOT_OS}
174: ;;
175: esac
176:
177: cd $1
178: tar -czvf $OSZ .
179: }
180:
181: ### main()
1.1.2.3 ! misho 182: clean_ubfs
! 183: build_ubfs
1.1.2.1 misho 184:
1.1.2.3 ! misho 185: install_ubfs
1.1.2.1 misho 186:
187: # build fs
1.1.2.2 misho 188: prepare_fs ${UBOOT_FS}
189: MakeFS_home ${UBOOT_FS}/elwix
190: MakeFS_var ${UBOOT_FS}/elwix ${UBOOT_ETC}
191: MakeFS_etc ${UBOOT_FS}/elwix ${UBOOT_ETC} uboot
192: create_etc_fstab ${UBOOT_FS}/elwix uboot
1.1.2.3 ! misho 193: MakeFS_backup ${UBOOT_FS}/elwix
! 194: #install_fs ${UBOOT_FS}
1.1.2.1 misho 195:
196: echo "+++ Complete build ELWIX u-boot"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>