2017/05/08

LinkIt Smart 7688 Duo - how to manually add modules to OpenWRT build

I followed the instructions at https://github.com/MediaTek-Labs/linkit-smart-7688-feed and https://forum.labs.mediatek.com/en/t/adventures-in-building-openwrt-for-linkit7688/258 to compile firmware and installed the new firmware on my LinkIt Smart 7688 Duo successfully.

root@mylinkit:~# uname -r
3.18.44


However, when following the instruction at https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/file-storage/mounting-the-root-fs-on-an-sd-card, I run into the below problem after running "opkg update" and "opkg install kmod-fs-ext4"

Installing kmod-fs-ext4 (3.18.23-1) to root...
Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/base/kmod-fs-ext4_3.18.23-1_ramips_24kec.ipk.
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-fs-ext4:
 * kernel (= 3.18.23-1-32322c69cacfebf6e22f4e61cea9bebc) * kernel (= 3.18.23-1-32322c69cacfebf6e22f4e61cea9bebc) * kernel (= 3.18.23-1-32322c69cacfebf6e22f4e61cea9bebc) * kernel (= 3.18.23-1-32322c69cacfebf6e22f4e61cea9bebc) *
 * opkg_install_cmd: Cannot install package kmod-fs-ext4.

Apparently, there is a mismatch between the the module and the kernel because the module was built for kernel version 3.18.23 but the kernel is 3.18.44. To solve this issue, I was told that I need to use make menuconfig to add the modules in question to my build. Below is a summary of how to do it.

Step-1, Find the modules that need to be added to the build

According to the info. at https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/file-storage/mounting-the-root-fs-on-an-sd-card 5 modules are needed for mounting the root FS onto a SD Card.



Below are the ipk names of the 5 modules.

block-mount:
block-mount_2016-01-10-96415afecef35766332067f4205ef3b2c7561d21_ramips_24kec.ipk

kmod-fs-ext4:
kmod-fs-ext4_3.18.23-1_ramips_24kec.ipk

kmod-usb-storage-extras:
kmod-usb-storage-extras_3.18.23-1_ramips_24kec.ipk

e2fsprogs:
e2fsprogs_1.42.12-1_ramips_24kec.ipk

fdisk:
fdisk_2.25.2-4_ramips_24kec.ipk

Of the 5 modules, kmod-fs-ext4 and kmod-usb-storage-extras are built for kernel 3.18.23 and we need to add them into the OpenWRT firmware build for kernel version 3.18.44 so that they could support kernel version 3.18.44.

Step-2, Add the modules to the build

wei-hsiung@weihsiung-ThinkPad-Edge-E420s:~/openwrt$ make menuconfig

OpenWrt Configuration

Select the options as below:
Target System: Ralink RT288x/RT3xxx
Subtarget: MT7688 based boards
Target Profile: LinkIt7688


Advanced configuration options (for developers) 

Select "Use ccache" because it's used by packages such as PyInstaller, Cython, etc.


OpenWrt Configuration > Kernel modules > Filesystems

Select "kmod-fs-ext4".


OpenWrt Configuration > Kernel modules > USB Support

Select "kmod-usb-storage-extras".


OpenWrt Configuration > Development

gcc is needed for Cython and PyInstaller. 

Select "gcc". This will also select "ar", "binutils", and "objdump".



Important!!

The on-board flash memory of LinkIt Smart 7688 Duo is 32MB, the compiled firmware without gcc is around 22MB and the firmware with gcc is around 38MB (see below pic). Unless the overall size of the firmware can be kept to around 28MB, gcc cannot be included in the compiled firmware.


Step-3, Building the firmware

wei-hsiung@weihsiung-ThinkPad-Edge-E420s:~/openwrt$ make clean
wei-hsiung@weihsiung-ThinkPad-Edge-E420s:~/openwrt$ time make -j 2 V=99

Step-4, Loading and testing the firmware

The manually added modules are compiled for the kernel (3.18.44).


Below is an overview of the capacity and usage of the on-board flash memory after completing step-1 to step-10 as mentioned in the link below (before the switching over from internal flash to external SD card). https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/file-storage/mounting-the-root-fs-on-an-sd-card.


References:

Linux 核心編譯與管理


No comments:

Post a Comment