1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs target /dev tree build
|
---|
4 | # --------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | #set -x
|
---|
12 | cd ${SRC}
|
---|
13 | LOG=dev-target.log
|
---|
14 |
|
---|
15 | do_makedev() {
|
---|
16 | ### MAKEDEV ###
|
---|
17 | LOG="MAKEDEV.log"
|
---|
18 | max_log_init MAKEDEV ${MAKEDEV_VER} "" ${INSTLOGS} ${LOG}
|
---|
19 | bzcat <${TARBALLS}/MAKEDEV-${MAKEDEV_VER}.bz2 >${LFS}/dev/MAKEDEV &&
|
---|
20 | echo " o unpacked OK" &&
|
---|
21 | cd ${LFS}/dev &&
|
---|
22 | chmod 754 MAKEDEV &&
|
---|
23 | echo "Password: " &&
|
---|
24 | su -c "./MAKEDEV -v generic-nopty" > ${LOGFILE} 2>&1 &&
|
---|
25 | echo " o Devices created OK" || barf
|
---|
26 | }
|
---|
27 |
|
---|
28 | do_udev() {
|
---|
29 | LOG=udev-target.log
|
---|
30 |
|
---|
31 | set_libdirname
|
---|
32 | setup_multiarch
|
---|
33 |
|
---|
34 | unpack_tarball udev-${UDEV_VER}
|
---|
35 | cd ${PKGDIR}
|
---|
36 |
|
---|
37 | # apply a patch to fix permissions on /dev/null being reset root 600 by
|
---|
38 | # fcron. THis behaviour appeared with udev-027
|
---|
39 | case ${UDEV_VER} in
|
---|
40 | 027 )
|
---|
41 | apply_patch udev-027-permissions-1
|
---|
42 | ;;
|
---|
43 | esac
|
---|
44 |
|
---|
45 | max_log_init udev ${UDEV_VER} "" ${BUILDLOGS} ${LOG}
|
---|
46 | CFLAGS="${TGT_CFLAGS}" \
|
---|
47 | make CROSS="${TARGET}-" \
|
---|
48 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" \
|
---|
49 | LD="${TARGET}-gcc ${ARCH_CFLAGS}" \
|
---|
50 | V="true" \
|
---|
51 | udevdir=/dev \
|
---|
52 | > ${LOGFILE} 2>&1 &&
|
---|
53 | echo " o Build OK" || barf
|
---|
54 |
|
---|
55 | min_log_init ${INSTLOGS} &&
|
---|
56 | su -c "CFLAGS=\"${TGT_CFLAGS}\" \
|
---|
57 | make DESTDIR=${LFS} \
|
---|
58 | CROSS=\"${TARGET}-\" \
|
---|
59 | CC=\"${TARGET}-gcc ${ARCH_CFLAGS}\" \
|
---|
60 | LD=\"${TARGET}-gcc ${ARCH_CFLAGS}\" \
|
---|
61 | V=\"true\" \
|
---|
62 | udevdir=/dev install" \
|
---|
63 | > ${LOGFILE} 2>&1 &&
|
---|
64 | echo " o Install OK" || barf
|
---|
65 |
|
---|
66 | # Create bare minimum devices required
|
---|
67 | echo " - Creating /dev/console and /dev/null"
|
---|
68 | echo "Password: "
|
---|
69 | su -c "mknod -m 600 ${LFS}/dev/console c 5 1 ; \
|
---|
70 | mknod -m 666 ${LFS}/dev/null c 1 3 "
|
---|
71 |
|
---|
72 | # create rules and permissions files
|
---|
73 | echo " - Adding rules/permissions files"
|
---|
74 | echo "Password: "
|
---|
75 | case ${UDEV_VER} in
|
---|
76 | 02[7-9] | 0[3-4]* | 050 )
|
---|
77 | su -c "cp ${CONFIGS}/udev/udev-config-2.permissions ${LFS}/etc/udev/permissions.d/25-lfs.permissions ; \
|
---|
78 | cp ${CONFIGS}/udev/udev-config-1.rules ${LFS}/etc/udev/rules.d/25-lfs.rules"
|
---|
79 | ;;
|
---|
80 | # This was last updated for 056, this will need to be tracked...
|
---|
81 | 05[1-9] | 0[6-9]* )
|
---|
82 | su -c "cp ${CONFIGS}/udev/udev-config-3.rules ${LFS}/etc/udev/rules.d/25-lfs.rules"
|
---|
83 | ;;
|
---|
84 | esac
|
---|
85 |
|
---|
86 | }
|
---|
87 |
|
---|
88 | case "${KERNEL_VER}" in
|
---|
89 | 2.5* | 2.6* )
|
---|
90 | if [ "Y" = "${UDEV}" ]; then
|
---|
91 | do_udev
|
---|
92 | elif [ "Y" = "${DEVFS}" ]; then
|
---|
93 | do_devfsd
|
---|
94 | else
|
---|
95 | do_makedev
|
---|
96 | fi
|
---|
97 | ;;
|
---|
98 | 2.4* )
|
---|
99 | if [ "Y" = "${DEVFS}" ]; then
|
---|
100 | do_devfs
|
---|
101 | else
|
---|
102 | do_makedev
|
---|
103 | fi
|
---|
104 | ;;
|
---|
105 | 2.2* )
|
---|
106 | do_makedev
|
---|
107 | ;;
|
---|
108 | esac
|
---|
109 |
|
---|