# $Id$
# Build a Bootable Windows XP disk with service pack 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=XP_SP1
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
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) 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)
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
SERVICE_PACK_TOUCH=$(SERVICE_PACK_ROOT).touch
VOLID_ISO_TOUCH=$(VOLID_ISO).touch
VOLID_TOUCH=$(VOLID).touch
WGET?=wget -N
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)\\ . /s /e /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 $@
# from
http://www.danilpremgi.com/nu2/pebuilder3032.zip
$(BBIE_ZIP):
$(WGET) http://www.danilpremgi.com/nu2/$(BBIE_ZIP) || \
$(WGET) http://65.108.230.150/downloads/mybootdisks_com/nu2/$(BBIE_ZIP) || \
$(WGET) http://nu2.digitalomaha.net/nu2files/$(BBIE_ZIP)
# $(WGET) http://www.nu2.mostlycreativeworkshop.com/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.danilpremgi.com/nu2/$@ || \
$(WGET) http://65.108.230.150/downloads/mybootdisks_com/nu2/$@ || \
$(WGET) http://nu2.digitalomaha.net/nu2files/$@
# $(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) $(BOOT_TOUCH) mkisofs.exe
cd $(CD_DIR) && \
../mkisofs.exe \
-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) \
$(BOOT_TOUCH) \
bbie.lic \
svcpack.log \
$(BOOT_DIR) \
$(SERVICE_PACK_ROOT) \
$(CD_DIR) \
$(BBIE_ZIP) \
$(PEBUILDER_ZIP)
clean: tidy
rm -fr $(VOLID_ISO_TOUCH) \
$(SERVICE_PACK_TOUCH) \
$(SERVICE_PACK_EXE) \
$(VOLID_ISO)
# bbie.exe
# cygwin1.dll
# mkisofs.exe