I am curious. How can I check the size of Kernel on any Openwrt device? I connected using SSH but there is no /boot directory to see the size of kernel files.
Appreciate any pointers.
I am curious. How can I check the size of Kernel on any Openwrt device? I connected using SSH but there is no /boot directory to see the size of kernel files.
Appreciate any pointers.
on many platforms:
cat /proc/mtd
shows the MTD partitions, then with
cat /proc/partitions
you can see the size in KB for MDTBLOCKX
EDIT: Fixed embarrassing late-night typo "partions" -> "partitions"
Thanks Stragies. I did exactly when your instructions said but I suspect that I have done something incorrectly. Here is the output I got:
root@R7800:/proc# cat /proc/partions
cat: can't open '/proc/partions': No such file or directory
root@R7800:/proc# ls -all /proc/partions
ls: /proc/partions: No such file or directory
root@R7800:/proc# cd ..
root@R7800:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00c80000 00020000 "qcadata"
mtd1: 00500000 00020000 "APPSBL"
mtd2: 00080000 00020000 "APPSBLENV"
mtd3: 00140000 00020000 "art"
mtd4: 00140000 00020000 "artbak"
mtd5: 00400000 00020000 "kernel"
mtd6: 06080000 00020000 "ubi"
mtd7: 00700000 00020000 "reserve"
root@R7800:/# cat /proc/partions
cat: can't open '/proc/partions': No such file or directory
root@R7800:/# cd /proc
root@R7800:/proc# ls -all | grep partitions
-r--r--r-- 1 root root 0 Feb 23 17:38 partitions
root@R7800:/proc#
That is not the order they gave to use the cat calls.
Also, they did not tell you to change directories.
Go back to the root directory and do the cat calls in order.
Regardless mtd5 is your kernal size.
Aerm, that was a typo on my end ... I meant 'partitions'
Both cat
commands above use non-relative/absolute paths ( so with with leading '/' ), and as such the CurrentWorkingDir (where your prompt is now in the directory tree) for the cat command does not matter.
The problem was that I had mistyped 'partitions' in the commands I suggested to OP.
PART=`grep "kernel" /proc/mtd | awk -F: '{print $1}'`
MAGIC=`dd if="/dev/$PART" bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'`
[ "$MAGIC" = "d00dfeed" ] && SKIP=1
[ "$MAGIC" = "27051956" ] && SKIP=3
KERNEL_SIZE=`dd if=/dev/$PART bs=4 skip=$SKIP count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'`