Before you read any further, the key thing here is that you need access to an AX 2012 environment. You need to use the 2012 environment as a midpoint in the process because only 2012 a) is supported by LCS Code Upgrade tool and b) can import xpo code. If you don't have access to a 2012 environment, then the following probably won't be helpful to you.
So here's the process:
Prepare the AX 2012 environment
When you use the LCS Code Upgrade tool, you import zip file containing a modelstore. (not a model!). If you're like me, you're really only looking to move a subset of customizations...not every last object in your old AX. The solution here is to use a 'vanilla' 2012 instance.
There are multiple ways to do this, but I did it by Uninstalling all models except the core sys/syp layer stuff. LCS Code upgrade will see all the core AX code in your model store, but just ignore it because it's all standard.
WARNING: Before you uninstall models, make sure you a) have a way to get this code back, b) realize that any data tables defined by uninstalled models (or fields) will be lost. In my case, I'm using a development environment with no valuable data. I exported the model store (see procedure below) BEFORE uninstalling any models...and later I'll re-import that model store so I retain all my code.
In 2012 you can see the installed models in Tools, Model management, Installed models
Back up your 2012 code
If you're going to uninstall models from the 2012 environment, you probably want some way to get them all back later. To
Uninstall unwanted models
I uninstalled VAR/CUS/USR layer models and all 3rd party (ISV) code.
To uninstall use Windows Powershell (run as Administrator) or AXUtil. (https://technet.microsoft.com/en-us/hh433514(v=ax.50))
Now your Installed models should look something like this:
Create a new model in 2012
Create a model with the same name as the model that you intend to use in D365
To do this, in AX 2012: Tools, Modules, Create new model.
Export your code from 4.0 or 2009 in an xpo.
Import your XPO code into 2012
Making sure that you're working in your new model (see lower right of AX screen), import your xpo code from your original environment like you normally would. The infolog that you get here can be helpful in making sure that you got all the objects that are referenced in the code. If you missed something, just import it into 2012 - no big deal.
Export the model store
Back in Powershell or AXUtil, export your model store which will contain the sys/syp core code and whatever you imported from your xpo.
The file that is created will be big - maybe 5GB - so make sure you have room on your drive. But it zips down quite a bit smaller - under 1GB. The zipped file is what you upload to LCS.
LCS Code Upgrade process
From this point on you'll be following the standard AX2012 -> D365 Code Upgrade process. Here's a good video overview: https://www.youtube.com/watch?v=M-AtR6ocYM8
One note on what the video covers: Each time you do the Code Upgrade process, you'll see a new folder created under Releases in Azure Dev Ops (or VS Team Explorer, Source Control explorer) as highlighted in the image below.
To complete the upgrade process you have to re-map your Visual Studio workspace (in Visual Studio: File, Source control, Advanced, Workspaces) to point to the Metadata and Projects folder that are contained in the folder that LCS just created.
Hope that helps! Have fun!