summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2015-12-08 21:26:00 +0000
committerBen Hutchings <ben@decadent.org.uk>2015-12-08 22:06:07 +0000
commit8062189e927a2eb416606659cf00590a325cb738 (patch)
tree450e7281f6bf80210576869cd3c9a9afed66fa81 /scripts/functions
parentc69313d01450748dea5966f101db4c9826820b16 (diff)
parse_numeric: Add support for 20-bit minor numbers in 'root' parameter
Linux supports 32-bit device numbers in the format 0xmmmMMMmm, where each m is a hex digit of the minor number and each M is a hex digit of the major number. Currently parse_lilo only works if the top 3 digits are 0 (or absent). Shift and mask the upper bits correctly. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/functions b/scripts/functions
index 2da6173..adcfefa 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -121,8 +121,8 @@ parse_numeric() {
*)
# [A-Fa-f0-9]*
value=$(( 0x${1} ))
- minor=$(( ${value} % 256 ))
- major=$(( ${value} / 256 ))
+ minor=$(( (${value} & 0xff) | (${value} >> 12) & 0xfff00 ))
+ major=$(( (${value} >> 8) & 0xfff ))
;;
esac