projects
/
openwrt
/
openwrt.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
ramips: increase SPI frequency for ASUS RT-AC51U/RT-AC54U
[openwrt/openwrt.git]
/
scripts
/
functions.sh
1
#!/bin/sh
2
3
4
get_magic_word
() {
5
dd
if
=
$1
bs
=
4
count
=
1 2
>/
dev
/
null |
od
-A
n
-N
4
-t
x1 |
tr
-d
' '
6
}
7
8
get_fs_type
() {
9
local
magic_word
=
"$(get_magic_word "
$1
")"
10
11
case
"
$magic_word
"
in
12
"3118"
*)
13
echo
"ubifs"
14
;;
15
"68737173"
)
16
echo
"squashfs"
17
;;
18
*)
19
echo
"unknown"
20
;;
21
esac
22
}
23
24
round_up
() {
25
echo
"$((((
$1
+ (
$2
- 1))/
$2
) *
$2
))"
26
}