John Deere MTG 4G round 1 of N

Denver Gingerich compliance at sfconservancy.org
Sat Feb 3 05:23:39 UTC 2024


This is a report we prepared for this device based on our analysis in April 2022:



= Detailed results =

We extracted the "MTG 4G-20211208T175944Z-001.zip" file that Deere sent us and found one file inside (mtg-sources-GPL-30.01.380-r2.tar.bz2) which we then extracted again to find the following 7 files:

* arp-scan-1.7.tgz
* bluez-5.48.tgz
* libwebsockets.tgz
* p7zip_9.20.1.tgz
* platform-sources-GPL-4.0.659-1-r2.tar.bz2
* readme.txt
* wine-5.0.2-YukonAtom-30.01.tgz

Since one of the 7 files appeared to be a README file, we opened that one (readme.txt) and found the following:

"""
John Deere Open Source Software (OSS)
MTG 4G LTE 21-1

The source archives included in this archive were compiled per:
   Host machine:   Ubuntu 14.04, x86_64
   Target machine: x86 core2-32 architecture
   GCC version:    5.2.0

Each package has its own unique build procedure. Refer to the package's website for more
information on how it is configured and built.
[...]
Applications GPL Sources - 30.01.380

   The remaining archives are additional GPL packages utilized by the various
   applications groups. Each archive contains the complete source as referenced by a parent
   cmake.
"""

So we attempted to build the packages using cmake:


== arp-scan-1.7 ==

As described on https://cmake.org/cmake/help/latest/guide/user-interaction/ we created a build directory and ran "cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/local", which gave us this error:


CMake Error: The source directory "/home/denver/small/arp-scan-1.7" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.


We reviewed the directory structure and found a CMakeLists.txt file in ../cmake so we adjusted the command line option accordingly, to "cmake ../cmake -DCMAKE_INSTALL_PREFIX=$HOME/local", which gave us this error:


CMake Error at CMakeLists.txt:35 (if):
  if given arguments:

    "CMAKE_GENERATOR" "STREQUAL"

  Unknown arguments specified


Since it appeared that this line 35 in CMakeLists.txt ('if (CMAKE_GENERATOR STREQUAL ${UNIX_GENERATOR})') was not being expanded properly, likely due to a lack of ${UNIX_GENERATOR} being specified, removed both line 35 and line 42 (so the statements inside would always be executed) and then tried again, which gave us this error:


CMake Error at CMakeLists.txt:48 (add_executable):
  Cannot find source file:

    /arp-scan-1.7/arp-scan.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx


We determined that the above error was likely due to a problem with expanding the variable in line 4 ('set ( PROJECT_SOURCE_DIR ${ThirdPartySourceDir}/arp-scan-1.7 )'), namely that ${ThirdPartySourceDir} had not been specified.  So we hard-coded the path in CMakeLists.txt and tried again, which gave us this error:


$ cmake --build .
[ 10%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/arp-scan.o
/home/denver/small/arp-scan-1.7/arp-scan.c: In function ‘main’:
<command-line>:0:9: error: expected expression before ‘/’ token
/home/denver/small/arp-scan-1.7/arp-scan.c:319:37: note: in expansion of macro ‘DATADIR’
          fn = make_message("%s/%s", DATADIR, OUIFILENAME);
[...]


The error here suggested that the DATADIR variable wasn't being properly set in the cmake files, so we found the place where it lived (in ../build/CMakeFiles/arp-scan.dir/flags.make) and then replaced '-DDATADIR="/opt/Deere/SDK/yukon-sysroot/sysroots/core2-32-wrs-linux/share/arp-scan"' with '-DDATADIR=\"/opt/Deere/SDK/yukon-sysroot/sysroots/core2-32-wrs-linux/share/arp-scan\"' (despite the warning to not edit the file - Deere should ensure this is fixed in the appropriate location going forward so no such edits are required), which gave us the following:


$ cmake --build .
[ 10%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/arp-scan.o
[ 20%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/error.o
[ 30%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/hash.o
[ 40%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/link-packet-socket.o
[ 50%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/mt19937ar.o
[ 60%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/obstack.o
[ 70%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/strlcat.o
[ 80%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/strlcpy.o
[ 90%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/utils.o
[100%] Building C object CMakeFiles/arp-scan.dir/home/denver/small/arp-scan-1.7/wrappers.o
Linking C executable arp-scan
[100%] Built target arp-scan
$


We did find an "arp-scan" binary in the current directory, but we did not find any instructions for how to install this onto the MTG 4G.  Per the text of GPLv2 (with similar text in LGPLv2), Deere must provide us with "the scripts used to control compilation and installation of the executable".  In this case "the scripts used to control compilation" need fixing (so that future people building the source don't need to do all the guesswork we needed above), and "the scripts used to control [...] installation of the executable" were entirely missing.  Deere must remedy both such issues in its next candidate.

Note that "apt install cmake libpcap0.8-dev" was required for us to even get this far.



== bluez-5.48.tgz, libwebsockets.tgz, p7zip_9.20.1.tgz ==

A review of these 3 packages and comparison with the upstream project sources showed that none of these contained "the scripts used to control [...] installation of the executable" on the MTG 4G either.  So we chose not to review them further, since they need fixing before they will be complete corresponding source code.  Deere must make the appropriate fixes (to include such scripts) in its next candidate.



== wine-5.0.2-YukonAtom-30.01.tgz ==

This file was much more incomplete than the other 4 above, since it only contained the following:

Jenkinsfile - a file contained some build instructions
wine/patches - a list of patches to some version of Wine

The above did not contain "a parent cmake" or similar, as the readme.txt (from the original 7 files above) suggested it would, and was missing the vast majority of the Wine source code.  However, we did find wine/patches/readme.txt - this is discussed more below.

Note that Deere must provide the "complete corresponding source code", not just references to some project that the user might be able to find online if they looked hard enough.  We expect that Deere will include the complete source code for Wine (including, but not limited to, "the scripts used to control compilation and installation of the executable") in its next source candidate.

Since we did find a new readme.txt file at wine/patches/readme.txt, we opened that file and found it contained the following:


# To apply the full patch series

apt-get install quilt
cd wine-1.8.2
ln -s ~/path/to/atl_wine_patches patches
quilt push -a


So we installed quilt per above, and then attempted the above steps.  However, we noticed that the filename of the file we extracted above was "wine-5.0.2-YukonAtom-30.01.tgz", which suggested we shouldn't use wine-1.8.2, but rather wine-5.0.2.  So we downloaded wine-5.0.2 from https://dl.winehq.org/wine/source/5.0/wine-5.0.2.tar.xz and then attempted the steps from there.  As mentioned above, Deere needs to include this wine-5.0.2.tar.xz file (or equivalent) in its next source candidate.

After running "quilt push -a", we then reviewed the Jenkinsfile provided by Deere (above) to see if it indicated how we might build Wine now that the patches were applied.  At lines 49 to 54 we found a script to be used with Bash that purported to configure Wine prior to compilation.  We unpacked the line manually, and ran the following:

$ ./configure --without-cms --without-cups --without-dbus --without-gphoto --without-gstreamer --without-sane --without-opencl --without-v4l2 --without-gnutls --without-pulse

This did complete (after installing the flex, bison, and xorg-dev packages), but with quite a few warnings.  We eventually resolved these warnings by installing the following complete list of packages (using "apt-get install <package>"):

flex
bison
xorg-dev
libopengl-dev
libglu1-mesa-dev
freeglut3-dev
mesa-common-dev
libxml2-dev
libxslt1-dev
libjpeg-dev
libsdl2-dev

After this we ran the "make" command, per the Jenkinsfile and as one normally does after running ./configure - this ended with "Wine build complete."  However, we could not find a "make install" mention in the Jenkinsfile to determine how to install the Wine binary onto the MTG 4G.  So we tried to run "make install" by itself with no parameters on the build machine that we had been using so far and we got this:


mkdir: cannot create directory ‘/usr/local/lib/wine’: Permission denied
mkdir: cannot create directory ‘/usr/local/lib/wine’: Permission denied
make: *** [install] Error 1


We would normally expect some sort of instructions or similar when this fails, as one does not normally run "make install" on the build machine (unless one is trying to install the binary onto the build machine, which we are not, since the source code is for the binary on the MTG 4G and we wish to replace it, using "the scripts used to control compilation and installation of the library" that Deere must provide per this text of LGPLv2.1).

In any case, we were not able to install Wine onto the MTG 4G from the source code, so this package did not meet the criteria of the license text either.  Deere must ensure that the next source candidate includes complete instructions and/or scripts that show us how to install Wine onto the MTG 4G.

To view this candidate and download the source candidate and firmware image, visit:
https://sfconservancy.org/usethesource/candidate/john-deere-mtg-4g-round-1-of-n/

--
Denver Gingerich
(Via https://sfconservancy.org/usethesource/)


More information about the ccs-review mailing list