Bug when building IoT Core on WSL 2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug when building IoT Core on WSL 2

Jump to solution
2,072 Views
me1
Contributor II

Hi there,

There seems to be a bug (or by design issue) with the Common.mk file when trying to build under WSL 2. The build process needs to test to see if it is running under WSL and then turn on folder case sensitivity as appropriate. However, there appears to be a change in WSL 2 that is failing evaluation.

The test in Common.mk is:

verify_case_sensitivity_$(UBOOT_OUT) verify_case_sensitivity_$(OPTEE_OUT):
ifeq (,$(findstring microsoft,$(shell cat /proc/sys/kernel/osrelease)))
    @echo Not running WSL, no case sensitivity check needed.
else
ifneq (,$(CASE_WSL_MNT))
    @echo Running WSL, but not in a mount.
else
    @echo Checking case sensitivity of $(CASE_DIR)

but with WSL 2 the “cat /proc/sys/kernel/osrelease” returns:

4.19.104-microsoft-standard

So it fails as findstring is case sensitive. I can fix this for my system but it should be addressed for the future as who knows if MS will go back to uppercase M in the osrelease value.

Thanks,


TonyG

Labels (2)
Tags (2)
0 Kudos
1 Solution
1,988 Views
me1
Contributor II

Looks like I forgot to delete my u-boot directory when I first tested this. What appears to be happening is that on the first run there is no u-boot directory so this part of the Common.mk:

verify_case_sensitivity: verify_case_sensitivity_$(UBOOT_OUT) verify_case_sensitivity_$(OPTEE_OUT)
CASE_DIR=$(subst verify_case_sensitivity_,,$@)
CASE_DIR_WIN=$(shell wslpath -m $(CASE_DIR))

Ends up leaving CASE_DIR_WIN empty so when the build gets around to this:

    echo Directory does not have case sensitivity enabled. Attempting to enable it.
    cd $(CASE_DIR) > /dev/null
    if test "`$(IS_ADMIN_CMD) "Access is denied"`"
    then
      echo WSL not running as Administrator, launching an escalated PowerShell session to set case sensitivity!
      powershell.exe "Start-Process powershell -ArgumentList 'cd $(CASE_DIR_WIN);fsutil.exe file setCaseSensitiveInfo . enable;' -Verb RunAs"
    else
      echo Setting case sensitivity enabled on $(CASE_DIR)
      fsutil.exe file setCaseSensitiveInfo . enable
    fi

PowerShell can't enter the directory and set the case sensitivity - If you break the make right after this and run it again then it sets the case sensitivity correctly. If you wait until the build fails then I think you already have directories that are case insensitive so you break the SPL part.

Both this and the uppercase/lowercase Microsoft need to be fixed.

Thanks,

TonyG

View solution in original post

0 Kudos
3 Replies
1,989 Views
me1
Contributor II

Looks like I forgot to delete my u-boot directory when I first tested this. What appears to be happening is that on the first run there is no u-boot directory so this part of the Common.mk:

verify_case_sensitivity: verify_case_sensitivity_$(UBOOT_OUT) verify_case_sensitivity_$(OPTEE_OUT)
CASE_DIR=$(subst verify_case_sensitivity_,,$@)
CASE_DIR_WIN=$(shell wslpath -m $(CASE_DIR))

Ends up leaving CASE_DIR_WIN empty so when the build gets around to this:

    echo Directory does not have case sensitivity enabled. Attempting to enable it.
    cd $(CASE_DIR) > /dev/null
    if test "`$(IS_ADMIN_CMD) "Access is denied"`"
    then
      echo WSL not running as Administrator, launching an escalated PowerShell session to set case sensitivity!
      powershell.exe "Start-Process powershell -ArgumentList 'cd $(CASE_DIR_WIN);fsutil.exe file setCaseSensitiveInfo . enable;' -Verb RunAs"
    else
      echo Setting case sensitivity enabled on $(CASE_DIR)
      fsutil.exe file setCaseSensitiveInfo . enable
    fi

PowerShell can't enter the directory and set the case sensitivity - If you break the make right after this and run it again then it sets the case sensitivity correctly. If you wait until the build fails then I think you already have directories that are case insensitive so you break the SPL part.

Both this and the uppercase/lowercase Microsoft need to be fixed.

Thanks,

TonyG

0 Kudos
1,988 Views
me1
Contributor II

Spoke too soon - My build just failed on the SPL being identified as a directory (which I had manually fixed before by turning on case sensitivity for the u-boot directory in the relevant firmware directory).

TonyG

0 Kudos
1,725 Views
maxime_torrelli
Contributor II

Migrate your data within the file system of WSL. Otherwise the case is not working as expected.

0 Kudos