# $Id$
# Build a Bootable Windows XP disk with service pack and KB826939 rollup slipstreamed in
# Copyright (c) 2003-2004, Ross Smith. All rights reserved.
# requires:
# Cygwin: bash, chmod, cut, echo, grep, make, mkdir, rm, touch, unzip, wget
# optional:
# cdrecord
# Inspiration:
# http://www.windows-help.net/WindowsXP/winxp-sp1-bootcd.html
# See also:
# http://www.theeldergeek.com/slipstream_01.htm
# Windows drive letter for CD drive containing original Windows XP disk
CD ?=D:
# cdrecord device for the CD-R drive to burn the new disk (run 'cdrecord -scanbus' to discover)
CD_DEV ?=0,0,0
# Additional cdrecord options
CDRECORD_OPTS ?=
# Set to Y to wait until you press Enter before burning CD (CD and CD_DEV above refer to the same drive)
PAUSE ?=Y
# Volume ID of new disk (11 characters max)
# 12345678901
#VOLID=X1APCCP_EN
ifeq ('$(VOLID)', '')
#Get the volume ID from the CD volume label itself (the CD must be in the drive)
VOLID=$(shell cmd /c vol $(CD) | grep "Volume in" | cut -b 23-34)
endif
ifeq ('$(VOLID)', '')
$(error Please define the VOLID variable: VOLID=A_11CHAR_ID make)
endif
# Service Pack ID
SERVICE_PACK=sp1a
# Rollup ID
ROLLUP=KB826939
BBIE_VER=10
PEBUILDER_VER=3028
BBIE_ZIP=bbie$(BBIE_VER).zip
PEBUILDER_ZIP=pebuilder$(PEBUILDER_VER).zip
# Label to display after CD is burned
CD_LABEL=Windows XP $(VOLID) w/ $(SERVICE_PACK) \& $(ROLLUP) slipstreamed
SERVICE_PACK_ROOT=xp$(SERVICE_PACK)_en_x86
SERVICE_PACK_EXE=$(SERVICE_PACK_ROOT).exe
SERVICE_PACK_URL=http://download.microsoft.com/download/5/4/f/54f8bcf8-bb4d-4613-8ee7-db69d01735ed/$(SERVICE_PACK_EXE)
ROLLUP_ROOT=WindowsXP-$(ROLLUP)-x86-ENU
ROLLUP_EXE=$(ROLLUP_ROOT).exe
ROLLUP_URL=http://download.microsoft.com/download/d/8/0/d80dfc9d-fe92-4009-aa54-1cd00c880a20/$(ROLLUP_EXE)
CD_DIR=$(VOLID)_cd
I386=$(CD_DIR)/I386
SRVPACK_DIR=$(I386)/SRVPACK
BOOT_DIR=$(VOLID)_boot_image
BOOT_IMG=image1.bin
VOLID_ISO=$(VOLID).ISO
BOOT_TOUCH=$(BOOT_DIR).touch
PEBUILDER_TOUCH=$(PEBUILDER_ZIP).touch
ROLLUP_DOSNET_TOUCH=$(VOLID)_$(ROLLUP_ROOT)_dosnet.touch
ROLLUP_TOUCH=$(VOLID)_$(ROLLUP_ROOT).touch
ROLLUP_UPDATE_TOUCH=$(VOLID)_$(ROLLUP_ROOT)_update.touch
SERVICE_PACK_TOUCH=$(SERVICE_PACK_ROOT).touch
VOLID_ISO_TOUCH=$(VOLID_ISO).touch
VOLID_TOUCH=$(VOLID).touch
WGET?=wget -nv
BUILD_DIR?=$(shell pwd)
BUILD_DIR_WIN?=$(shell cygpath -w "$(BUILD_DIR)" | sed -e 's|\\|/|g')
include local.mak
.PHONY: all cdrecord clean tidy
all: cdrecord
$(VOLID_TOUCH):
mkdir -p $(CD_DIR)
-attrib -R $(CD_DIR) /S
cd $(CD_DIR) && \
xcopy $(CD)\\ . /e /h /r /v /y
touch $@
$(SERVICE_PACK_EXE):
$(WGET) $(SERVICE_PACK_URL)
chmod +x $@
$(SERVICE_PACK_TOUCH): $(SERVICE_PACK_EXE)
chmod +x $<
# Don't update if the disk already has SP1
if [ ! -e $(CD_DIR)/WIN51IP.SP1 ]; then \
$< /S:$(BUILD_DIR_WIN)\\$(CD_DIR) ; \
fi
touch $@
$(ROLLUP_EXE):
$(WGET) $(ROLLUP_URL)
chmod +x $@
$(ROLLUP_TOUCH): $(ROLLUP_EXE)
mkdir -p $(ROLLUP_ROOT)
chmod +x $<
$< /u /x:$(ROLLUP_ROOT)
touch $@
$(ROLLUP_DOSNET_TOUCH): $(VOLID_TOUCH)
echo>>$(I386)/DOSNET.INF
echo>>$(I386)/DOSNET.INF ntkrnlpa.exe
echo>>$(I386)/DOSNET.INF ntkrpamp.exe
echo>>$(I386)/DOSNET.INF
echo>>$(I386)/DOSNET.INF [OptionalSrcDirs]
echo>>$(I386)/DOSNET.INF svcpack
echo>>$(I386)/DOSNET.INF
touch $@
$(ROLLUP_UPDATE_TOUCH): $(VOLID_TOUCH) $(ROLLUP_TOUCH) $(ROLLUP_DOSNET_TOUCH)
attrib -r $(CD_DIR)\\I386\\*.*
cd $(I386) && \
rm -f ntdll.dll \
accwiz.ex_ \
crypt32.dl_ \
cryptsvc.dl_ \
hh.ex_ \
hhctrl.oc_ \
hhsetup.dl_ \
html32.cn_ \
itircl.dl_ \
itss.dl_ \
locator.ex_ \
magnify.ex_ \
migwiz.ex_ \
mrxsmb.sy_ \
msconv97.dl_ \
narrator.ex_ \
newdev.dl_ \
ntkrnlmp.ex_ \
ntoskrnl.ex_ \
ole32.dl_ \
osk.ex_ \
pchshell.dl_ \
raspptp.sy_ \
rpcrt4.dl_ \
rpcss.dl_ \
shdocvw.dl_ \
shell32.dl_ \
shmedia.dl_ \
srrstr.dl_ \
srv.sy_ \
SVCPACK.IN_ \
sysmain.sd_ \
urlmon.dl_ \
user32.dl_ \
win32k.sy_ \
winsrv.dl_ \
zipfldr.dl_
cp -p $(ROLLUP_ROOT)/sp2/*.* $(I386)
mkdir -p $(SRVPACK_DIR)
cp -p $(ROLLUP_ROOT)/sp2/update/*.cat $(SRVPACK_DIR)
cp -p $(ROLLUP_ROOT).exe $(SRVPACK_DIR)/q826939.exe
echo>$(I386)/SRVPACK.INF [Version]
echo>>$(I386)/SRVPACK.INF Signature="\$$Windows NT\$$"
echo>>$(I386)/SRVPACK.INF MajorVersion=5
echo>>$(I386)/SRVPACK.INF MinorVersion=1
echo>>$(I386)/SRVPACK.INF BuildNumber=2600
echo>>$(I386)/SRVPACK.INF [SetupData]
echo>>$(I386)/SVCPACK.INF CatalogSubDir="\i386\svcpack"
echo>>$(I386)/SVCPACK.INF [ProductCatalogsToInstall]
echo>>$(I386)/SVCPACK.INF KB826939.cat
echo>>$(I386)/SVCPACK.INF [SetupHotfixesToRun]
echo>>$(I386)/SVCPACK.INF q826939.exe /quiet /norestart /n
touch $@
# from
$(BBIE_ZIP):
$(WGET) http://www.nu2.mostlycreativeworkshop.com/nu2files/$(BBIE_ZIP) || \
$(WGET) http://www.danilpremgi.com/nu2/$(BBIE_ZIP) || \
$(WGET) http://nu2.digitalomaha.net/nu2files/$(BBIE_ZIP)
bbie.exe: $(BBIE_ZIP)
unzip -o $(BBIE_ZIP)
chmod +x bbie.exe
touch $@
$(BOOT_TOUCH): bbie.exe
mkdir -p $(BOOT_DIR)
cd $(BOOT_DIR) && \
../bbie.exe -b $(CD)
cd $(BOOT_DIR) && \
rm -f bootrecord.bin bootcatalog.bin
touch $@
# patched mkisofs from pebuilder
$(PEBUILDER_ZIP):
$(WGET) http://www.nu2.mostlycreativeworkshop.com/nu2files/$(PEBUILDER_ZIP) || \
$(WGET) http://www.danilpremgi.com/nu2/$(PEBUILDER_ZIP) || \
$(WGET) http://nu2.digitalomaha.net/nu2files/$(PEBUILDER_ZIP)
mkisofs.exe: $(PEBUILDER_ZIP)
unzip -o $(PEBUILDER_ZIP) $@
chmod +x $@
# -A ID, -appid ID Set Application ID
# -b FILE, -eltorito-boot FILE Set El Torito boot image name
# -D, -disable-deep-relocation Disable deep directory relocation (violates ISO9660)
# -hide GLOBFILE Hide ISO9660/RR file
# -l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names
# -o FILE, -output FILE Set output file name
# -relaxed-filenames Allow 7 bit ASCII except lower case characters (violates ISO9660)
# -sysid ID Set System ID
# -no-iso-translate Do not translate illegal ISO characters '~', '-' and '#' (violates ISO9660)
# -v, -verbose Verbose
# -V ID, -volid ID Set Volume ID
# -volset ID Set Volume set ID
# -no-emul-boot Boot image is 'no emulation' image
# -boot-load-size # Set numbers of load sectors
$(VOLID_ISO_TOUCH): $(VOLID_TOUCH) $(SERVICE_PACK_TOUCH) $(ROLLUP_UPDATE_TOUCH) $(BOOT_TOUCH) mkisofs.exe
chmod +x mkisofs.exe
cd $(CD_DIR) && \
../mkisofs.exe \
-v \
-iso-level 4 \
-volid "$(VOLID)" \
-A MKISOFS \
-sysid "DOS" \
-b "$(BOOT_IMG)" \
-no-emul-boot \
-boot-load-size 4 \
-hide "$(BOOT_IMG)" \
-hide "boot.catalog" \
-o "../$(VOLID_ISO)" \
"../$(BOOT_DIR)" \
.
touch $@
cdrecord: $(VOLID_ISO_TOUCH)
ifneq ('$(PAUSE)', '')
@echo
@echo Insert a blank CD-R/CD-RW/DVD±R/DVD±RW into the following drive
@-cdrecord --scanbus | grep "$(CD_DEV)" | cut -b 2-
@echo and press [Enter] to continue
@echo -e \\a
@read dummy
endif
cdrecord -dev=$(CD_DEV) -v $(CDRECORD_OPTS) $(VOLID_ISO)
@echo
@echo Please label this disk \"$(CD_LABEL)\"
tidy:
rm -fr $(VOLID_TOUCH) \
$(SERVICE_PACK_TOUCH) \
$(ROLLUP_UPDATE_TOUCH) \
$(ROLLUP_DOSNET_TOUCH) \
$(BOOT_TOUCH) \
bbie.lic \
svcpack.log \
$(BOOT_DIR) \
$(SERVICE_PACK_ROOT) \
$(ROLLUP_ROOT) \
$(CD_DIR) \
$(BBIE_ZIP) \
$(PEBUILDER_ZIP)
clean: tidy
rm -fr $(VOLID_ISO_TOUCH) \
$(SERVICE_PACK_TOUCH) \
$(ROLLUP_TOUCH) \
$(SERVICE_PACK_EXE) \
$(ROLLUP_EXE) \
$(VOLID_ISO)
# bbie.exe
# cygwin1.dll
# mkisofs.exe