blob: d2b67e15b2f6f7b888df9a2ae3e68965f4f9f2d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# Procedure for flashing MTRV1-0.4
cd /var/volatile
find . -type f | xargs rm
# Now copy the upgrade image to /var/volatile
mlinux-firmware-upgrade -f upgrade-image.bin
#
# Requirements for upgrade-image.bin
# All partition images (at91bootstrap, u-boot,
# uImage, and rootfs.jffs2) must have md5sums.
# rootfs.jffs2 should be padded with 1's to
# the next even multiple of dd blocks.
# In this example the dd "blocksz" is set to
# 131072 (128*1024).
#
# Find the size of the jffs2:
# ls -l
# total 50040
# -rw-r--r-- 1 jklug jklug 51232792 Nov 1 11:30 rootfs.jffs2
# In this case it is 51232792. This is then divided by
# 131072. This is 390.87 ... so we round up to 391.
#
# This means we must pad the file to 391*131072 or
# 51249152.
#
# We can use objcopy to enlarge the file:
#
# mkdir padded
# objcopy -I binary -O binary --pad-to 51249152 --gap-fill 0xff rootfs.jffs2 padded/rootfs.jffs2
#
# This puts the padded version of the jffs2 file in the padded directory.
# Now we must calculate the md5sum of the new padded file:
# cd padded
# cat rootfs.jffs2 | md5sum >rootfs.jffs2.md5
#
# Now we must replace the files in the archive with the
# padded file and its md5sum.
#
# We must also add a new file. do_flash_upgrade. It must
# be created like this:
#
# echo 131072 391 >do_flash_upgrade
#
# These two parameters are used by dd to read the correct
# size of the flash. The first parameter is the block size,
# and the second parameter is the number of blocks of the
# padded file.
#
# The result tar file is not compressed:
#
# tar -cf ~/rcell-padded-5.3.6.bin bstrap* do* model mpo* root* ub* uI*
#
# and the contents of the tar file are these:
#
# tar -tvf rcell-padded-5.3.6.bin
# -rw-rw-r-- jklug/jklug 10360 2021-11-01 11:30 bstrap.bin
# -rw-rw-r-- jklug/jklug 36 2021-11-01 11:30 bstrap.bin.md5
# -rw-rw-r-- jklug/jklug 11 2021-11-17 12:35 do_flash_upgrade
# -rw-rw-r-- jklug/jklug 6 2021-11-01 11:30 model
# -rw-rw-r-- jklug/jklug 6 2021-11-01 11:30 mpower_version
# -rw-rw-r-- jklug/jklug 51249152 2021-11-17 06:23 rootfs.jffs2
# -rw-rw-r-- jklug/jklug 36 2021-11-17 06:36 rootfs.jffs2.md5
# -rwxr-xr-x jklug/jklug 473720 2021-11-01 11:30 uboot.bin
# -rw-rw-r-- jklug/jklug 36 2021-11-01 11:30 uboot.bin.md5
# -rw-r--r-- jklug/jklug 3435940 2021-11-01 11:30 uImage.bin
# -rw-rw-r-- jklug/jklug 36 2021-11-01 11:30 uImage.bin.md5
#
# The changes are as follows:
# do_flash_upgrade -- new file
# rootfs.jffs2 -- padded with 0xff at the end of the file
# rootfs.jffs2.md5 -- new md5 sum to reflect the added padding
|