[617118d] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # cross-lfs target sysvinit build
|
---|
| 4 | # -------------------------------
|
---|
| 5 | # $LastChangedBy$
|
---|
| 6 | # $LastChangedDate$
|
---|
| 7 | # $LastChangedRevision$
|
---|
| 8 | # $HeadURL$
|
---|
| 9 | #
|
---|
| 10 |
|
---|
| 11 | # NOTE: This script installs into ${LFS} (ie target root) NOT
|
---|
| 12 | # ${TGT_TOOLS}
|
---|
| 13 |
|
---|
| 14 | cd ${SRC}
|
---|
| 15 | LOG=sysvinit-target.log
|
---|
| 16 |
|
---|
| 17 | set_libdirname
|
---|
| 18 | setup_multiarch
|
---|
| 19 |
|
---|
| 20 | # We will need the ${LFS}/dev directory built for "make install".
|
---|
| 21 | # Create it now if it doesn't exist
|
---|
| 22 | test -d ${LFS}/dev ||
|
---|
| 23 | mkdir -p ${LFS}/dev
|
---|
| 24 |
|
---|
| 25 | unpack_tarball sysvinit-${SYSVINIT_VER} &&
|
---|
| 26 | cd ${PKGDIR}
|
---|
| 27 |
|
---|
| 28 | # TODO: add some logic around this...
|
---|
| 29 | # this needs to be tracked
|
---|
| 30 | case ${SYSVINIT_VER} in
|
---|
| 31 | 2.85 )
|
---|
| 32 | apply_patch sysvinit-2.85-proclen-1
|
---|
| 33 | ;;
|
---|
| 34 | esac
|
---|
| 35 |
|
---|
| 36 | # From LFS CVS
|
---|
| 37 | cp src/init.c src/init.c-ORIG &&
|
---|
| 38 | sed 's/Sending processes/Sending processes started by init/g' \
|
---|
| 39 | src/init.c-ORIG > src/init.c
|
---|
| 40 |
|
---|
| 41 | # Modify Makefile
|
---|
| 42 | test -f src/Makefile-ORIG ||
|
---|
| 43 | cp src/Makefile src/Makefile-ORIG
|
---|
| 44 |
|
---|
| 45 | # 1: Add -pipe to CFLAGS ( default optimization is -O2 )
|
---|
| 46 | # 2: Also change BIN_OWNER and BIN_GROUP from "root" to 0
|
---|
| 47 | # 3: Modify instructions using chown $(BIN_COMBO) to do a
|
---|
| 48 | # chown $(BIN_OWNER) and a chgrp $(BIN_GROUP) instead
|
---|
| 49 | # 4: makefile works with /dev/initctl, NOT $(ROOT)/dev/initctl
|
---|
| 50 | # change this so it operates on our target root, NOT the hosts
|
---|
| 51 | # 5: alter mknod of $(ROOT)/dev/initctl to not set mode while creating the fifo
|
---|
| 52 | # instead set mode with chmod.
|
---|
| 53 |
|
---|
| 54 | sed -e 's@^CFLAGS.*-O2@& -pipe@g' \
|
---|
| 55 | -e 's@root@0@g' \
|
---|
| 56 | -e 's@chown $(BIN_COMBO) \(.*\)@chown $(BIN_OWNER) \1 ;chgrp $(BIN_GROUP) \1@g' \
|
---|
| 57 | -e 's@/dev/initctl@$(ROOT)&@g' \
|
---|
| 58 | -e 's@\(mknod \)-m \([0-9]* \)\(.* \)p@\1\3p; chmod \2\3@g' \
|
---|
| 59 | src/Makefile-ORIG > src/Makefile
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | max_log_init Sysvinit ${SYSVINIT_VER} "Final (shared)" ${BUILDLOGS} ${LOG}
|
---|
| 63 | make -C src CC="${TARGET}-gcc ${ARCH_CFLAGS}" LDFLAGS="-s" ROOT="${LFS}" \
|
---|
| 64 | >> ${LOGFILE} 2>&1 &&
|
---|
| 65 | echo " o Build OK" &&
|
---|
| 66 |
|
---|
| 67 | # Install doesnt create this dir...
|
---|
| 68 | # if ${LFS}/usr/bin does not exist, create it
|
---|
| 69 | if [ ! -d ${LFS}/usr/bin ]; then
|
---|
| 70 | mkdir -p ${LFS}/usr/bin
|
---|
| 71 | fi
|
---|
| 72 |
|
---|
| 73 | mkdir -p ${LFS}/usr/include
|
---|
| 74 | mkdir -p ${LFS}/usr/share/man/man{1,5,8}
|
---|
| 75 |
|
---|
| 76 | min_log_init ${INSTLOGS} &&
|
---|
| 77 | echo Password: &&
|
---|
| 78 | su -c "make -C src install ROOT=${LFS}" \
|
---|
| 79 | >> ${LOGFILE} 2>&1 &&
|
---|
| 80 | echo " o ALL OK" || barf
|
---|
| 81 |
|
---|
| 82 | test -d ${LFS}/etc ||
|
---|
| 83 | mkdir ${LFS}/etc
|
---|
| 84 | # If we already have an /etc/inittab, move it out the way
|
---|
| 85 | test -f ${LFS}/etc/inittab &&
|
---|
| 86 | mv ${LFS}/etc/inittab ${LFS}/etc/inittab-${DATE}
|
---|
| 87 |
|
---|
| 88 | cat > ${LFS}/etc/inittab << "EOF"
|
---|
| 89 | # Begin /etc/inittab
|
---|
| 90 |
|
---|
| 91 | id:3:initdefault:
|
---|
| 92 |
|
---|
| 93 | si::sysinit:/etc/rc.d/init.d/rc sysinit
|
---|
| 94 |
|
---|
| 95 | l0:0:wait:/etc/rc.d/init.d/rc 0
|
---|
| 96 | l1:S1:wait:/etc/rc.d/init.d/rc 1
|
---|
| 97 | l2:2:wait:/etc/rc.d/init.d/rc 2
|
---|
| 98 | l3:3:wait:/etc/rc.d/init.d/rc 3
|
---|
| 99 | l4:4:wait:/etc/rc.d/init.d/rc 4
|
---|
| 100 | l5:5:wait:/etc/rc.d/init.d/rc 5
|
---|
| 101 | l6:6:wait:/etc/rc.d/init.d/rc 6
|
---|
| 102 |
|
---|
| 103 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
|
---|
| 104 |
|
---|
| 105 | su:S016:once:/sbin/sulogin
|
---|
| 106 | EOF
|
---|
| 107 |
|
---|
| 108 | # Check if we are using DEVFS or not before creating getty entries
|
---|
| 109 | # If we are using DEVFS need to specify vc/x NOT ttyx
|
---|
| 110 | tty_string="tty"
|
---|
| 111 | test Y = "${DEVFS}" &&
|
---|
| 112 | tty_string="vc/"
|
---|
| 113 |
|
---|
| 114 | for vc_no in 1 2 3 4 5 6 ; do
|
---|
| 115 | echo "${vc_no}:2345:respawn:/sbin/agetty ${tty_string}${vc_no} 9600" \
|
---|
| 116 | >> ${LFS}/etc/inittab
|
---|
| 117 | done
|
---|
| 118 |
|
---|
| 119 | echo -e "\n# End /etc/inittab" >> ${LFS}/etc/inittab
|
---|
| 120 |
|
---|