Search code examples
raspberry-piwindows-10-iot-corewindowsiotbsp

File collision error building IoT Core image with modified config.txt file


I am building a Windows 10 IoT Core image for a Raspberry Pi 3B and it needs to contain a custom config.txt file at the root of the EFIESP partition.

I have edited the MyApp.FilesAndRegKeys.wm.xml file to include the edited config.txt file like so:

<onecorePackageInfo
    targetPartition="EFIESP"
    releaseType="Production"
    ownerType="OEM" />
<files>
    <file
        destinationDir="$(runtime.bootDrive)"
        source="config.txt"
        name="config.txt" />
</files>

But the buildimage MyApp test command gives a file collision error:

ERROR: [00:00:01] onecore\base\cbs\mobile\iuvalidator\packagevalidationrules.cpp, PackageValidationRules::Rule_DetectFileCollisions, line 716, Error , Error - File collision detected, file '\config.txt' found in packages 'MyOEMName.MyApp.FilesAndRegKeys' and 'RASPBERRYPI.RPi2.BootFirmware'.

If I change name="config.txt" to name="config2.txt" then there is no error and the file is created successfully. But I want it to replace the existing file, not create a new one. I don't see the original config.txt file anywhere in C:\IoT-ADK-AddonKit or C:\BSP so I'm not sure how to edit this existing package or force the replacement to occur.


Solution

  • If you want to edit the config.txt file, you can edit it after the image build. Insert the SD card that has the image flashed. You will find the config.txt file in EFIESP drive like this:

    enter image description here

    enter image description here

    Reference: "R-Pi configuration file" and "CONFIG.TXT"

    Update: Building IoT Core image with the modified config.txt file.

    The config.txt is provided in a package (RASPBERRYPI.RPi2.BootFirmware.cab). So we need to regenerate the RASPBERRYPI.RPi2.BootFirmware.cab with the modified config.txt file. You can follow these steps:

    1. Get all files needed to build the RASPBERRYPI.RPi2.BootFirmware.cab and copy them to a folder, for example, D:\NewCab. You can find them in EFIESP drive(You can find EFIESP drive in the flashed SD card):

    enter image description here

    1. Edit the config.txt.
    2. Generate the new CAB file using this RPi_UEFI.pkg.xml file:

    <?xml version="1.0" encoding="utf-8"?>
    
    <!--
    Copyright (c) Microsoft Corporation.  All rights reserved.
    -->
    <Package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      Owner="RASPBERRYPI"
      Component="RPi2"
      SubComponent="BootFirmware"
      OwnerType="OEM"
      ReleaseType="Production"
      Platform="RPi2"
      Partition="EFIESP"
      BinaryPartition="false"
      xmlns="urn:Microsoft.WindowsPhone/PackageSchema.v8.00">
      <Components>
        <OSComponent>
          <Files>
    
            <File
              Source="bootcode.bin"
              Name="bootcode.bin"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="config.txt"
              Name="config.txt"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="fixup.dat"
              Name="fixup.dat"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="fixup_cd.dat"
              Name="fixup_cd.dat"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="fixup_x.dat"
              Name="fixup_x.dat"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="kernel.img"
              Name="kernel.img"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="LICENCE.broadcom"
              Name="LICENCE.broadcom"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="start.elf"
              Name="start.elf"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="start_cd.elf"
              Name="start_cd.elf"
              DestinationDir="$(runtime.root)"/>
    
            <File
              Source="start_x.elf"
              Name="start_x.elf"
              DestinationDir="$(runtime.root)"/>
    
          </Files>
        </OSComponent>
      </Components>
    </Package>
    
    1. Start IoTCoreShell-arm.cmd in the iot-adk-addonkit and navigate to the path D:\NewCab and run the following command:

      pkggen RPi_UEFI.pkg.xml

      You will get a RASPBERRYPI.RPi2.BootFirmware.cab in the working folder.

    2. Use the new generate RASPBERRYPI.RPi2.BootFirmware.cab replace the default one in this path C:\Program Files (x86)\Windows Kits\10\MSPackages\retail\arm\fre

    After that when you build image the edited config.txt will be added in.