# How to replace the module in FW image(R16)

**URL:** <https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735>\
**Category:** Uncategorized\
**Created:** [October 26, 2021, 6:22am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735 "2021-10-26T06:22:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruceke](https://avatars.discourse-cdn.com/v4/letter/b/0ea827/32.png) [@bruceke](https://mangoh.discourse.group/u/bruceke)\
**Post date:** [October 26, 2021, 6:22am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/1 "2021-10-26T06:22:05Z")

</div>

How to replace the module in FW image(R16)  
(/mnt/legato/system/modules/mangoh\_yellow\_dev.ko)  
Becausewe have some modification in mangoh\_yellow\_dev.ko  
so we will run  
rmmod /mnt/legato/system/modules/mangoh\_yellow\_dev.ko  
and insert our modified module after remove module  
insmod /home/root/mangoh\_yellow\_dev.ko

Can we replace this module during the build process? ( I can’t find the this module in yocto source code)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [October 26, 2021, 6:54am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/2 "2021-10-26T06:54:27Z")

</div>

have you checked the legato source?

---

<div class="post-metadata">

**Author:** ![bruceke](https://avatars.discourse-cdn.com/v4/letter/b/0ea827/32.png) [@bruceke](https://mangoh.discourse.group/u/bruceke)\
**Post date:** [October 26, 2021, 7:14am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/3 "2021-10-26T07:14:40Z")

</div>

yes , I also search “mangoh\_yellow\_dev” in yocto folder , but no related files were found

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [October 26, 2021, 7:15am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/4 "2021-10-26T07:15:27Z")

</div>

It should be in the legato layer, not yocto

> <https://github.com/mangOH/mangOH/blob/master/linux_kernel_modules/mangoh/mangoh_yellow_dev.mdef>

---

<div class="post-metadata">

**Author:** ![bruceke](https://avatars.discourse-cdn.com/v4/letter/b/0ea827/32.png) [@bruceke](https://mangoh.discourse.group/u/bruceke)\
**Post date:** [October 26, 2021, 8:48am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/5 "2021-10-26T08:48:19Z")

</div>

Thanks your information.  
I modified it under the source code folder of Legato and recompiled it, and installed it to the WP7605 target board (update yellow.wp76xx.update 192.168.2.2)

But checking the version of “/mnt/legato/system/modules/mangoh\_yellow\_dev.ko” is still not updated.

Did I miss something?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [October 26, 2021, 9:01am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/6 "2021-10-26T09:01:17Z")

</div>

how about compile it together to the legato.cwe image?  
(i.e. not using xxx.update file)

---

<div class="post-metadata">

**Author:** ![bruceke](https://avatars.discourse-cdn.com/v4/letter/b/0ea827/32.png) [@bruceke](https://mangoh.discourse.group/u/bruceke)\
**Post date:** [October 26, 2021, 9:28am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/7 "2021-10-26T09:28:22Z")

</div>

I don’t understand about your suggestion.  
Only update file after compile [“mangOH”](https://github.com/mangOH/mangOH) .

And “R16” (Legato-Dist-Source-mdm9x28-SWI9X07Y\_02.37.07.00.tar.bz2) can not find the relevant documents of mangoh\_yellow\_dev

so I don’t know how to compile it together…

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [October 26, 2021, 9:31am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/8 "2021-10-26T09:31:02Z")

</div>

Here has an example to include a new application to legato.cwe

> **[Flash size wp7607](https://forum.legato.io/t/flash-size-wp7607/3805/35)**
>
> you can go to legato-19.02.0/modules/WiFi/wifi.sdef, under “apps:” section, add e.g. $LEGATO\_ROOT/apps/sample/helloWorld/helloWorld.adef Now the new app will be included in legato.cwe. Please also note that the max size for legato partition is...

Probably you need to do the same according to yellow.sdef to include your kernel driver:

> <https://github.com/mangOH/mangOH/blob/master/yellow.sdef>

---

<div class="post-metadata">

**Author:** ![bruceke](https://avatars.discourse-cdn.com/v4/letter/b/0ea827/32.png) [@bruceke](https://mangoh.discourse.group/u/bruceke)\
**Post date:** [November 15, 2021, 6:54am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/9 "2021-11-15T06:54:36Z")

</div>

Hi jyijyi,  
Thanks,  
I have downloaded the tarball (legato-19.11.5.tar.bz2)  
And try to modify localhost.sdef, then compile it (make wp76xx)  
But I didn’t see my newly added module on the target board after firmware updated  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/2X/5/5f3ef3db7cce1e6342a827ead71d39dc30ad4395.png)

(I hope wifi and the modified mangoh\_yellow\_dev.ko driver can be added)  
Is there any error in my modification?

below is modified ‘localhost.sdef’

```auto
//--------------------------------------------------------------------------------------------------
// Sample system definition that includes essential modem and positioning services.
//
// Copyright (C) Sierra Wireless Inc.
//--------------------------------------------------------------------------------------------------

#include "$LEGATO_ROOT/legatoTargetConfig.sinc"

#include "$LEGATO_ROOT/apps/platformServices/defaultAirVantage.sinc"

buildVars:
{
    MANGOH_BOARD = yellow

    LEGATO_WIFI_PA = ${CURDIR}/linux_kernel_modules/cypwifi/scripts/pa_wifi.sh

#if ${MANGOH_WP_CHIPSET_9X07} = 1
    MANGOH_BME680_I2C_BUS = 6
#elif ${MANGOH_WP_CHIPSET_9X15} = 1
    MANGOH_BME680_I2C_BUS = 2
#endif

    // Exclude a few big libraries from the Legato apps to save space in the legato.cwe.
    // These libraries are available in the root file system, but by default they also
    // get added to some apps to prevent potential version mismatches when running on older
    // root file systems.
    USE_ROOTFS_CURL = 1
    USE_ROOTFS_OPENSSL = 1
    USE_ROOTFS_ZLIB = 1
}

#if ${OCTAVE} = 1
#include "sinc/octave_full.sinc"
#endif

apps:
{
    // Platform services.
    $LEGATO_ROOT/apps/platformServices/audioService
    $LEGATO_ROOT/apps/platformServices/cellNetService
    $LEGATO_ROOT/apps/platformServices/dataConnectionService
    $LEGATO_ROOT/apps/platformServices/fwupdateService
    $LEGATO_ROOT/apps/platformServices/modemService
    $LEGATO_ROOT/apps/platformServices/positioningService
    $LEGATO_ROOT/apps/platformServices/powerMgr
    $LEGATO_ROOT/apps/platformServices/secStore
    $LEGATO_ROOT/apps/platformServices/smsInboxService
    $LEGATO_ROOT/apps/platformServices/voiceCallService
    $LEGATO_ROOT/apps/platformServices/gpioService
    $LEGATO_ROOT/apps/platformServices/atService
    $LEGATO_ROOT/apps/platformServices/portService
//
    $CURDIR/apps/YellowSensor/imu
    $CURDIR/apps/YellowSensor/light
    $CURDIR/apps/YellowSensor/button
    $CURDIR/apps/Bme680EnvironmentalSensor/environment
    $CURDIR/apps/DataHub-Buzzer/buzzer
    $CURDIR/apps/YellowOnBoardActuators/leds
    $CURDIR/apps/BatteryService/battery
    $CURDIR/apps/VegasMode/vegasMode
    $CURDIR/apps/Welcome/helloYellow
    $CURDIR/samples/BluetoothSensorTag/bluetoothSensorTag
    $CURDIR/apps/ntag/ntag
    $CURDIR/apps/NtagDhubIf/NtagDhubIf
    $CURDIR/apps/BluetoothServices/bluetoothServices
    $CURDIR/apps/wakeup_app/wakeup_app
    // Command-line tools.
    $LEGATO_ROOT/apps/tools/tools
}

commands:
{
    cm = tools:/scripts/cm
    fwupdate = tools:/bin/fwupdate
    secstore = tools:/bin/secstore
    pmtool = tools:/bin/pmtool
    gnss = tools:/bin/gnss
    uartMode = tools:/bin/uartMode
}

bindings:
{
    <root>.le_fwupdate -> fwupdateService.le_fwupdate
}

interfaceSearch:
{
    interfaces/modemServices
    interfaces/positioning
    interfaces/atServices
    $CURDIR/apps/YellowSensor/interfaces
    $LEGATO_ROOT/interfaces/wifi
}

kernelModules:
{
    $CURDIR/linux_kernel_modules/mangoh/mangoh_yellow_dev
    $CURDIR/linux_kernel_modules/bmi160/bmi160-i2c
    $CURDIR/linux_kernel_modules/bmi160/bmi160
    $CURDIR/linux_kernel_modules/rtc-pcf85063/rtc-pcf85063
    $CURDIR/linux_kernel_modules/rtc_sync/rtc_sync
    $CURDIR/linux_kernel_modules/bq25601/bq25601
    $CURDIR/linux_kernel_modules/bq27xxx/bq27xxx_battery
    $CURDIR/linux_kernel_modules/opt300x/opt300x
    $CURDIR/linux_kernel_modules/expander/expander
    $CURDIR/linux_kernel_modules/cp2130/cp2130
}

```

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [November 15, 2021, 7:15am UTC](https://mangoh.discourse.group/t/how-to-replace-the-module-in-fw-image-r16/9735/10 "2021-11-15T07:15:03Z")

</div>

How about modifying ./modules/WiFi/wifi.sdef
