> Date: Thu, 19 May 2022 19:36:50 +0100 > From: Robert Swindells <r...@fdy2.co.uk> > > I would like to import the source to some extra DRM drivers from Linux, > would do lima, panfrost and vc4. > > The layout that I'm using in my own tree is to put the GPL ones in a > sys/external/gpl2/drm2 tree that mirrors the existing bsd/drm2 tree. > > The lima sources apart from lima_regs.h are dual licenced so will put > them under bsd/drm2.
If lima_regs.h is actually GPL, then it needs to be reimplemented from scratch, cannot be just put in a directory called `gpl2' and included in non-GPL code -- annoying as that is for a file of register definitions. Alternatively, you could contact the author and see if they would be willing to release it under a permissive licence, or clarify that that was the original intent. Everything under sys/external/gpl2 needs to be done as an optionally loadable module, not statically linked into the kernel. > All files will be from the same v5.6-rc3 branch of Linux as the current > drm sources. > > Do I need to do a vendor import of this or just add the files? Yes, this absolutely must be vendored, and must have lima2netbsd and panfrost2netbsd scripts like radeon, nouveau, &c., to be run after the top-level drm prepare-import.sh to adapt a clean tree for import -- otherwise anything done here will be discarded on the next drm update. You should draft any work in git first (and generally do development on this in git like I do), with a vendor branch and vendor tag in git -- as far as git is concerned, these are just regular branches or tags but I keep a convention of labelling them with `vendor/' in: https://github.com/riastradh/netbsd-src The upstream files should be committed on the branch vendor/linux-drm (on top of the one in that git tree) in the appropriate subtree of src, and the commit should be tagged vendor/linux-drm-v5.6-rc3-nb1. The next step is tricky: you have to find the git commit corresponding to the cvs merge of the 5.6-rc3 drm, and use `git replace --graft' to make its parents be: (a) the parent in the regular cvs->git history, and (b) the commit tagged vendor/linux-drm-v5.6-rc3. I think the commit you have to do git-replace on is currently this one: commit 677dec6e0973de7db21722260f425a64696d5fec Author: riastradh <riastr...@netbsd.org> Date: Sat Dec 18 23:44:57 2021 +0000 Merge linux-drm-v5-6-rc3 Then you can `git merge vendor/linux-drm-v5.6-rc3-nb1' and the merge should apply cleanly. Mark the merge as the base point, say lima-base, and work on a branch, say lima. Later on, you can do the cvs import, and then git-cvsexportcommit everything in lima-base..lima on top of CVS, and the patches will generally all apply cleanly. You can do all this in git in a private tree that you can blow away and start over if you make mistakes. (I might have identified the cvs->git merge commit wrong, so it might take some playing around with git-replace.) All this is necessary to do a 3-way merge for the next drm update; updates without 3-way merges are effectively impossible and will invariably lead to throwing work out and starting over.