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