#19443: Extroot pivot overlay not working on WRT1900AC due to bug in fstools
-----------------------------+------------------------
 Reporter:  gerein           |      Owner:  developers
     Type:  defect           |     Status:  new
 Priority:  normal           |  Milestone:
Component:  packages         |    Version:  Trunk
 Keywords:  fstools extroot  |
-----------------------------+------------------------
 fstools (in block.c) reads /proc/mtd looking for the string "rootfs" to
 find a rootfs partition (in check_extroot() and find_block_mtd() ).
 However, my WRT1900AC has a second rootfs ("rootfs2" on mtd7, see output
 below), since it keeps the previously flashed image on a separate
 partition. The right rootfs is in an ubifs (on mtd5), therefore
 check_extroot() finds the second rootfs (stock firmware in my case) first
 and gets confused.

 {{{
 root@OpenWrt:~# cat /proc/mtd
 dev:    size   erasesize  name
 mtd0: 00100000 00020000 "u-boot"
 mtd1: 00040000 00020000 "u_env"
 mtd2: 00040000 00020000 "s_env"
 mtd3: 00100000 00020000 "devinfo"
 mtd4: 02800000 00020000 "kernel1"
 mtd5: 02500000 00020000 "ubi"
 mtd6: 02800000 00020000 "kernel2"
 mtd7: 02500000 00020000 "rootfs2"
 mtd8: 02600000 00020000 "syscfg"
 mtd9: 00008000 00008000 "spi0.0"
 }}}

 The following patch fixes the lookup and make extroot work but is probably
 not the most clean/complete solution to the problem.

 {{{
 --- block.c    2015-04-09 12:36:09.000000000 +0100
 +++ block-new.c    2015-04-09 14:46:00.000000000 +0100
 @@ -969,7 +969,7 @@
      char devpath[32];

  #ifdef UBIFS_EXTROOT
 -    if (find_block_mtd("rootfs", devpath, sizeof(devpath))) {
 +    if (find_block_mtd("rootfs\"", devpath, sizeof(devpath))) {
          int err = -1;
          libubi_t libubi;
 }}}

--
Ticket URL: <https://dev.openwrt.org/ticket/19443>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets

Reply via email to