Re: [OpenWrt-Devel] [PATCH v2] imx6: Adding Ka-Ro electronics TX6U-8033 Module on MB7 baseboard support

2019-12-04 Thread Daniel Golle
On Wed, Dec 04, 2019 at 07:52:32PM +0100, Tomasz Maciej Nowak wrote:
> Hi,
> small nit at the end.
> 
> W dniu 04.12.2019 o 19:14, Linus Lüssing pisze:
> > From: Linus Lüssing 
> > 
> > This adds support for the Ka-Ro MB7 board with a TX6U-8033 module.
> > 
> > Specification, according to Linux DTS commit:
> > 
> > TX6U-8033:
> > ProcessorFreescale i.MX 6 Dual Lite, 800MHz
> > RAM  1GiB DDR3 SDRAM
> > ROM  4GiB eMMC
> > Power supply Single 3.1V to 5.5V
> > Size 31mm SO-DIMM
> > Temp. Range  industrial grade (-40°C/-25°C to 105°C Tj)
> > 
> > The u-boot shipped by the vendor by default expects the following partition
> > layout:
> > 
> > MBR/MSDOS, disk-id '0cc66cc0' {
> > 0cc66cc0-01 => ext2, /vmlinuz
> > 0cc66cc0-02 => ext4, rootfs
> > }
> > 
> > TX6DL U-Boot > env print
> > append_bootargs=rootfstype=ext4
> > [...]
> > bootcmd_mmc=setenv autostart no;run bootargs_mmc;ext2load mmc 0 
> > ${kerneladdr} vmlinuz
> > [...]
> > rootpart_uuid=0cc66cc0-02
> > [...]
> > 
> > This is also one of the reasons, why only ext4 rootfs support was added
> > and tested so far. No squashfs support yet.

OpenWrt allows to easily ignore or even filter bootloader cmdline, this
is needed on *most* devices out there. Please add squashfs regardless,
as some features of OpenWrt (overlayfs, factory-reset, ...) are only
available when using squashfs (+f2fs in this case) and it should not
be difficult to do so. Also the rootpart_uuid should not be relevant
when using OpenWrt.

Let me know if anything is not clear of if you need help achieving
this.


> > 
> > Other than that, nothing fancy needs to be added or preserved on the
> > eMMC.
> > 
> > Cc: Simon Wunderlich 
> > Signed-off-by: Linus Lüssing 
> > ---
> > 
> > Changelog v2:
> > * removed wildcard board names
> > 
> >  target/linux/imx6/Makefile|   2 +-
> >  .../imx6/base-files/etc/board.d/02_network|   3 +-
> >  target/linux/imx6/base-files/lib/imx6.sh  |   4 +
> >  .../base-files/lib/preinit/79_move_config |   9 ++
> >  .../imx6/base-files/lib/upgrade/platform.sh   | 108 +-
> >  target/linux/imx6/image/Makefile  |  34 ++
> >  .../linux/imx6/image/gen_karo_sdcard_img.sh   |  26 +
> >  .../imx6/patches-4.14/100-bootargs.patch  |  13 +++
> >  tools/Makefile|   1 +
> >  9 files changed, 197 insertions(+), 3 deletions(-)
> >  create mode 100755 target/linux/imx6/image/gen_karo_sdcard_img.sh
> > 
> > diff --git a/target/linux/imx6/Makefile b/target/linux/imx6/Makefile
> > index ac4300f7eb..8083a54e16 100644
> > --- a/target/linux/imx6/Makefile
> > +++ b/target/linux/imx6/Makefile
> > @@ -20,6 +20,6 @@ include $(INCLUDE_DIR)/target.mk
> >  
> >  KERNELNAME:=zImage dtbs
> >  
> > -DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid
> > +DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid partx-utils
> >  
> >  $(eval $(call BuildTarget))
> > diff --git a/target/linux/imx6/base-files/etc/board.d/02_network 
> > b/target/linux/imx6/base-files/etc/board.d/02_network
> > index 6ec667346d..c662be72b7 100755
> > --- a/target/linux/imx6/base-files/etc/board.d/02_network
> > +++ b/target/linux/imx6/base-files/etc/board.d/02_network
> > @@ -21,7 +21,8 @@ cubox-i |\
> >  *gw552x)
> > ucidef_set_interfaces_lan_wan 'eth0' 'eth1'
> > ;;
> > -*wandboard)
> > +*wandboard |\
> > +tx6u-8033)
> > ucidef_set_interface_wan 'eth0'
> > ;;
> >  esac
> > diff --git a/target/linux/imx6/base-files/lib/imx6.sh 
> > b/target/linux/imx6/base-files/lib/imx6.sh
> > index 68caaff15f..c4b87d1c21 100755
> > --- a/target/linux/imx6/base-files/lib/imx6.sh
> > +++ b/target/linux/imx6/base-files/lib/imx6.sh
> > @@ -99,6 +99,10 @@ imx6_board_detect() {
> > name="wandboard"
> > ;;
> >  
> > +   "Ka-Ro electronics TX6U-8033 Module on MB7 baseboard")
> > +   name="tx6u-8033"
> > +   ;;
> > +
> > *)
> > name="generic"
> > ;;
> > diff --git a/target/linux/imx6/base-files/lib/preinit/79_move_config 
> > b/target/linux/imx6/base-files/lib/preinit/79_move_config
> > index bdf397c4fc..de7196c7a1 100644
> > --- a/target/linux/imx6/base-files/lib/preinit/79_move_config
> > +++ b/target/linux/imx6/base-files/lib/preinit/79_move_config
> > @@ -15,6 +15,15 @@ move_config() {
> > umount /boot
> > fi
> > ;;
> > +   tx6u-8033)
> > +   local bootpart=/dev/mmcblk2p1
> > +
> > +   if [ -b $bootpart ]; then
> > +   mkdir -p /boot
> > +   mount -t ext2 -o rw,noatime $bootpart /boot
> > +   [ -f /boot/sysupgrade.tgz ] && mv -f 
> > /boot/sysupgrade.tgz /
> > +   fi
> > +   ;;
> > esac
> >  }
> >  
> > diff --git a/target/linux/imx6/base-files/lib/upgrade/platform.sh 
> > b/target/linux/imx6/base-files/lib/upgrade/platform.sh
> > index a090cc080b..9c9bed96fe 

Re: [OpenWrt-Devel] [PATCH v2] imx6: Adding Ka-Ro electronics TX6U-8033 Module on MB7 baseboard support

2019-12-04 Thread Tomasz Maciej Nowak
Hi,
small nit at the end.

W dniu 04.12.2019 o 19:14, Linus Lüssing pisze:
> From: Linus Lüssing 
> 
> This adds support for the Ka-Ro MB7 board with a TX6U-8033 module.
> 
> Specification, according to Linux DTS commit:
> 
> TX6U-8033:
> ProcessorFreescale i.MX 6 Dual Lite, 800MHz
> RAM  1GiB DDR3 SDRAM
> ROM  4GiB eMMC
> Power supply Single 3.1V to 5.5V
> Size 31mm SO-DIMM
> Temp. Range  industrial grade (-40°C/-25°C to 105°C Tj)
> 
> The u-boot shipped by the vendor by default expects the following partition
> layout:
> 
> MBR/MSDOS, disk-id '0cc66cc0' {
>   0cc66cc0-01 => ext2, /vmlinuz
>   0cc66cc0-02 => ext4, rootfs
> }
> 
> TX6DL U-Boot > env print
> append_bootargs=rootfstype=ext4
> [...]
> bootcmd_mmc=setenv autostart no;run bootargs_mmc;ext2load mmc 0 ${kerneladdr} 
> vmlinuz
> [...]
> rootpart_uuid=0cc66cc0-02
> [...]
> 
> This is also one of the reasons, why only ext4 rootfs support was added
> and tested so far. No squashfs support yet.
> 
> Other than that, nothing fancy needs to be added or preserved on the
> eMMC.
> 
> Cc: Simon Wunderlich 
> Signed-off-by: Linus Lüssing 
> ---
> 
> Changelog v2:
> * removed wildcard board names
> 
>  target/linux/imx6/Makefile|   2 +-
>  .../imx6/base-files/etc/board.d/02_network|   3 +-
>  target/linux/imx6/base-files/lib/imx6.sh  |   4 +
>  .../base-files/lib/preinit/79_move_config |   9 ++
>  .../imx6/base-files/lib/upgrade/platform.sh   | 108 +-
>  target/linux/imx6/image/Makefile  |  34 ++
>  .../linux/imx6/image/gen_karo_sdcard_img.sh   |  26 +
>  .../imx6/patches-4.14/100-bootargs.patch  |  13 +++
>  tools/Makefile|   1 +
>  9 files changed, 197 insertions(+), 3 deletions(-)
>  create mode 100755 target/linux/imx6/image/gen_karo_sdcard_img.sh
> 
> diff --git a/target/linux/imx6/Makefile b/target/linux/imx6/Makefile
> index ac4300f7eb..8083a54e16 100644
> --- a/target/linux/imx6/Makefile
> +++ b/target/linux/imx6/Makefile
> @@ -20,6 +20,6 @@ include $(INCLUDE_DIR)/target.mk
>  
>  KERNELNAME:=zImage dtbs
>  
> -DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid
> +DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid partx-utils
>  
>  $(eval $(call BuildTarget))
> diff --git a/target/linux/imx6/base-files/etc/board.d/02_network 
> b/target/linux/imx6/base-files/etc/board.d/02_network
> index 6ec667346d..c662be72b7 100755
> --- a/target/linux/imx6/base-files/etc/board.d/02_network
> +++ b/target/linux/imx6/base-files/etc/board.d/02_network
> @@ -21,7 +21,8 @@ cubox-i |\
>  *gw552x)
>   ucidef_set_interfaces_lan_wan 'eth0' 'eth1'
>   ;;
> -*wandboard)
> +*wandboard |\
> +tx6u-8033)
>   ucidef_set_interface_wan 'eth0'
>   ;;
>  esac
> diff --git a/target/linux/imx6/base-files/lib/imx6.sh 
> b/target/linux/imx6/base-files/lib/imx6.sh
> index 68caaff15f..c4b87d1c21 100755
> --- a/target/linux/imx6/base-files/lib/imx6.sh
> +++ b/target/linux/imx6/base-files/lib/imx6.sh
> @@ -99,6 +99,10 @@ imx6_board_detect() {
>   name="wandboard"
>   ;;
>  
> + "Ka-Ro electronics TX6U-8033 Module on MB7 baseboard")
> + name="tx6u-8033"
> + ;;
> +
>   *)
>   name="generic"
>   ;;
> diff --git a/target/linux/imx6/base-files/lib/preinit/79_move_config 
> b/target/linux/imx6/base-files/lib/preinit/79_move_config
> index bdf397c4fc..de7196c7a1 100644
> --- a/target/linux/imx6/base-files/lib/preinit/79_move_config
> +++ b/target/linux/imx6/base-files/lib/preinit/79_move_config
> @@ -15,6 +15,15 @@ move_config() {
>   umount /boot
>   fi
>   ;;
> + tx6u-8033)
> + local bootpart=/dev/mmcblk2p1
> +
> + if [ -b $bootpart ]; then
> + mkdir -p /boot
> + mount -t ext2 -o rw,noatime $bootpart /boot
> + [ -f /boot/sysupgrade.tgz ] && mv -f 
> /boot/sysupgrade.tgz /
> + fi
> + ;;
>   esac
>  }
>  
> diff --git a/target/linux/imx6/base-files/lib/upgrade/platform.sh 
> b/target/linux/imx6/base-files/lib/upgrade/platform.sh
> index a090cc080b..9c9bed96fe 100755
> --- a/target/linux/imx6/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/imx6/base-files/lib/upgrade/platform.sh
> @@ -1,5 +1,5 @@
>  #
> -# Copyright (C) 2010-2015 OpenWrt.org
> +# Copyright (C) 2010-2019 OpenWrt.org
>  #
>  
>  . /lib/imx6.sh
> @@ -30,6 +30,102 @@ apalis_do_upgrade() {
>   umount /boot
>  }
>  
> +# (mostly) copied from brcm2708 platform.sh (which was copied from x86?)
> +tx6u_8033_check_image() {
> + local diskdev partdev diff
> +
> + [ "$#" -gt 1 ] && return 1
> +
> + export_bootdevice && export_partdevice diskdev 0 || {
> + echo "Unable to determine upgrade device"
> + return 1
> + }
> +
> + get_partitions "/dev/$diskdev"