Determine memory size for RAM-dependent recipe elements more accurately on i386 (LP: #604765).
Colin Watson
12 years ago
|
0 |
partman-auto (100) UNRELEASED; urgency=low
|
|
1 |
|
|
2 |
* Merge from Ubuntu:
|
|
3 |
- Determine memory size for RAM-dependent recipe elements more
|
|
4 |
accurately on i386 (LP: #604765).
|
|
5 |
|
|
6 |
-- Colin Watson <[email protected]> Sun, 24 Jul 2011 15:54:13 +0100
|
|
7 |
|
0 | 8 |
partman-auto (99) unstable; urgency=low
|
1 | 9 |
|
2 | 10 |
* Add mipsel/loongson-2f recipes.
|
26 | 26 |
unnamed=0
|
27 | 27 |
|
28 | 28 |
decode_recipe () {
|
29 | |
local ignore ram line word min factor max fs iflabel label -
|
|
29 |
local ignore ram line word min factor max fs iflabel label map map_end -
|
30 | 30 |
ignore="${2:+${2}ignore}"
|
31 | 31 |
unnamed=$(($unnamed + 1))
|
32 | |
ram=$(grep ^Mem: /proc/meminfo | { read x y z; echo $y; }) # in bytes
|
|
32 |
ram=
|
|
33 |
for map in /sys/firmware/memmap/*; do
|
|
34 |
[ -d "$map" ] || continue
|
|
35 |
if [ "$(cat $map/type)" = "System RAM" ]; then
|
|
36 |
map_start="$(printf %d "$(cat $map/start)")"
|
|
37 |
map_end="$(printf %d "$(cat $map/end)")"
|
|
38 |
ram="$(expr "${ram:-0}" + \
|
|
39 |
"$map_end" - "$map_start" + 1)"
|
|
40 |
fi
|
|
41 |
done
|
|
42 |
if [ -z "$ram" ]; then
|
|
43 |
ram=$(grep ^Mem: /proc/meminfo | { read x y z; echo $y; }) # in bytes
|
|
44 |
fi
|
33 | 45 |
if [ -z "$ram" ]; then
|
34 | 46 |
ram=$(grep ^MemTotal: /proc/meminfo | { read x y z; echo $y; })000
|
35 | 47 |
fi
|