Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc68ff0

Browse files
committed
rpi: Write full rootfs size.
This writes the full rootfs partition, instead of only the part containing data. This avoids that OpenWrt might incorrectly detects the loopback device containing the overlayfs and then fails to mount it. Fixes #139.
1 parent a905713 commit fc68ff0

File tree

14 files changed

+107
-0
lines changed

14 files changed

+107
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Index: openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
2+
===================================================================
3+
--- openwrt.orig/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
4+
+++ openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
5+
@@ -23,6 +23,8 @@ set $(ptgen -o $OUTPUT -h $head -s $sect
6+
7+
BOOTOFFSET="$(($1 / 512))"
8+
ROOTFSOFFSET="$(($3 / 512))"
9+
+ROOTFSSIZE="$(($4 / 512))"
10+
11+
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
12+
+dd bs=512 if=/dev/zero of="$OUTPUT" seek="$((ROOTFSOFFSET+ROOTFSSIZE-1))" count=1 conv=notrunc
13+
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
no-uart-console.patch
22
boot-config.patch
3+
image-with-full-rootfs.patch
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Index: openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
2+
===================================================================
3+
--- openwrt.orig/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
4+
+++ openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
5+
@@ -23,6 +23,8 @@ set $(ptgen -o $OUTPUT -h $head -s $sect
6+
7+
BOOTOFFSET="$(($1 / 512))"
8+
ROOTFSOFFSET="$(($3 / 512))"
9+
+ROOTFSSIZE="$(($4 / 512))"
10+
11+
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
12+
+dd bs=512 if=/dev/zero of="$OUTPUT" seek="$((ROOTFSOFFSET+ROOTFSSIZE-1))" count=1 conv=notrunc
13+
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
no-uart-console.patch
22
boot-config.patch
3+
image-with-full-rootfs.patch
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Index: openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
2+
===================================================================
3+
--- openwrt.orig/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
4+
+++ openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
5+
@@ -23,6 +23,8 @@ set $(ptgen -o $OUTPUT -h $head -s $sect
6+
7+
BOOTOFFSET="$(($1 / 512))"
8+
ROOTFSOFFSET="$(($3 / 512))"
9+
+ROOTFSSIZE="$(($4 / 512))"
10+
11+
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
12+
+dd bs=512 if=/dev/zero of="$OUTPUT" seek="$((ROOTFSOFFSET+ROOTFSSIZE-1))" count=1 conv=notrunc
13+
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
no-uart-console.patch
22
boot-config.patch
33
add_designware_spi_kmod.patch
4+
image-with-full-rootfs.patch
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Index: openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
2+
===================================================================
3+
--- openwrt.orig/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
4+
+++ openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
5+
@@ -23,6 +23,8 @@ set $(ptgen -o $OUTPUT -h $head -s $sect
6+
7+
BOOTOFFSET="$(($1 / 512))"
8+
ROOTFSOFFSET="$(($3 / 512))"
9+
+ROOTFSSIZE="$(($4 / 512))"
10+
11+
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
12+
+dd bs=512 if=/dev/zero of="$OUTPUT" seek="$((ROOTFSOFFSET+ROOTFSSIZE-1))" count=1 conv=notrunc
13+
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
no-uart-console.patch
22
boot-config.patch
3+
image-with-full-rootfs.patch
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Index: openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
2+
===================================================================
3+
--- openwrt.orig/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
4+
+++ openwrt/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh
5+
@@ -7,6 +7,8 @@ if [ $# -ne 5 ]; then
6+
exit 1
7+
fi
8+
9+
+exit 1
10+
+
11+
OUTPUT="$1"
12+
BOOTFS="$2"
13+
ROOTFS="$3"
14+
@@ -23,6 +25,8 @@ set $(ptgen -o $OUTPUT -h $head -s $sect
15+
16+
BOOTOFFSET="$(($1 / 512))"
17+
ROOTFSOFFSET="$(($3 / 512))"
18+
+ROOTFSSIZE="$(($4 / 512))"
19+
20+
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
21+
+dd bs=512 if=/dev/zero of="$OUTPUT" seek="$((ROOTFSOFFSET+ROOTFSSIZE-1))" count=1 conv=notrunc
22+
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
no-uart-console.patch
22
boot-config.patch
3+
image-with-full-rootfs.patch

0 commit comments

Comments
 (0)