Fear of the unknown, combined with the perception of enmity between Microsoft and Open source software has led to a healthy mistrust of new technologies coming from the software giant. This distrust is perhaps not always well-placed.
In this article, we will demonstrate the use of the Windows Subsystem for Linux in a common development task; Building a kernel for an embedded Linux system. In this case, the TS-7800-V2.
To start, ensure the Windows PC (the Development, or Host system) is up to date with the latest WSL2 software, including the most recent Windows Terminal and Debian for WSL. This article does presume all versions are current as of the date of this writing.
To prepare the system for ARM cross-compiling, add the armhf cross-architecture to host Debian system:
sudo dpkg --add-architecture armhf
sudo apt-get update
It is important to note at this juncture that the Linux kernel build system requires a case-sensitive filesystem environment. The default NTFS on a Windows 10 computer is not sufficiently case-sensitive, and an ext4 filesystem must be created for the purposes of building Linux software such as the kernel. There are several ways to accomplish this. The simplest method is to create a filesystem within a file, and mount it as a loop filesystem.
dd if=/dev/zero of=ext4_fs.dd bs=1M count=10000 #<-that's 10 gigs, modify size to your preference
sudo mkfs.ext4 ext4_fs.dd
mount -o loop ext4_fs.dd devloop_mnt
(NOTE: At this point if the above did not work, the likely cause is a host computer that is not fully up-to-date, as older versions of the Windows Subsystem for Linux required extra effort to support loop mounting filesystems.)
From this point, we will assume the developer is operating from within the ext4 filesystem environment.
sudo apt-get install build-essential libncurses-dev libncursesw5-dev bc
make modules -j6
make headers_install INSTALL_HDR_PATH=fakeroot/usr/
make modules_install INSTALL_MOD_PATH=fakeroot/
cp arch/arm/boot/zImage fakeroot/boot/
cp arch/arm/boot/dts/armada-385-ts* fakeroot/boot/
tar -cJf ../kernel_dist.tar.xz *
This should leave the developer with a freshly compiled Linux Kernel and supporting files ready to deploy onto an existing TS-7800-V2 single board computer.
From this point, the kernel_dist.tar.xz file can be moved onto any compatible storage media and connected to the target SBC. Once the media is mounted, the new kernel and supporting files are extracted directly onto the existing filesystem (as root) thus:
tar -xJf kernel_dist.tar.xz -C /
This will place all of the new kernel, header, device tree, and module files into their appropriate homes. Once complete, simply reboot and observe the new kernel in action.