menu Thinking Null
Windows源代码编译
2020-10-04   编程(   2 条评论   2759 次阅读

https://rentry.co/9pgi2
https://boards.4channel.org/g/thread/78034674
Hidden git: https://noexit4237wjhu6v.onion

Windows XP/Server 2k3 Source

master branch is meant to hold untouched source code for referencing.
better to torrent then clone entire repo.

Best:

magnet:?xt=urn:btih :1a4e5b67060ff2bc8fe2de36a6c265c77f392a0c&dn=NOTREPACKED

REPACKED (about 40GB of useless shit):

magnet:?xt=urn:btih :cec41d87d329822ea9b05c4f6c0dff7d29514d59&dn=Microsoft%20leaked%20source%20code%20archive%5F2020-09-20

Windows Server 2003 (NT5 3790) build guide

Preparing Environment

  • Set date to 2003-08-01 (YYYY-MM-DD)
  • Extract source tree, in this guide we will assume C:\NT (if you wish for your binaries to match RTM as closely as possible, use D:\srv03rtm\NT)
  • Create desktop shortcut for %windir%\system32\cmd.exe /k C:\NT\tools\razzle.cmd free offline (see below for explanation) and change Start in to C:\NT
  • Open razzle window and execute these commands:

    • tools\CheckTestRoot.cmd
    • tools\CheckTestPCA.cmd
  • Manually import tools\driver.pfx certificate and private key (if asked for password, simply press Next without typing anything)
  • Apply patches (available below) to NT tree
  • Copy \public\internal\windows\lib\i386\directui.lib from XP source tree and place it in the same directory in 2K3 source tree

Building

  • You are now ready to attempt first build, execute commands:
  • nmake set_builddate set_buildnum set_buildname -f makefil0
  • perl tools\timebuild.pl -NOCLEANBUILD -NOPOSTBUILD -NOSYNC -NOSCORCH
  • Verify there are no errors, if any are present this might be due to race conditions
  • Run build /ZP again and ensure build.err is empty
  • Download missing.cmd and place it in tools; mount RTM CD and execute tools\missing.cmd (optionally, perform this step for every SKU)
  • Edit tools/postbuildscripts/pbuild.dat and comment out (;) the sxs_make_asms_cabs lines
  • Execute tools\postbuildscripts\sxs_make_asms_cabs.cmd single time to generate hivesxs.inf
  • Grab asms01.cab from ISO and put that into binaries tree, replacing the one that is present there
  • tools\postbuild.cmd (use -sku:{sku} if you want to process only specific one, expect errors if you ignore this and have skipped on missing.cmd optional step)

Getting ISO file

  • Download oscdimg.cmd and place it in tools; execute tools\oscdimg.cmd {sku} where {sku} is one of:

    • srv - Windows Server 2003 Standard Edition
    • sbs - Windows Server 2003 Small Business Edition
    • ads - Windows Server 2003 Enterprise Edition
    • per - Windows XP Home Edition
    • pro - Windows XP Professional

Patches

Following patches should be applied before building (some of them apply only for checked bits):

--- b\windows\core\cslpk\lpk\sources.inc
+++ a\windows\core\cslpk\lpk\sources.inc
@@ -58,6 +58,9 @@

 C_DEFINES=$(C_DEFINES) $(USER_C_DEFINES) -D_USER32_ -DUNICODE -DUSE_MIRRORING -DLANGPACK

+### usp debugging interface missing
+C_DEFINES=$(C_DEFINES) -DDBG=0
+
 DLLDEF=..\lpk.def

 SOURCES= ..\lpk.rc           \

Additions

Why build flags are necessary

  • Certain parts of code are missing but present in pre-built form, using -NOCLEANBUILD and -NOSCORCH ensures that they are not removed from the tree
  • -NOSYNC is most likely irrelevant here as it should be implied by offline in razzle.cmd

Removing timebomb

  • Comment out timebomb lines from tools/postbuildscripts\pbuild.dat before running postbuild for the first time (currently there is no guide to revert it)

Different build options

You can modify your razzle shortcut (or execute command manually inside C:\NT) to include (or remove) additional argument(s):

  • free - build 'free' bits (production, ommiting it will generated checked bits)
  • CkhKernel - build 'checked' (testing) kernel/hal/ntdll when building 'free' bits
  • no_opts - disable binary optimization (useful for debugging, but will most likely fail a full build, some code can't be built without optimization)
  • verbose - enable verbose execution of the build process
  • binaries_dir <basepath> - specifies custom output directory (default is binaries, the suffix added after . is non-customizable)

Other options are not described here, see razzle.cmd /? for details.

Creating fresh build

You can use tools\postbuild.cmd -full to create fresh package, however this has not been properly tested yet, expect the unexpected!

Original CD filenames

  • en_windows_server_2003_standard.iso (SHA256: ABBF36ED0BB107EC650BEC11892CE35DAD61DB083BE1E0A477CA86D8F420C46B)
  • to be filled

64-bit specific

list of tools that must be recompiled in order to build on x64

appendtool
bingen
build
cabbench
calchash
cat
chktrust
flist
gennt32t
gidl
hdivide
infparser
infutil2
makecat
mibcc
midlc
muirct
ntrelhash
pdbstr
preprocessor
rmtshare
shimdbc
symchk
symmake
symstore
tlist
updcat

TODO:

None

本篇文章未指定许可协议。

转载或引用本文时请遵守许可协议,注明出处。

发表评论
已有 2 条评论
textsms
account_circle
email
link
    ling ling
    June 1st, 2021 at 10:39 pm

    看完我是垃圾

      神必壬
      神必壬 博主
      June 1st, 2021 at 10:42 pm

      网上转载的,我也看不懂,,,还有一个编译过程视频的,需要可以给链接