Building Custom Yocto Image for Mangoh Red WP76

Gotcha. Are the warnings of any concern? Also what is the command to flash the new image to an SD card? Thanks!

No concern for the warning as far as you can build the required .cwe file.

// to mount SD card
mkdir -p /tmp/sdcard
/bin/mount -t auto -o sync /dev/mmcblk0p1 “/tmp/sdcard”

and then you can copy the file to SD card.

Thanks!

I followed the steps you mentioned and copied the .cwe file to the SD card.
However, I could not boot from the SD card after inserting into the board.
Are there any steps that I am missing?

Also,
After adding packages and building the image I receive the following error:
ERROR: mdm9x28-image-minimal-1.0-r0.0 do_image_complete: Function failed: prepare_ubi (log file is located at /home/aswsim/Desktop/Legato-Dist-Source-mdm9x28-SWI9X07Y_02.37.07.00/yocto/build_bin/tmp/work/swi_mdm9x28_wp-poky-linux-gnueabi/mdm9x28-image-minimal/1.0-r0.0/temp/log.do_image_complete.32358)

ubinize: error!: error in section “sysfs_volume”: size of the image file “/home/aswsim/Desktop/Legato-Dist-Source-mdm9x28-SWI9X07Y_02.37.07.00/yocto/build_bin/tmp/work/swi_mdm9x28_wp-poky-linux-gnueabi/mdm9x28-image-minimal/1.0-r0.0/deploy-mdm9x28-image-minimal-image-complete/mdm9x28-image-minimal-swi-mdm9x28-wp-20201029200705.rootfs.2k.ubifs” is 67805184, which is larger than volume size 50331648

I have changed the ubi size using various values:
./meta-swi/meta-swi-mdm9x28/conf/machine/swi-mdm9x28.conf
change UBI_ROOTFS_SIZE ?= “48MiB”

But still receive the error

You cannot boot from sd card, you need to update the FW by fwupdate command

Seems you have put too much recipes to the image…

So I reduced the amount of packages added to the image to just python3 and dpkg but still exceeds the limit … is there a way to increase the volume size? Thanks!

New module with fw R16 freshly come out from sierra factory should have bigger size.

You can also see this doc and see if you can run the python in ram area instead of building to the image.

So I downloaded and added python3 and dpkg .bb files and made the required changes in the other 2 files.

When I run make I receive the following error:
aswsim@aswsim-Precision-Tower-3620:~/Desktop/yocto$ make
Makefile:71: “Legato: build disabled since ‘/home/aswsim/Desktop/yocto/legato/’ does not exist”
“meta-swi/build.sh” -p poky/ -o meta-openembedded/ -l meta-swi -x “kernel” -j 9 -t 9 -a LK_REPO_DIR="/home/aswsim/Desktop/yocto" -a LK_REPO_NAME=“lk” -a LK_REPO=“file://lk” -m swi-mdm9x28 -P wp -b build_bin -q
Poky dir: /home/aswsim/Desktop/yocto/poky
OE meta: /home/aswsim/Desktop/yocto/meta-openembedded
SWI meta dir: /home/aswsim/Desktop/yocto/meta-swi
Linux repo dir: /home/aswsim/Desktop/yocto/kernel
Number of make threads 9
Number of bitbake tasks 9
Extra options added - LK_REPO_DIR=/home/aswsim/Desktop/yocto
Extra options added - LK_REPO_NAME=lk
Extra options added - LK_REPO=file://lk
SWI machine: swi-mdm9x28
SWI product: wp
Build dir: /home/aswsim/Desktop/yocto/build_bin
Enable Qualcomm Proprietary bin

Shell environment set up for builds.

You can now run 'bitbake ’

Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
meta-ide-support

You can also run generated qemu images with a command like ‘runqemu qemux86’

  • layer: meta-oe
  • layer: meta-networking
  • layer: meta-python
  • layer: meta-gplv2
  • layer: meta-swi/common
  • layer: meta-swi/meta-swi-mdm9xxx
  • layer: meta-swi/meta-swi-mdm9x28
  • layer: meta-swi-extras/common
  • layer: meta-swi-extras/meta-swi-mdm9x28
  • layer: meta-swi-extras/meta-swi-mdm9xxx-bin
  • layer: meta-swi-extras/meta-swi-mdm9x28-bin
  • layer: meta-swi-extras/meta-swi-mdm9x28-wp-bin
    Yocto machine: swi-mdm9x28-wp
    Updating LEGATO_BUILD to false
    Updating IMA_BUILD to false
    Updating IMA_CONFIG to
    Updating IMA_LOCAL_CA_X509 to
    Updating IMA_PRIV_KEY to
    Updating IMA_PUB_CERT to
    Updating IMA_KERNEL_CMDLINE_OPTIONS to
    Updating ENABLE_IMA to 0
    Updating IMA_PUBLIC_CERT to
    Updating IMA_PRIVATE_KEY to
    Updating IMA_SMACK to
    Updating ENABLE_FX30 to
    Updating ROOTFS_VERSION to
    Updating LK_REPO_DIR to /home/aswsim/Desktop/yocto
    Updating LK_REPO_NAME to lk
    Updating LK_REPO to file://lk
    Updating EXT_SWI_IMG to false
    Updating INITRAMFS_IMAGE_BUNDLE to 1
    Updating INITRAMFS_IMAGE to mdm9x28-image-initramfs
    Updating FIRMWARE_PATH to
    Updating PACKAGECONFIG_remove to gnutls
    Build image of minimal rootfs (for swi-mdm9x28).
    WARNING: Layer swi-wp-bin should set LAYERSERIES_COMPAT_swi-wp-bin in its conf/layer.conf file to list the core layer names it is compatible with.
    WARNING: Layer swi-wp-bin should set LAYERSERIES_COMPAT_swi-wp-bin in its conf/layer.conf file to list the core layer names it is compatible with.
    WARNING: /home/aswsim/Desktop/yocto/meta-swi-extras/meta-swi-mdm9x28-bin/recipes/swimtd/swimtd_git.bb: Unable to get checksum for swimtd SRC_URI entry swimtd-bin.tar.bz2: file could not be found
    ERROR: ParseError at /home/aswsim/Desktop/yocto/meta-openembedded/meta-python/recipes-devtools/python/python3_debian.bb:11: Could not inherit file classes/debian-package.bbclass

Summary: There were 3 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
Makefile:300: recipe for target ‘image_bin’ failed
make: *** [image_bin] Error 1

Also can i rebuild yocto kernel to enable etx4, that way I can setup debian environment on a SD card that would include python, dpkg packages …

You can follow the steps below to run python3:

  1. download the yocto source and go to ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc

  2. add the following line:
    IMAGE_INSTALL_append = " python3"

  3. go to ./meta-swi/meta-swi-mdm9x28/conf/machine/swi-mdm9x28.conf
    change UBI_ROOTFS_SIZE ?= “48MiB”

  4. Make the yocto image ( there will be error to make the image, but we can build the binary of python3)

  5. on PC, type :
    sudo ifconfig usb0 192.168.2.3

  6. on module, type :

mkdir /tmp/tmp_usr_bin/;mkdir /tmp/tmp_usr_bin_wr;
mount -t overlay overlay /usr/bin -o lowerdir=/usr/bin,upperdir=/tmp/tmp_usr_bin,workdir=/tmp/tmp_usr_bin_wr;

mkdir /tmp/tmp_usr_include/;mkdir /tmp/tmp_usr_include_wr;
mount -t overlay overlay /usr/include -o lowerdir=/usr/include,upperdir=/tmp/tmp_usr_include,workdir=/tmp/tmp_usr_include_wr;

mkdir /tmp/tmp_usr_lib/;mkdir /tmp/tmp_usr_lib_wr;
cp -rf /usr/lib/* /tmp/tmp_usr_lib/
mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tmp/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;

mkdir /usr/lib/python3.5

  1. on PC, type :
    scp -r ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/include/* root@192.168.2.2:/usr/include
    scp -r ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/bin/* root@192.168.2.2:/usr/bin
    scp ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/libpython3.5m.so ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/libpython3.5m.so.1.0 ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/libpython3.so root@192.168.2.2:/usr/lib
    scp -r ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/pkgconfig root@192.168.2.2:/usr/lib
    scp -r ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/python3.5/encodings/ root@192.168.2.2:/usr/lib/python3.5
    scp ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/python3.5/*.py root@192.168.2.2:/usr/lib/python3.5

  2. now on module, you can use python3:

root@swi-mdm9x28-wp:~# python3
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
Python 3.5.5 (default, Oct 24 2019, 07:42:55)
[GCC 7.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

^C
KeyboardInterrupt
exit()

To use dpkg recipe, you can try the following:

  1. download the yocto source and go to ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc
  2. add the following line:
    IMAGE_INSTALL_append = " dpkg"
  3. type “make” to build the yocto image

the command right before step 8 gives an error: scp ./Legato-Dist-Source-mdm9x28-SWI9X07Y_02.37.07.00/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/python3.5/*.py root@192.168.2.2:/usr/lib/python3.5
scp: /usr/lib/python3.5: No such file or directory

dont undertand why because the previous command worked but not the command above:
aswsim@aswsim-Precision-Tower-3620:~/Desktop$ scp -r ./Legato-Dist-Source-mdm9x28-SWI9X07Y_02.37.07.00/yocto/build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/python3/3.5.5-r1.0/image/usr/lib/python3.5/encodings root@192.168.2.2:/usr/lib/python3.5
scp: /usr/lib/python3.5: Read-only file system

Did you do the following?

mkdir /tmp/tmp_usr_lib/;mkdir /tmp/tmp_usr_lib_wr;
cp -rf /usr/lib/* /tmp/tmp_usr_lib/
mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tmp/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;

mkdir /usr/lib/python3.5

Is there actually a new wp76 module version? Or just a new fw version?

I think just new fw with partition size changed.
You can contact distributor for more information

Yes still getting the same error unfortunately
aswsim@aswsim-Precision-Tower-3620:~ sudo ifconfig enp0s20f0u9i19 192.168.2.3 [sudo] password for aswsim: aswsim@aswsim-Precision-Tower-3620:~ sudo mkdir /tmp/tmp_usr_lib/;
mkdir: cannot create directory ‘/tmp/tmp_usr_lib/’: File exists
aswsim@aswsim-Precision-Tower-3620:~ sudo mkdir /tmp/tmp_usr_lib_wr; mkdir: cannot create directory ‘/tmp/tmp_usr_lib_wr’: File exists aswsim@aswsim-Precision-Tower-3620:~ sudo cp -rf /usr/lib/* /tmp/tmp_usr_lib/
aswsim@aswsim-Precision-Tower-3620:~ sudo mount -t overlay overlay /usr/lib -o mount: option requires an argument -- 'o' Try 'mount --help' for more information. aswsim@aswsim-Precision-Tower-3620:~ sudo mount -t overlay overlay /usr/lib – o
mount: bad usage
Try ‘mount --help’ for more information.
aswsim@aswsim-Precision-Tower-3620:~ sudo mount -t overlay overlay /usr/lib o mount: bad usage Try 'mount --help' for more information. aswsim@aswsim-Precision-Tower-3620:~ lowerdir=/usr/lib,upperdir=/tmp/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;
aswsim@aswsim-Precision-Tower-3620:~$ mkdir /usr/lib/python3.5
mkdir: cannot create directory ‘/usr/lib/python3.5’: File exists

This should be one line command which enter in module console, not your pc:

mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tmp/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;

Can I resize the partition size? Ideally we would like to fit the image onto the SD card

This can only be done by sierra internally, you need to contact distributor.

You can also put those python library in sd card