diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-27 15:14:24 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-27 15:29:45 +0100 |
commit | 29d6678fd546377459ef75cf54abeef5b969b5cf (patch) | |
tree | 8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-kernel/update-modules | |
parent | da49de6885ee1bc424e70bc02f21f6ab920efb55 (diff) | |
download | poky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz |
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things
and is generally overwhelming. This commit splits it into several
logical sections roughly based on function, recipes.txt gives more
information about the classifications used.
The opportunity is also used to switch from "packages" to "recipes"
as used in OpenEmbedded as the term "packages" can be confusing to
people and has many different meanings.
Not all recipes have been classified yet, this is just a first pass
at separating things out. Some packages are moved to meta-extras as
they're no longer actively used or maintained.
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-kernel/update-modules')
3 files changed, 230 insertions, 0 deletions
diff --git a/meta/recipes-kernel/update-modules/update-modules-1.0/openmn/update-modules b/meta/recipes-kernel/update-modules/update-modules-1.0/openmn/update-modules new file mode 100755 index 0000000000..976161f141 --- /dev/null +++ b/meta/recipes-kernel/update-modules/update-modules-1.0/openmn/update-modules | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | depmod -ae | ||
3 | exit 0 | ||
diff --git a/meta/recipes-kernel/update-modules/update-modules-1.0/update-modules b/meta/recipes-kernel/update-modules/update-modules-1.0/update-modules new file mode 100755 index 0000000000..636fe1c0d4 --- /dev/null +++ b/meta/recipes-kernel/update-modules/update-modules-1.0/update-modules | |||
@@ -0,0 +1,197 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # This is the update-modules script for Debian GNU/Linux. | ||
4 | # Copyright 1998-2001 Wichert Akkerman <wakkerma@debian.org> | ||
5 | # Licensed under the GNU GPL, version 2 | ||
6 | # | ||
7 | |||
8 | MODCONFFILE=/etc/modules.conf | ||
9 | MODCONFTMPFILE="${MODCONFFILE}.$$" | ||
10 | MODULESFILE=/etc/modules | ||
11 | MODULESTMPFILE="${MODULESFILE}.$$" | ||
12 | |||
13 | ARCHDIR=/etc/modutils/arch | ||
14 | CPUDIR=/etc/modutils/cpu | ||
15 | HEADER="### This file is automatically generated by update-modules" | ||
16 | |||
17 | set -e | ||
18 | |||
19 | if [ "$1" = "force" ] ; then | ||
20 | force=1 | ||
21 | else | ||
22 | force= | ||
23 | fi | ||
24 | |||
25 | # Reset the sorting order since we depend on it | ||
26 | LC_COLLATE=C | ||
27 | export LC_COLLATE | ||
28 | |||
29 | depdir() | ||
30 | { | ||
31 | dep=`grep '[[:space:]]*depfile' "${MODCONFFILE}" | tail -n 1 | sed -e 's/depfile=//' -e 's,/[^/]*$,,'` | ||
32 | if [ -z "$dep" ] ; then | ||
33 | dep="/lib/modules/`uname -r`" | ||
34 | fi | ||
35 | |||
36 | echo $dep | ||
37 | } | ||
38 | |||
39 | arch() { | ||
40 | local model=`uname -m` | ||
41 | case $model in | ||
42 | i[0-9]86) model=i386; ;; | ||
43 | sun4u) model=sparc64; ;; | ||
44 | arm*) model=arm; ;; | ||
45 | ppc) model=powerpc; ;; | ||
46 | esac | ||
47 | echo $model | ||
48 | } | ||
49 | |||
50 | archmodel() { | ||
51 | local arch=`arch` | ||
52 | local model="" | ||
53 | if [ $arch = "m68k" ]; then | ||
54 | if [ -f /proc/hardware ]; then | ||
55 | model=`sed -ne 's/^Model:[[:space:]]*//p' /proc/hardware` | ||
56 | case $model in | ||
57 | Atari*) model="atari"; ;; | ||
58 | Amiga*) model="amiga"; ;; | ||
59 | Macintosh*) model="mac"; ;; | ||
60 | Motorola*) model="MVME"; ;; | ||
61 | *) model="generic"; ;; | ||
62 | esac | ||
63 | model=".${model}" | ||
64 | else | ||
65 | echo "/proc/hardware does not exist, assuming general m68k system" | ||
66 | model=".generic" | ||
67 | fi | ||
68 | elif [ $arch = "powerpc" ]; then | ||
69 | if [ -f /proc/cpuinfo ]; then | ||
70 | model=`sed -ne 's/^machine[[:space:]]*:[[:space:]]*//p' /proc/cpuinfo` | ||
71 | case $model in | ||
72 | Amiga*) model="apus"; ;; | ||
73 | Power*) model="pmac"; ;; | ||
74 | *) model="generic"; ;; | ||
75 | esac | ||
76 | model=".${model}" | ||
77 | else | ||
78 | echo "/proc/cpuinfo does not exist, assuming general powerpc system" | ||
79 | model=".generic" | ||
80 | fi | ||
81 | fi | ||
82 | echo "${arch}${model}" | ||
83 | } | ||
84 | |||
85 | checkoverwrite() { | ||
86 | local cfgfile="$1" | ||
87 | |||
88 | if [ -f "$cfgfile" ]; then | ||
89 | if ! sed -ne 1p "$cfgfile" | grep -q "^$HEADER" ; then | ||
90 | echo "Error: the current $cfgfile is not automatically generated." >&2 | ||
91 | if [ -z "$force" ]; then | ||
92 | echo "Use \"update-modules force\" to force (re)generation." | ||
93 | exit 1 | ||
94 | else | ||
95 | echo "force specified, (re)generating file anyway." | ||
96 | fi | ||
97 | fi | ||
98 | fi | ||
99 | } | ||
100 | |||
101 | createfile() { | ||
102 | cat <<EOF > "$1" | ||
103 | $HEADER" | ||
104 | # | ||
105 | # Please do not edit this file directly. If you want to change or add | ||
106 | # anything please take a look at the files in /etc/modutils and read | ||
107 | # the manpage for update-modules. | ||
108 | # | ||
109 | EOF | ||
110 | } | ||
111 | |||
112 | addfile() { | ||
113 | local src="$1" | ||
114 | local tgt="$2" | ||
115 | |||
116 | echo "### update-modules: start processing $src" >> "$tgt" | ||
117 | if [ -x "$src" ]; then | ||
118 | if ! "$src" >> "$tgt" ; then | ||
119 | echo "Error while executing $src, aborting" >&2 | ||
120 | exit 1 | ||
121 | fi | ||
122 | else | ||
123 | cat "$src" >> "$tgt" | ||
124 | fi | ||
125 | cat <<EOF >> "$tgt" | ||
126 | |||
127 | ### update-modules: end processing $cfg | ||
128 | |||
129 | EOF | ||
130 | } | ||
131 | |||
132 | |||
133 | checkoverwrite "$MODCONFFILE" | ||
134 | |||
135 | if [ 0 -ne "`id -u`" ]; then | ||
136 | echo "You have to be root to do this." >&2 | ||
137 | exit 2 | ||
138 | fi | ||
139 | |||
140 | model=`archmodel` | ||
141 | oldmodel=$model | ||
142 | |||
143 | while [ ! -f "${ARCHDIR}/${model}" ]; do | ||
144 | oldmodel=$model | ||
145 | model=`echo $oldmodel | sed -e 's/\.[^.]\+//'` | ||
146 | if [ "$model" = "$oldmodel" ]; then | ||
147 | break | ||
148 | fi | ||
149 | echo "Configuration for $oldmodel not found, trying $model" | ||
150 | done | ||
151 | |||
152 | CONF="${ARCHDIR}/${model}" | ||
153 | |||
154 | if [ ! -f "$CONF" ]; then | ||
155 | ## echo "Architecture-specific modutils configuration not found, using defaults" | ||
156 | CONF="${ARCHDIR}/generic" | ||
157 | fi | ||
158 | |||
159 | [ -e "$MODCONFFILE" ] && cp -f "$MODCONFFILE" "${MODCONFFILE}.old" | ||
160 | |||
161 | createfile "$MODCONFTMPFILE" | ||
162 | createfile "$MODULESTMPFILE" | ||
163 | |||
164 | for cfg in /etc/modutils/* $CONF ; do | ||
165 | if [ -f "$cfg" ]; then # this check is necesarry to skip /etc/modutils/archs | ||
166 | if echo $cfg | grep -q '\.dpkg-[a-z]*\|~$' ; then | ||
167 | true | ||
168 | elif echo $cfg | grep -q '\.conf$' ; then | ||
169 | addfile "$cfg" "$MODCONFTMPFILE" | ||
170 | else | ||
171 | addfile "$cfg" "$MODULESTMPFILE" | ||
172 | fi | ||
173 | fi | ||
174 | done | ||
175 | |||
176 | first_time=0 | ||
177 | if [ ! -f $MODULESFILE ]; then | ||
178 | first_time=1 | ||
179 | fi | ||
180 | |||
181 | mv "$MODCONFTMPFILE" "$MODCONFFILE" | ||
182 | mv "$MODULESTMPFILE" "$MODULESFILE" | ||
183 | |||
184 | if [ $first_time -eq 1 ]; then | ||
185 | /etc/init.d/modutils.sh || true | ||
186 | fi | ||
187 | |||
188 | # We also call depmod here to stop insmod from complaining that modules.conf | ||
189 | # is more recent then modules.dep | ||
190 | # | ||
191 | if [ -d "`depdir`" -a -f /proc/modules ] | ||
192 | then | ||
193 | depmod -A || true | ||
194 | fi | ||
195 | |||
196 | exit 0 | ||
197 | |||
diff --git a/meta/recipes-kernel/update-modules/update-modules_1.0.bb b/meta/recipes-kernel/update-modules/update-modules_1.0.bb new file mode 100644 index 0000000000..73ee558a08 --- /dev/null +++ b/meta/recipes-kernel/update-modules/update-modules_1.0.bb | |||
@@ -0,0 +1,30 @@ | |||
1 | DESCRIPTION = "script to manage module configuration files." | ||
2 | SECTION = "base" | ||
3 | LICENSE = "GPLv2" | ||
4 | PACKAGE_ARCH = "all" | ||
5 | RDEPENDS = "${@base_contains("MACHINE_FEATURES", "kernel26", "module-init-tools-depmod","modutils-depmod",d)} " | ||
6 | PR = "r6" | ||
7 | |||
8 | SRC_URI = "file://update-modules" | ||
9 | |||
10 | pkg_postinst() { | ||
11 | if [ "x$D" != "x" ]; then | ||
12 | exit 1 | ||
13 | fi | ||
14 | update-modules | ||
15 | } | ||
16 | |||
17 | do_install() { | ||
18 | install -d ${D}${sbindir} | ||
19 | install ${WORKDIR}/update-modules ${D}${sbindir} | ||
20 | } | ||
21 | |||
22 | # The Unslung distro uses a 2.4 kernel for a machine (the NSLU2) which | ||
23 | # supports both 2.4 and 2.6 kernels. Rather than forcing OE to have | ||
24 | # to deal with that unique legacy corner case, we just nullify the | ||
25 | # RDEPENDS here and handle it in the Unslung image recipe. I know this | ||
26 | # is ugly. Please don't remove it unless you first make the RDEPENDS | ||
27 | # line at the top of this file understand that a machine can be used | ||
28 | # in both a 2.4 kernel distro and a 2.6 kernel distro. Really, it's | ||
29 | # not worth the effort to do that, so just overlook the next line. | ||
30 | RDEPENDS_unslung = "" | ||