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