Migrating from Windows CE to Yocto-based Embedded Linux
After 27 years, Windows CE, later known as Windows Embedded CE and Windows Embedded Compact, reached its end-of-life in 2023. Konsulko Group has been helping customers who formerly used Microsoft’s OS for embedded devices to transition to Linux. This short article by Konsulko Principal Software Engineer George McCollister outlines the steps.
Choosing the right software components and tools
Linux, with its vast hardware support and software ecosystem is a natural replacement for device manufacturers that used Windows CE to migrate their product offerings.
The Yocto Project unifies the OpenEmbedded build system and other tools to provide a powerful launch platform for your Embedded Linux device. Recipes for hundreds of software packages are included and thousands more are available through 3rd party layers. Most SoC vendors provide a Yocto compatible BSP (Board Support Package) layer with recipes for building a boot loader and OS kernel. It’s also possible to create your own BSP layer either from scratch or to extend a vendor provided layer.
The most important part of the Windows CE to Yocto-enabled Embedded Linux transition process is understanding the available software components and tools so you can choose the most suitable replacements. It’s common for Windows CE devices to have more custom software since the software ecosystem is much smaller than Embedded Linux. It’s critical to identify which custom software can be replaced with software provided by Yocto Project and third-party layers. Choosing the correct existing tools, drivers, libraries and frameworks will provide a smoother transition and more robust, easy to maintain final product.
Getting Started
A good first step is to perform the Yocto Project Quick Build. This will familiarize you with the basics required to build an Embedded Linux Image and find the appropriate BSP layer for your hardware. Once you add a BSP layer you can build an image such as core-image-minimal for one of the MACHINEs provided by the BSP. This build process will usually provide a boot loader image (typically U-Boot), a Linux kernel image, a Linux devicetree blob and filesystem image. Some BSPs will provide a wic image that can be directly flashed to bootable media such as a Micro SD card. Unlike Windows CE, the default file system type used for the root file system is usually Ext4.
Kernel Drivers and Devicetree
Before attempting to port any device drivers from Windows CE, check to see if a suitable driver already exists in the Linux kernel. The first place to look is in the official Linux kernel source tree. The drivers directory is organized into subsystems, find the subsystem for the type of device that you’re looking for and browse through available drivers. If you’re unable to locate a driver for the device, download the source code and search the driver directory for the part number or partial part number. For example if you were looking for a driver for the TI WL1837MOD WiFi and Bluetooth module you would try searching for “wl1837” with a tool such as git grep
. This would lead to the following results in this case but if you were still unable to find a device driver the next place to look is on the component manufacturer’s website.
bluetooth/hci_ll.c: { .compatible = "ti,wl1837-st" },
net/wireless/ti/wlcore/sdio.c: { .compatible = "ti,wl1837", .data = &wl18xx_data },
net/wireless/ti/wlcore/spi.c: { .compatible = "ti,wl1837", .data = &wl18xx_data},
For bluetooth you would use the hci_ll driver and for wireless LAN you would use the wlcore driver. Once you find the compatible string for the driver you want to use, you need to add an entry for it to the kernel devicetree under the appropriate node. If the module was connected via SPI controller 1 you would add the new node under the spi1 node. Documentation/devicetree/bindings in the Linux kernel source includes information about the devicetree properties the driver recognizes.
System and Init Manager
Linux systems have a system and init manager. Yocto defaults to building the OS image with the SysVinit system but systemd and BusyBox init are also available. BusyBox init can be suitable for very simple embedded systems while systemd is better suited to systems that have many running services with interdependencies.
Adding Additional Software to your Image
Once you’re able to build and boot a basic Linux system consisting of a boot loader, kernel and simple root file system you can explore adding additional software into your image. There are hundreds of packages that you can include in your image available in poky and hundreds more available in meta-openembedded.
If there’s no recipe for the software you want to add in either poky or meta-openembedded it may be provided by a 3rd party layer. The OpenEmbedded Layer Index makes it easy to find 3rd party layers by browsing or searching by layer or recipe name.
Running .NET Applications on Linux
If you’re migrating software written to use .NET framework there are two different Yocto compatible layers available which allow it to run on Linux.
- meta-mono provides Mono which is an open source implementation.
- meta-dotnet-core uses Microsoft provided .NET Core binaries.
Porting Win32 Applications to POSIX
If you have application code that uses the Win32 API it will need to be ported to use a combination of POSIX function calls and other libraries. Any Win32 threading or synchronization function calls made from C will need to be changed to use pthreads. C++ code can be changed to use concurrency classes which abstract pthread calls. Win32 code that creates or interacts with window objects (HWND) will need to be changed to use a different graphical framework such as GTK or Qt.
Qt Framework on Linux
If you’re using Qt Framework in Windows CE you can utilize the meta-qt5 or meta-qt6 layers (depending on which version of Qt your application uses) to build the framework and provide bitbake classes to build your application.
System Updates
There are multiple Yocto compatible solutions available for doing OTA and other types of updates.
- Mender – Provided by meta-mender See this article on using Mender with Yocto Project..
- RAUC – Provided by meta-rauc. See this article on Integrating RAUC with Yocto Project.
- SWUpdate – Provided by meta-swupdate.
Need some help or good advice?
Konsulko Group’s long history with Linux, Yocto Project and OpenEmbedded can provide the expertise customers need when moving to an embedded, open source operating system. Some of Konsulko’s engineers were working with Linux even before the inception of Windows CE in 1996, and many have years of experience moving product offerings from proprietary RTOSs to Linux. Contact us to discuss how we can help with your migration.