ÃÑ ÆäÀÌÁö ¼ö : 3224

Àüü ÇÔ¼ö/¿ë¾î»çÀü
Facebook Joinc ±×·ì   Joinc QA »çÀÌÆ®



joinc´Â Firefox¿Í chrome¿¡¼­ Å×½ºÆ® Çß½À´Ï´Ù. IE¿¡¼­´Â Å×À̺íÀÌ ±úÁö°Å³ª À̹ÌÁö°¡ º¸ÀÌÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù. ƯÈ÷ ±¸±Û DocsÀ̹ÌÁöÀÇ °æ¿ì ¿¢¹Úó¸®µÉ ¼ö ÀÖ½À´Ï´Ù.
bzimage°¡ ¸¸µé¾îÁö´Â °úÁ¤ ÃßÀû-Makefile ºÐ¼®

2.3. bzimage°¡ ¸¸µé¾îÁö´Â °úÁ¤ ÃßÀû-Makefile ºÐ¼®

bzimage°¡ ¸¸µé¾îÁö´Â °úÁ¤À» »ìÆì º¸°í À̸¦ µû¶ó°¡¸é¼­ MakefileÀÇ ÀÚ¼¼ÇÑ ³»¿ëÀ» ¾Ë¾Æº»´Ù. Á¤È®ÇÑ °ÍÀº 2.4.2ÀýÀ» ÂüÁ¶Çϱ⠹ٶõ´Ù.

½ÃÀÛÀº ¹°·Ð $(topDIR)/Makefile·Î ºÎÅÍ ½ÃÀÛÇÑ´Ù.

Ä¿³Î makefileÀº ¸î ºÎºÐÀ¸·Î ³ª´­ ¼ö ÀÖ´Ù.

  1. ±âº» Á¤º¸ Á¤ÀÇ

  2. Ä¿³Î ¼³Á¤

  3. Ä¿³Î ¼Ò½º ÀÇÁ¸¼º ¸¸µé±â

  4. ¸ðµâ ¸¸µé±â

  5. Ä¿³Î ½ÇÇà ÆÄÀÏ ¸¸µé±â

  6. ¸ðµâ ¼³Ä¡Çϱâ

°¢ ºÎºÐÀÌ ¸íÈ®ÇÏ°Ô ±¸ºÐµÇ´Â °ÍÀº ¾Æ´ÏÁö¸¸ makeÀÇ µ¿ÀÛÀ» ÀÌÇØÇÏ´Â »ç¶÷À̶ó¸é ´ëÃæ ±¸ºÐÀ» Áö¾î ÀÌÇØÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ±¸ºÐÀº Ä¿³ÎÀ» ÄÄÆÄÀÏ ÇÏ´Â ÀýÂ÷¿¡ µû¶ó ³ª´« °ÍÀ¸·Î ÀÌÇØ ÇÏ¸é ½¬¿ï °ÍÀÌ´Ù. ÀϹÝÀûÀ¸·Î ¸¹ÀÌ ¾²ÀÌÁö ¾Ê´Â ºÎºÐÀº ³Ñ¾î°¡°í Áß¿äÇÑ ºÎºÐ¸¸À» ÀÚ¼¼È÷ ÀÌÇØÇÏÀÚ.

½ÃÀÛ¿¡ ¾Õ¼­ »ç¿ëµÇ´Â MakefileµéÀ» ¼³¸íÇØ ³õ´Â´Ù. ÀÌ°Í µéÀ» ÂüÁ¶·Î ÃßÀûÇØ³ª°¡¹Ç·Î ½ÃÀÛÇϱ⿡ ¾Õ¼­ Çѹø Âë ÈÈ¾î º¸´Â °Íµµ ÁÁÀ» °ÍÀÌ´Ù.

2.3.1. $(topDIR)/Makefile

¾Æ·¡ makefile¿¡ (1), (2)¿Í °°ÀÌ Ç¥½ÃµÈ °ÍÀº ¾Æ·¡ ÁÙ¿¡ ´ëÇÑ ¼³¸íÀ» ´Þ¾Æ ³õÀº °ÍÀ¸·Î MakefileÀÇ ³¡ ºÎºÐ¿¡ ºÙ¾î ÀÖ´Â ¼³¸íÀ» ÂüÁ¶Çذ¡¸é¼­ ºÐ¼®ÇϸéµÇ°Ú´Ù.

version = 2
patchlevel = 4
sublevel = 16
extraversion =

kernelrelease=$(veRSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)

(1)
arch := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)

(2)
kernelpath=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//")

(3)
config-shell := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
	  else if [ -x /bin/bash ]; then echo /bin/bash; \
	  else echo sh; fi ; fi)

(4)
topdir	:= $(shell /bin/pwd)

hpath   	= $(topdIR)/include
findhpath	= $(hpatH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net

(5)
hostcc  	= gcc
hostcflags	= -wall -Wstrict-prototypes -O2 -fomit-frame-pointer

(6)
cross-compile 	=

(7)
#
# include the make variables (CC, etc...)
#
as		= $(cross-coMPILE)as
ld		= $(cross-coMPILE)ld
cc		= $(cross-coMPILE)gcc
cpp		= $(cc) -e
ar		= $(cross-coMPILE)ar
nm		= $(cross-coMPILE)nm
strip		= $(cross-COMPILE)strip
objcopy		= $(crosS-COMPILE)objcopy
objdump		= $(crosS-COMPILE)objdump
makefiles	= $(topdIR)/.config
genksyms	= /sbin/genksyms
depmod		= /sbin/depmod
modflags	= -dmoduLE
cflags-kernel	=
perl		= perl

(8)
export	version paTCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
	config-shell topDIR HPATH HOSTCC HOSTCFLAGS CROSS-COMPILE AS LD CC \
	cpp ar nm strip OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL

all:	do-it-all

(9)
#
# make "config" the default target if there is no configuration file or
# "depend" the target if there is no top-level dependency information.
#
ifeq (.config,$(wildcard .config))
include .config
ifeq (.depend,$(wildcard .depend))
include .depend
do-it-all:	version vmlinux
else
(10)
configuration = depend
do-it-all:	depend
endif
else
(11)
configuration = config
do-it-all:	config
endif

(12)
#
# install-path specifies where to place the updated kernel and system map
# images.  uncomment if you want to place them anywhere other than root.
#
#export	install-paTH=/boot

(13)
#
# install-mod-path specifies a prefix to MODLIB for module directory
# relocations required by build roots.  This is not defined in the
# makefile but the arguement can be passed to make if needed.
#
modlib	:= $(instaLL-MOD-PATH)/lib/modules/$(KERNELRELEASE)
export modlib

#
# standard cflags
#
cppflags := -d--keRNEL-- -I$(HPATH)

cflags := $(cppflaGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
	  -fomit-frame-pointer -fno-strict-aliasing -fno-common
aflags := -d--asseMBLY-- $(CPPFLAGS)

(14)
#
# root-dev specifies the default root-device when making the image.
# this can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
# the default of fLOPPY is used by 'build'.
# this is i386 specific.
#
export root-dev = CURRENT

(15)
#
# if you want to preset the SVGA mode, uncomment the next line and
# set svga-mode to whatever number you want.
# set it to -dsvga-MODE=NORMAL-VGA if you just want the EGA/VGA mode.
# the number is the same as you would ordinarily press at bootup.
# this is i386 specific.
#
export svga-mode = -DSVGA-MODE=NORMAL-VGA

(16)
#
# if you want the RAM disk device, define this to be the size in blocks.
# this is i386 specific.
#
#export ramdisk = -DRAMDISK=512

(17)
core-files	=kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
networks	=net/network.o

libs		=$(topdir)/lib/lib.a
subdirs		=kernel drivers mm fs net ipc lib

(18)
drivers-n :=
drivers-y :=
drivers-m :=
drivers-  :=

drivers-$(config-aCPI) += drivers/acpi/acpi.o
drivers-$(config-pARPORT) += drivers/parport/driver.o
drivers-y += drivers/char/char.o \
	drivers/block/block.o \
	drivers/misc/misc.o \
	drivers/net/net.o \
	drivers/media/media.o
drivers-$(config-aGP) += drivers/char/agp/agp.o
drivers-$(config-dRM) += drivers/char/drm/drm.o
drivers-$(config-nUBUS) += drivers/nubus/nubus.a
drivers-$(config-iSDN) += drivers/isdn/isdn.a
drivers-$(config-nET-FC) += drivers/net/fc/fc.o
drivers-$(config-aPPLETALK) += drivers/net/appletalk/appletalk.o
drivers-$(config-tR) += drivers/net/tokenring/tr.o
drivers-$(config-wAN) += drivers/net/wan/wan.o
drivers-$(config-aRCNET) += drivers/net/arcnet/arcnetdrv.o
drivers-$(config-aTM) += drivers/atm/atm.o
drivers-$(config-iDE) += drivers/ide/idedriver.o
drivers-$(config-fC4) += drivers/fc4/fc4.a
drivers-$(config-sCSI) += drivers/scsi/scsidrv.o
drivers-$(config-fUSION-BOOT) += drivers/message/fusion/fusion.o
drivers-$(config-iEEE1394) += drivers/ieee1394/ieee1394drv.o

ifneq ($(config-cd-NO-IDESCSI)$(CONFIG-BLK-DEV-IDECD)$(CONFIG-BLK-DEV-SR)$(CONFIG-PARIDE-PCD),)
drivers-y += drivers/cdrom/driver.o
endif

drivers-$(config-sOUND) += drivers/sound/sounddrivers.o
drivers-$(config-pCI) += drivers/pci/driver.o
drivers-$(config-mTD) += drivers/mtd/mtdlink.o
drivers-$(config-pCMCIA) += drivers/pcmcia/pcmcia.o
drivers-$(config-nET-PCMCIA) += drivers/net/pcmcia/pcmcia-net.o
drivers-$(config-nET-WIRELESS) += drivers/net/wireless/wireless-net.o
drivers-$(config-pCMCIA-CHRDEV) += drivers/char/pcmcia/pcmcia-char.o
drivers-$(config-dIO) += drivers/dio/dio.a
drivers-$(config-sBUS) += drivers/sbus/sbus-all.o
drivers-$(config-zORRO) += drivers/zorro/driver.o
drivers-$(config-fC4) += drivers/fc4/fc4.a
drivers-$(config-aLL-PPC) += drivers/macintosh/macintosh.o
drivers-$(config-mAC) += drivers/macintosh/macintosh.o
drivers-$(config-iSAPNP) += drivers/pnp/pnp.o
drivers-$(config-sGI-IP22) += drivers/sgi/sgi.a
drivers-$(config-vT) += drivers/video/video.o
drivers-$(config-pARIDE) += drivers/block/paride/paride.a
drivers-$(config-hAMRADIO) += drivers/net/hamradio/hamradio.o
drivers-$(config-tC) += drivers/tc/tc.a
drivers-$(config-uSB) += drivers/usb/usbdrv.o
drivers-$(config-iNPUT) += drivers/input/inputdrv.o
drivers-$(config-i2O) += drivers/message/i2o/i2o.o
drivers-$(config-iRDA) += drivers/net/irda/irda.o
drivers-$(config-i2C) += drivers/i2c/i2c.o
drivers-$(config-pHONE) += drivers/telephony/telephony.o
drivers-$(config-mD) += drivers/md/mddev.o
drivers-$(config-bLUEZ) += drivers/bluetooth/bluetooth.o
drivers-$(config-hOTPLUG-PCI) += drivers/hotplug/vmlinux-obj.o

(19)
drivers := $(driveRS-y)

(20)
# files removed with 'make clean'
clean-files = \
	kernel/ksyms.lst include/linux/compile.h \
	vmlinux system.map \
	.tmp* \
	drivers/char/consolemap-deftbl.c drivers/video/promcon-tbl.c \
	drivers/char/conmakehash \
	drivers/char/drm/*-mod.c \
	drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist \
	drivers/zorro/devlist.h drivers/zorro/gen-devlist \
	drivers/sound/bin2hex drivers/sound/hex2hex \
	drivers/atm/fore200e-mkfirm drivers/atm/{pca,sba}*{.bin,.bin1,.bin2} \
	drivers/scsi/aic7xxx/aicasm/aicasm-gram.c \
	drivers/scsi/aic7xxx/aicasm/aicasm-scan.c \
	drivers/scsi/aic7xxx/aicasm/y.tab.h \
	drivers/scsi/aic7xxx/aicasm/aicasm \
	drivers/scsi/53c700-mem.c \
	net/khttpd/make-times-h \
	net/khttpd/times.h \
	submenu*
# directories removed with 'make clean'
clean-dirs = \
	modules

(21)
# files removed with 'make mrproper'
mrproper-files = \
	include/linux/autoconf.h include/linux/version.h \
	drivers/net/hamradio/soundmodem/sm-tbl-{afsk1200,afsk2666,fsk9600}.h \
	drivers/net/hamradio/soundmodem/sm-tbl-{hapn4800,psk4800}.h \
	drivers/net/hamradio/soundmodem/sm-tbl-{afsk2400-7,afsk2400-8}.h \
	drivers/net/hamradio/soundmodem/gentbl \
	drivers/sound/*-boot.h drivers/sound/.*.boot \
	drivers/sound/msndinit.c \
	drivers/sound/msndperm.c \
	drivers/sound/pndsperm.c \
	drivers/sound/pndspini.c \
	drivers/atm/fore200e-*-fw.c drivers/atm/.fore200e-*.fw \
	.version .config* config.in config.old \
	scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp \
	scripts/lxdialog/*.o scripts/lxdialog/lxdialog \
	.menuconfig.log \
	include/asm \
	.hdepend scripts/mkdep scripts/split-include scripts/docproc \
	$(topdir)/include/linux/modversions.h \
	kernel.spec

# directories removed with 'make mrproper'
mrproper-dirs = \
	include/config \
	$(topdir)/include/linux/modules

(22)
include arch/$(arcH)/Makefile

(23)
export	cppflags cFLAGS AFLAGS

export	networks dRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS

(24)
.s.s:
	$(cpp) $(aflags) -traditional -o $*.s $<.s.o:
	$(cc) $(aflags) -traditional -c -o $*.o $<
version: dummy
	@rm -f include/linux/compile.h

boot: vmlinux
	@$(make) cflags="$(CFLAGS) $(CFLAGS-KERNEL)" -C arch/$(ARCH)/boot

(25)
vmlinux: include/linux/version.h $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
	$(ld) $(linkflagS) $(HEAD) init/main.o init/version.o \
		--start-group \
		$(core-files) \
		$(drivers) \
		$(networks) \
		$(libs) \
		--end-group \
		-o vmlinux
	$(nm) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map

(26)
symlinks:
	rm -f include/asm
	( cd include ; ln -sf asm-$(ARCH) asm)
	@if [ ! -d include/linux/modules ]; then \
		mkdir include/linux/modules; \
	fi

(27)
oldconfig: symlinks
	$(config-shell) scripts/Configure -d arch/$(ARCH)/config.in

xconfig: symlinks
	$(make) -c scripts kconfig.tk
	wish -f scripts/kconfig.tk

menuconfig: include/linux/version.h symlinks
	$(make) -c scripts/lxdialog all
	$(config-shell) scripts/Menuconfig arch/$(ARCH)/config.in

config: symlinks
	$(config-shell) scripts/Configure arch/$(ARCH)/config.in

include/config/marKER: scripts/split-include include/linux/autoconf.h
	scripts/split-include include/linux/autoconf.h include/config
	@ touch include/config/MARKER

(28)
linuxsubdirs: $(patsubst %, -dir-%, $(SUBDIRS))

(29)
$(patsubst %, -dir-%, $(SUBDIRS)) : dummy include/linux/version.h include/config/MARKER
	$(make) cflags="$(CFLAGS) $(CFLAGS-KERNEL)" -C $(patsubst -dir-%, %, $@)

$(topdir)/include/linux/version.h: include/linux/version.h
$(topdir)/include/linux/compile.h: include/linux/compile.h

newversion:
	. scripts/mkversion > .tmpversion
	@mv -f .tmpversion .version

(30)
include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
	@echo -n \#define UTS-VERSION \"\#`cat .version` > .ver
	@if [ -n "$(confIG-SMP)" ] ; then echo -n " SMP" >> .ver; fi
	@if [ -f .name ]; then  echo -n \-`cat .name` >> .ver; fi
	@echo ' '`date`'"' >> .ver
	@echo \#define lINUX-COMPILE-TIME \"`date +%T`\" >> .ver
	@echo \#define lINUX-COMPILE-BY \"`whoami`\" >> .ver
	@echo \#define lINUX-COMPILE-HOST \"`hostname`\" >> .ver
	@if [ -x /bin/dnsdomainname ]; then \
	   echo \#define LINUX-COMPILE-DOMAIN \"`dnsdomainname`\"; \
	 elif [ -x /bin/domainname ]; then \
	   echo \#define LINUX-COMPILE-DOMAIN \"`domainname`\"; \
	 else \
	   echo \#define LINUX-COMPILE-DOMAIN ; \
	 fi >> .ver
	@echo \#define lINUX-COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
	@mv -f .ver $@

(31)
include/linux/version.h: ./Makefile
	@echo \#define uTS-RELEASE \"$(KERNELRELEASE)\" > .ver
	@echo \#define lINUX-VERSION-CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
	@echo '#define kERNEL-VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >> .ver
	@mv -f .ver $@

init/version.o: init/version.c include/linux/compile.h include/config/MARKER
	$(cc) $(cflags) $(CFLAGS-KERNEL) -DUTS-MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c

(32)
init/main.o: init/main.c include/config/MARKER
	$(cc) $(cflags) $(CFLAGS-KERNEL) $(PROFILING) -c -o $*.o $<
(33)
fs lib mm ipc kernel drivers net: dummy
	$(make) cflags="$(CFLAGS) $(CFLAGS-KERNEL)" $(subst $@, -dir-$@, $@)

(34)
# emacs, vi¿ë tag¸¦ ¸¸µç´Ù.
tags: dummy
	etags `find include/asm-$(ARCH) -name '*.h'`
	find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs etags -a
	find $(subdirs) init -name '*.[ch]' | xargs etags -a

# exuberant ctags works better with -I
tags: dummy
	ctagsf=`ctags --version | grep -i exuberant >/dev/null && echo "-I --initdata,--exitdata,EXPORT-SYMBOL,EXPORT-SYMBOL-NOVERS"`; \
	ctags $$ctagsf `find include/asm-$(ARCH) -name '*.h'` && \ find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
	find $(subdirs) init -name '*.[ch]' | xargs ctags $$CTAGSF -a

ifdef config-modulES
ifdef config-modveRSIONS
modflags += -dmodvERSIONS -include $(HPATH)/linux/modversions.h
endif

(35)
.phony: modules
modules: $(patsubst %, -mod-%, $(SUBDIRS))

.phony: $(patsubst %, -mod-%, $(SUBDIRS))
$(patsubst %, -mod-%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER
	$(make) -c $(patsubst -mod-%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING-MODULES=1 modules

.phony: modules-install
modules-install: -modinst- $(patsubst %, -modinst-%, $(SUBDIRS)) -modinst-post

.phony: -modinst-
-modinst-:
	@rm -rf $(modlib)/kernel
	@rm -f $(modlib)/build
	@mkdir -p $(modlIB)/kernel
	@ln -s $(topdir) $(MODLIB)/build

(36)
# if system.map exists, run depmod.  This deliberately does not have a
# dependency on system.map since that would run the dependency tree on
# vmlinux.  this depmod is only for convenience to give the initial
# boot a modules.dep even before / is mounted read-write.  However the
# boot script depmod is the master version.
ifeq "$(strip $(inSTALL-MOD-PATH))" ""
depmod-opts	:=
else
depmod-opts	:= -b $(INSTALL-MOD-PATH) -r
endif
.phony: -modinst-post
-modinst-post: -modinst-post-pcmcia
	if [ -r system.map ]; then $(DEPMOD) -ae -F System.map $(depmod-opts) $(KERNELRELEASE); fi

# backwards compatibilty symlinks for people still using old versions
# of pcmcia-cs with hard coded pathnames on insmod.  Remove
# -modinst-post-pcmcia for kernel 2.4.1.
.phony: -modinst-post-pcmcia
-modinst-post-pcmcia:
	cd $(modlib); \
	mkdir -p pcmcia; \
	find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{} pcmcia

.phony: $(patsubst %, -modinst-%, $(SUBDIRS))
$(patsubst %, -modinst-%, $(SUBDIRS)) :
	$(make) -c $(patsubst -modinst-%, %, $@) modules-install

# modules disabled....

else
modules modules-install: dummy
	@echo
	@echo "the present kernel configuration has modules disabled."
	@echo "type 'make config' and enable loadable module support."
	@echo "then build a kernel with module support enabled."
	@echo
	@exit 1
endif

clean:	archclean
	find . \( -name '*.[oas]' -o -name core -o -name '.*.flags' \) -type f -print \
		| grep -v lxdialog/ | xargs rm -f
	rm -f $(clean-fiLES)
	rm -rf $(clean-dIRS)
	$(make) -c documentation/DocBook clean

mrproper: clean archmrproper
	find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f
	rm -f $(mrproper-FILES)
	rm -rf $(mrpropeR-DIRS)
	$(make) -c documentation/DocBook mrproper

(37)
distclean: mrproper
	rm -f core `find . \( -not -type d \) -and \
		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
		-o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tags

backup: mrproper
	cd .. && tar cf - linux/ | gzip -9 > backup.gz
	sync

sgmldocs: 
	chmod 755 $(topdIR)/scripts/docgen
	chmod 755 $(topdIR)/scripts/gen-all-syms
	chmod 755 $(topdIR)/scripts/kernel-doc
	$(make) -c $(topDIR)/Documentation/DocBook books

psdocs: sgmldocs
	$(make) -c documentation/DocBook ps

pdfdocs: sgmldocs
	$(make) -c documentation/DocBook pdf

htmldocs: sgmldocs
	$(make) -c documentation/DocBook html

sums:
	find . -type f -print | sort | xargs sum > .SUMS

dep-files: scripts/mkdep archdep include/linux/version.h
	scripts/mkdep -- init/*.c > .depend
	scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
	$(make) $(patsubst %,-sfdep-%,$(SUBDIRS)) -FASTDEP-ALL-SUB-DIRS="$(SUBDIRS)"
ifdef config-modveRSIONS
	$(make) update-modverfile
endif

ifdef config-modveRSIONS
modverfile := $(toPDIR)/include/linux/modversions.h
else
modverfile :=
endif
export	modverfile

depend dep: dep-files

checkconfig:
	find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkconfig.pl

checkhelp:
	find * -name [cc]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.pl

checkincludes:
	find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl

ifdef configuratioN
..$(configuration):
	@echo
	@echo "you have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
	@echo
	$(make) $(configURATION)
	@echo
	@echo "successful. Try re-making (ignore the error that follows)"
	@echo
	exit 1

#dummy: ..$(configURATION)
dummy:

else

dummy:

endif

(38)
include rules.make

(39)
#
# this generates dependencies for the .h files.
#

scripts/mkdep: scripts/mkdep.c
	$(hostcc) $(hostCFLAGS) -o scripts/mkdep scripts/mkdep.c

scripts/split-include: scripts/split-include.c
	$(hostcc) $(hostCFLAGS) -o scripts/split-include scripts/split-include.c

(40)
#
# rpm target
#
#	if you do a make spec before packing the tarball you can rpm -ta it
#
spec:
	. scripts/mkspec > kernel.spec

#
#	build a tar ball, generate an rpm from it and pack the result
#	there arw two bits of magic here
#	1) the use of /. to avoid tar packing just the symlink
#	2) removing the .dep files as they have source paths in them that
#	   will become invalid
#
rpm:	clean spec
	find . \( -size 0 -o -name .depend -o -name .hdepend \) -type f -print | xargs rm -f
	set -e; \
	cd $(topdir)/.. ; \
	ln -sf $(topdir) $(KERNELPATH) ; \
	tar -cvz --exclude CVS -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
	rm $(kernelpath) ; \
	cd $(topdir) ; \
	. scripts/mkversion > .version ; \
	rpm -ta $(topdir)/../$(KERNELPATH).tar.gz ; \
	rm $(topdir)/../$(KERNELPATH).tar.gz
			
(1)
arch´Â ¾Æ·¡¿Í °°ÀÌ unameÀ¸·Î ¾ò¾îÁö´Â ¾ÆÅ°ÅØÃĸ¦ ÁöĪÇÏ´Â °ªÀ» °®´Â´Ù. intel °è¿­¿¡¼± i386ÀÌ µÇ°í ARM °è¿­¿¡¼± armÀÌ µÈ´Ù.
(2)
kernelPATH´Â kernel-2.4.16ÀÌ µÈ´Ù.
(3)
ÇöÀç »ç¿ë ÁßÀÎ shellÀ» ¾Ë¾Æ³½´Ù.
(4)
topdirÀº Ä¿³Î ¼Ò½º Äڵ尡 µé¾îÀÖ´Â ÃÖ»óÀ§ µð·ºÅ丮
(5)
host°¡ ºÙÀº °ÍÀº Ä¿³ÎÀÌ cross compile µÇ¼­ ´Ù¸¥ ¾ÆÅ°ÅØÃÄ¿ë ¹ÙÀ̳ʸ®¸¦ ¸¸µé ¼öµµ Àֱ⠶§¹®¿¡ ½ÇÁ¦ Ä¿³ÎÀ» ±¸¼ºÇÏ´Â ÄÚµå ¿Ü¿¡ Ä¿³ÎÀ» ¸¸µé±â À§ÇØ ÇÊ¿äÇÑ ¸î ¸î ÇÁ·Î±×·¥À» È£½ºÆ® »ó¿¡¼­ µ¹¸®±â À§ÇÑ ÄÄÆÄÀÏ·¯¸¦ ÁöÁ¤ ÇÏ´Â °ÍÀÌ´Ù.
(6)
º¸ÅëÀÇ °æ¿ì HOST¿Í TARGETÀÌ °°À¸¸é CROSS-COMPILE¿¡ ¾Æ¹« °Íµµ ¾øÀ¸³ª targetÀÌ ´Ù¸£¸é ¿©±â¿¡ ÄÄÆÄÀÏ·¯ÀÇ prefix¸¦ Àû¾îÁà¾ßÇÑ´Ù. ¿¹¸¦ µé¾î PDA¿¡ ¸¹ÀÌ »ç¿ëµÇ´Â arm processor¸¦ TARGETÀ¸·ÎÇÑ °æ¿ì¿£ cross-COMPILE = arm-linux- ¿Í °°ÀÌ µÈ´Ù.
(7)
À§¿¡¼­ Á¤ÀÇÇÑ CROSS-COMPILEÀÌ ÄÄÆÄÀÏ·¯ µîÀÇ prefix·Î ¾²À̴µ¥ arm processorÀÇ °æ¿ì¿£ CC = arm-linux-gcc ¿Í °°ÀÌ µÈ´Ù.
(8)
¿©±â ±îÁö Á¤ÀÇµÈ º¯¼öµéÀº Ä¿³Î ÄÄÆÄÀÏ Àü¹Ý¿¡ »ç¿ëµÉ °ÍµéÀ̹ǷΠ¾Æ·¡¿Í °°ÀÌ ÇØ¼­ °¢ µð·ºÅ丮 µî¿¡ µé¾îÀÖ´Â Makefile·Î °ªÀ» Àü´ÞÇØ ÁØ´Ù.
(9)
¸®´ª½º Ä¿³ÎÀº ÄÄÆÄÀÏ Àü¿¡ ¹Ýµå½Ã ¼³Á¤/ÀÇÁ¸¼º¼³Á¤ÀÌ µÇ¾îÀÖ¾î¾ß ÇϹǷΠ¾î´À °æ¿ìµç µÎ ÀýÂ÷¸¦ °Ë»çÇÑ´Ù. ¸ÕÀú .config°¡ ÀÖ´Ù´Â °ÍÀº Ä¿³Î ¼³Á¤ÀÌ µÈ »óŸ¦ ÀǹÌÇϰí .depend´Â ÀÇÁ¸¼º¼³Á¤ÀÌ ³¡³­ °ÍÀ» ÀǹÌÇÑ´Ù.
(10)
.config´Â ÀÖÁö¸¸ .depend´Â ¾ø´Â °æ¿ì
(11)
.config°¡ ¾ø´Â °æ¿ì¿£ Ä¿³Î ¼³Á¤À» ¸ÕÀúÇϵµ·Ï ÇÑ´Ù.
(12)
Ä¿³Î ÄÄÆÄÀÏÀÌ ³¡³ª°í ¼³Ä¡µÉ µð·ºÅ丮¸¦ ÁöÁ¤ÇÑ´Ù. º¸ÅëÀº »ç¿ëµÇÁö ¾Ê´Â´Ù.
(13)
moduleÀÌ ¼³Ä¡µÉ µð·ºÅ丮¸¦ ÁöÁ¤ÇÑ´Ù. º¸ÅëÀº /lib/modules/2.4.16 °ú °°À̵ȴÙ.
(14)
i386 ¾ÆÅ°ÅØÃÄ¿¡¼­ ·çÆ® µð¹ÙÀ̽º¸¦ ÁöÁ¤ÇÑ´Ù. currenT´Â Ä¿³Î ÄÄÆÄÀÏ ÇÒ ´ç½ÃÀÇ root device¸¦ ÀǹÌÇÑ´Ù.
(15)
i386 ¾ÆÅ°ÅØÃÄ¿¡¼­ ÃÊ±â ºÎÆÃ½ÃÀÇ È­¸é ¸ðµå¸¦ ¼³Á¤ÇÑ´Ù.
(16)
i386¿¡¼­ ·¥µð½ºÅ©°¡ ÇÊ¿äÇÑ °æ¿ì »ç¿ëÇÑ´Ù.
(17)
core-fILES´Â ¸®´ª½º Ä¿³ÎÀ» ÀÌ·ç´Â ±Ù°£ÀÌ µÇ´Â ¸î ¸î ºÎºÐÀ» ³ªÅ¸³½´Ù. ¸®´ª½º Ä¿³ÎÀº ¾Æ·¡¿Í °°ÀÌ kernel, drivers, mm, fs, ipc, network, lib·Î ±¸ºÐµÈ´Ù°í º¼¼ö ÀÖ´Ù.
(18)
Ä¿³Î ¼³Á¤ÇÒ ¶§ ¾î¶² ±â´ÉÀ» yes, no, module·Î ¼³Á¤ÇÒ ¼ö Àִµ¥ yes·ÎÇϸé driverS-y¿¡, no´Â DRIVERS-n¿¡, moduleÀº DRIVERS-m¿¡ ¸ðÀÌ°Ô µÈ´Ù.

¿¹¸¦ µé¾î ACPI ±â´ÉÀ» »ç¿ëÇÏÁö ¾Ê´Â´Ù°í ÇßÀ» °æ¿ì¿£ ¾Æ·¡ ÁÙÀÌ driverS- += drivers/acpi/acpi.o°¡ µÈ´Ù. .configÀÇ ³»¿ëÀ» Çѹø Àо¸é ±Ý¹æ ÀÌÇØµÉ °ÍÀÌ´Ù.

(19)
½ÇÁ¦ Ä¿³Î¿¡ Æ÷ÇԵǴ µå¶óÀ̹ö´Â ¸ðµÎ DRIVERS¿¡ ±â·ÏµÈ´Ù.
(20)
make clean ÇßÀ» ¶§ Áö¿öÁö´Â fileµéÀ» ÁöÁ¤ÇÑ´Ù. cleanÀº object µîÀ» Áö¿ï »Ó Ä¿³Î ¼³Á¤ µîÀº Áö¿ìÁö ¾Ê´Â´Ù.
(21)
mrproper´Â ¼¼ÆÃ±îÁöµµ Áö¿ö¹ö¸®°í ¿ÏÀüÈ÷ ÃʱâÈ­ ½ÃÄѹö¸°´Ù.
(22)
¸®´ª½º Ä¿³ÎÀº ¿©·¯ Á¾·ùÀÇ Å¸ÄÏÀ» Áö¿øÇϹǷΠóÀ½ Makefile¿¡¼­ È®ÀÎÇÑ ¾ÆÅ°ÅØÃ³¿¡ µû¸¥ MakefileÀ» ÀÐ¾î »ç¿ëÇÏ°Ô µÈ´Ù. make bzImage µîÀ» ÇßÀ» ¶§ »ç¿ëµÇ´Â MakefileÀº ¿©±â¼­ include µÈ´Ù.
(23)
ÇÊ¿äÇÑ Ç÷¡±×¸¦ export ÇØ¼­ ÇÏÀ§ µð·ºÅ丮 µî¿¡¼­ make ÇÒ ¶§µµ ¿©±â¿¡¼­ Àû¿ëµÈ »çÇ×µéÀÌ °°ÀÌ Àû¿ëµÉ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
(24)
¾î¼Àºí¸® ÄÚµå ÄÄÆÄÀÏ ¹æ¹ýÀ» ÁöÁ¤
(25)
ÄÄÆÄÀÏµÈ Ä¿³ÎÀÌ ÀÏÂ÷ÀûÀ¸·Î Çϳª·Î ¹¶ÃÄ vmlinux¸¦ ¸¸µé¾î³½´Ù. ÀÌ °ÍÀ» ¾ÐÃàÇÏ°í ºÎÆÃ¿¡ °ü°èµÈ Äڵ带 µ¡ºÙ¿©ÁÖ¸é Ä¿³ÎÀÌ ¿Ï¼ºµÈ´Ù.
(26)
include µð·ºÅ丮 ³»ÀÇ ½Éº¼¸¯ ¸µÅ©¸¦ ¼³Á¤ÇÑ´Ù.
(27)
Ä¿³Î ¼¼ÆÃÇÏ´Â ¹æ¹ý¿¡ µû¶ó ¼³Á¤¿¡ ÇÊ¿äÇÑ ÇÁ·Î±×·¥À» ¸¸µé°í ¼³Á¤À» ½ÃÀÛÇÑ´Ù.
(28)
linuxsubdirs´Â SUBDIRS¿¡ Á¤ÀÇµÈ °Íµé¿¡¼­ ¾Õ¿¡ -dir-À» ºÙ¿© »õ·Î¿î À̸§À» Çϳª¾¿ ¸¸µé¾î³½´Ù.

patsubst´Â $(patsubst PATTERN, REPLACEMENT, TEXT)ÀÇ Çü½ÄÀ¸·Î TEXT¿¡¼­ patterN°ú ÀÏÄ¡ÇÏ´Â ºÎºÐÀ» REPLACEMENT·Î ±³Ã¼ÇÑ´Ù.

(29)
°¢ ÇÏÀ§ µð·ºÅ丮¸¦ make ÇÑ´Ù. patsubst¿¡ ÀÇÇØ ½ÇÁ¦ µð·ºÅ丮·Î À̵¿ÇÏ°Ô µÈ´Ù.
(30)
ÄÄÆÄÀÏÇÑ ½Ã°£, ´©°¡ Çߴ°¡, gcc ¹öÀü µîÀÌ ±â·ÏµÈ´Ù. ³»¿ëÀº ¾Æ·¡¿Í °°´Ù.

#define uts-versioN "#11 2002. 01. 25. (±Ý) 16:35:16 KST"
#define linux-compILE-TIME "16:35:16"
#define linux-compILE-BY "root"
#define linux-compILE-HOST "halite"
#define linux-compILE-DOMAIN ""
#define linux-compILER "gcc version 2.95.3 20010315 (release)"

(31)
include/linux/version.h´Â ÇöÀç ÄÄÆÄÀÏ µÉ ¸®´ª½º Ä¿³ÎÀÇ ¹öÀü Á¤º¸¸¦ ´ã´Â Çì´õ ÆÄÀÏÀÌ°í ¾Æ·¡ ½ºÅ©¸³Æ®¿¡ ÀÇÇØ ¸¸µé¾îÁø´Ù. ³»¿ëÀº ¾Æ·¡ 3ÁÙ°ú °°´Ù.

# #define uts-releASE "2.4.16"
# #define linux-veRSION-CODE 132112
# #define kernel-vERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

(32)
main.c¿£ start-kernel()ÀÌ µé¾îÀÖ°í ÀÌ ÇÔ¼ö´Â LILOµî¿¡ ÀÇÇØ ¸Þ¸ð¸®¿¡ ¿Ã·ÁÁø Ä¿³ÎÀÌ ºÒ¸®°ÔµÇ´Â ½ÃÀÛ À§Ä¡´Ù.
(33)
ÇÏÀ§ µð·ºÅ丮´Â À§¿¡ Á¤ÀÇµÈ ÇÏÀ§ µð·ºÅ丮 make ¹æ¹ý¿¡ µû¶ó make µÈ´Ù. Áï $(patsubst %, -dir-%, $(SUBDIRS))¿¡ ÀÇÇØ make µÈ´Ù.
(34)
emacs, vi¿ë tag¸¦ ¸¸µç´Ù.
(35)
module·Î ÁöÁ¤µÈ ³ðµéÀ» ´Ù ¸¸µé¾îÁØ´Ù.

.phony¸¦ »ç¿ëÇϸé Á¤ÀÇµÈ À̸§ÀÌ fileÀÌ ¾Æ´ÔÀ» ¾Ë·ÁÁÖ°í ÆÛÆ÷¸Õ½º¸¦ ¿Ã·ÁÁØ´Ù. ÀÚ¼¼ÇÑ °ÍÀº 'info make'¸¦ ÇØ¼­ ÂüÁ¶ ¹Ù¶õ´Ù.

(36)
Ä¿³ÎÀ» ÄÄÆÄÀÏÇÒ ¶§ System.mapÀÌ ¸¸µé¾îÁö´Âµ¥ ÀÌ°Ô Á¸ÀçÇÏ´Â °æ¿ì moduleÀÇ dependency¸¦ ¸¸µé¾îÁØ´Ù.
(37)
distcleanÀº ÇöÀç Ä¿³Î ¹öÀü °³¹ßÀ» ³¡³»°í releaseÇÏ·ÁÇÒ ¶§ ½ÇÇàÇÑ´Ù.
(38)
¸®´ª½º Ä¿³ÎÀº ¸¹Àº ÇÏÀ§ µð·ºÅ丮°¡ ÀÖ°í ¿©±â¿¡ °¢°¢ÀÇ MakefileÀÌ Á¸ÀçÇϴµ¥ °øÅëÀ¸·Î »ç¿ëµÉ ¼ö ÀÖ´Â °ÍÀ»À» ¸ð¾Æ Rules.make·Î ¸¸µé°í À̸¦ »ç¿ëÇÑ´Ù.
(39)
Ä¿³Î ¼³Á¤À» ¸¶Ä£ ÈÄ Çì´õ¿Í ¼Ò½º»çÀÌÀÇ ÀÇÁ¸°ü°è¸¦ ¸¸µé¾îÁÖ´Â ½ÇÇà ÆÄÀÏÀ» ¸¸µç´Ù.
(40)
rpm ¹èÆ÷¿ë spec ÆÄÀϰú rpm ÆÄÀÏÀ» ¸¸µç´Ù.

2.3.2. $(topDIR)/arch/i386/Makefile

(1)			
#
# i386/makefile
#
# this file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
#
# this file is subject to the terms and conditions of the GNU General Public
# license.  see the file "COPYING" in the main directory of this archive
# for more details.
#
# copyright (c) 1994 by Linus Torvalds
#
# 19990713  artur Skawina <skawina@geocities.com>
#           added '-march' and '-mpreferred-stack-boundary' support
#

(2)			
ld=$(cross-compile)ld -m elf-i386
objcopy=$(cross-coMPILE)objcopy -O binary -R .note -R .comment -S
ldflags=-e stext
linkflags =-t $(toPDIR)/arch/i386/vmlinux.lds $(LDFLAGS)

cflags += -pipe

(3)
# prevent gcc from keeping the stack 16 byte aligned
cflags += $(shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi)

ifdef config-m386
cflags += -march=i386
endif

ifdef config-m486
cflags += -march=i486
endif

ifdef config-m586
cflags += -march=i586
endif

ifdef config-m586tSC
cflags += -march=i586
endif

ifdef config-m586mMX
cflags += -march=i586
endif

ifdef config-m686
cflags += -march=i686
endif

ifdef config-mpentIUMIII
cflags += -march=i686
endif

ifdef config-mpentIUM4
cflags += -march=i686
endif

(4)
ifdef config-mk6
cflags += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
endif

(5)
ifdef config-mk7
cflags += $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; else echo "-march=i686 -malign-functions=4"; fi) 
endif

ifdef config-mcrusOE
cflags += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
endif

ifdef config-mwincHIPC6
cflags += -march=i586
endif

ifdef config-mwincHIP2
cflags += -march=i586
endif

ifdef config-mwincHIP3D
cflags += -march=i586
endif

ifdef config-mcyriXIII
cflags += -march=i586
endif

head := arch/i386/kernel/head.o arch/i386/kernel/init-task.o

subdirs += arch/i386/kernel arch/i386/mm arch/i386/lib

core-files := arch/i386/kernel/kernel.o arch/i386/mm/mm.o $(CORE-FILES)
libs := $(topdir)/arch/i386/lib/lib.a $(LIBS) $(TOPDIR)/arch/i386/lib/lib.a

ifdef config-math-EMULATION
subdirs += arch/i386/math-emu
drivers += arch/i386/math-emu/math.o
endif

arch/i386/kernel: dummy
	$(make) linuxsubdirs SUBDIRS=arch/i386/kernel

arch/i386/mm: dummy
	$(make) linuxsubdirs SUBDIRS=arch/i386/mm

makeboot = $(make) -C arch/$(ARCH)/boot

vmlinux: arch/i386/vmlinux.lds

force: ;

.phony: zimage bzimage compressed zlilo bzlilo zdisk bzdisk install \
		clean archclean archmrproper archdep

zimage: vmlinux
	@$(makeboot) zimage

(6)
bzimage: vmlinux
	@$(makeboot) bzimage

compressed: zimage

zlilo: vmlinux
	@$(makeboot) booTIMAGE=zImage zlilo

tmp:
	@$(makeboot) booTIMAGE=bzImage zlilo
bzlilo: vmlinux
	@$(makeboot) booTIMAGE=bzImage zlilo

zdisk: vmlinux
	@$(makeboot) booTIMAGE=zImage zdisk

bzdisk: vmlinux
	@$(makeboot) booTIMAGE=bzImage zdisk

install: vmlinux
	@$(makeboot) booTIMAGE=bzImage install

archclean:
	@$(makeboot) clean

archmrproper:

archdep:
	@$(makeboot) dep
			
(1)
ÀÌ makefileÀº $(TOPDIR)/Makefile¿¡ ÀÇÇØ Àп© µé¿©Áö¹Ç·Î exportµÈ ¸¹Àº º¯¼öµéÀ» ±×´ë·Î »ç¿ë °¡´ÉÇÏ´Ù.
(2)
ld´Â ÃÖÁ¾ outputÀ» elf-i386ÀÇ ÇüÅ·Π¸¸µç´Ù.

objcopy´Â ÀԷ¿¡¼­ .note, .comment ¼½¼ÇÀ» »èÁ¦ÇÏ°í ¸®·ÎÄÉÀÌ¼Ç Á¤º¸¿Í ½Éº¼ Á¤º¸¸¦ »èÁ¦ÇÑ´Ù. Ãâ·Â Æ÷¸ËÀº binary. ¸µÅ©ÇÒ ¶© $(TOPDIR)/arch/i386/vmlinux.lds¶õ ÆÄÀÏ¿¡ ±â·ÏµÇ¾î ÀÖ´Â ¹æ¹ýÀ» µû¶ó ¸µÅ©ÇÑ´Ù.

(3)
gcc°¡ ½ºÅÃÀ» 16 byte ´ÜÀ§·Î Á¤·ÄÇÏÁö ¸øÇϵµ·Ï ÇÑ´Ù.

»ç¿ëµÇ´Â ¿É¼ÇÀº ´ÙÀ½°ú °°Àº Àǹ̸¦ °®´Â´Ù.

  • -mpreferred-stack-boundary=2 : ½ºÅÃÀ» 22 byte·Î Á¤·ÄÇϵµ·Ï ÇÑ´Ù. (=4¸é 24)

  • -S : ÄÄÆÄÀÏ ½ºÅ×ÀÌÁö±îÁö¸¸ ÇÏ°í ¾î¼ÀºíÀº ÇÏÁö ¾Ê´Â´Ù.

  • -xc : c ¾ð¾î·Î ÄÄÆÄÀÏ ÇÑ´Ù.

Áï ½ºÅà ¹Ù¿î´õ¸® Á¤·ÄÀÌ 4 ¹ÙÀÌÆ®·Î °¡´ÉÇÑÁö ¾Ë¾ÆºÁ¼­ °¡´ÉÇϸé 4 ¹ÙÀÌÆ® Á¤·ÄÀ» »ç¿ëÇÑ´Ù. ¸¸¾à 4 ¹ÙÀÌÆ® Á¤·ÄÀ» Áö¿øÇÏÁö ¾ÊÀ¸¸é ÄÄÆÄÀÏ Áß¿¡ ¿¡·¯°¡ ³¯ °ÍÀÌ´Ù. À̶© ±âº» °ªÀ» »ç¿ëÇÑ´Ù.

/dev/nullÀÌ $(CC)ÀÇ ÀÔ·ÂÀ¸·Î ÁöÁ¤µÆÀ¸¹Ç·Î /dev/nullÀ» Àоî ÄÄÆÄÀÏÇÑ´Ù. /dev/nullÀ» ÀÐÀ¸¸é EOF¸¦ µ¹·ÁÁֹǷΠÄÄÆÄÀÏµÈ Ãâ·ÂÀº ´ÙÀ½°ú °°À» °ÍÀÌÁö¸¸ ¹Ù·Î /dev/null·Î Ãâ·ÂµÇ¾î È­¸é¿¡´Â ³ªÅ¸³ªÁö ¾Ê´Â´Ù.

ÄÄÆÄÀÏµÇ¸é ´ÙÀ½°ú °°Àº °á°ú°¡ ³ª¿Â´Ù.

	.file   "null"  
	.version    "01.01" 
gcc2-compiled.:
	.ident  "gcc: (gNU) 2.95.3 20010315 (release)"
						
¿¡·¯ ¾øÀÌ ÄÄÆÄÀÏÀÌ ³¡³ª¸é $(CC)ÀÇ °á°ú´Â true°¡ µÉ °ÍÀÌ°í ¿¡·¯°¡ ÀÖ´Ù¸é false°¡ µÉ °ÍÀÌ´Ù. >/dev/null 2>&1Àº Ãâ·ÂµÇ´Â ¿¡·¯ ¸Þ½ÃÁö´Â È­¸é¿¡ ³ª¿À°Ô ÇÏÁö ¾Ê°í °á°ú°¡ trueÀÎÁö falseÀÎÁö¸¸À» ÆÇº° Çϱâ À§ÇØ ³ÖÀº °ÍÀÌ´Ù.

(4)
amd k6 CPU´Â Áö¿øÇÏ´ÂÁö ¿©ºÎ¿¡ µû¶ó Áö¿øÇÏÁö ¾ÊÀ» °æ¿ì¿£ i586À¸·Î °£ÁÖÇÑ´Ù.
(5)
athlonÀ» »ç¿ëÇÑ´Ù°í ÇßÁö¸¸ Áö¿øÇÏ´ÂÁö ÆÇ´Ü ÈÄ Áö¿øÇÏÁö ¾ÊÀ¸¸é i686À¸·Î °£ÁÖÇϰí Á¤·ÄÀ» 16 ¹ÙÀÌÆ®·Î ÇÑ´Ù.
(6)
bzimage¸¦ ¸¸µé °æ¿ì¿£ ¸ÕÀú vmlinux¸¦ ¸¸µé°í ³ª¼­ $(TOPDIR)/arch/i386/boot¿¡¼­ make bzImage¸¦ ´Ù½Ã ½ÇÇàÇÑ´Ù.

2.3.3. $(topDIR)/arch/i386/boot/Makefile

#
# arch/i386/boot/makefile
#
# this file is subject to the terms and conditions of the GNU General Public
# license.  see the file "COPYING" in the main directory of this archive
# for more details.
#
# copyright (c) 1994 by Linus Torvalds
#

boot-incl =	$(topdIR)/include/linux/config.h \
		$(topdir)/include/linux/autoconf.h \
		$(topdir)/include/asm/boot.h

(1)
zimage: $(configurE) bootsect setup compressed/vmlinux tools/build
	$(objcopy) compressed/vmlinux compressed/vmlinux.out
	tools/build bootsect setup compressed/vmlinux.out $(ROOT-DEV) > zImage

(2)
bzimage: $(configuRE) bbootsect bsetup compressed/bvmlinux tools/build
	$(objcopy) compressed/bvmlinux compressed/bvmlinux.out
	tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT-DEV) > bzImage

compressed/vmlinux: $(TOPDIR)/vmlinux
	@$(make) -c compressed vmlinux

compressed/bvmlinux: $(TOPDIR)/vmlinux
	@$(make) -c compressed bvmlinux

zdisk: $(bootimage)
	dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0

zlilo: $(configure) $(BOOTIMAGE)
	if [ -f $(instalL-PATH)/vmlinuz ]; then mv $(INSTALL-PATH)/vmlinuz $(INSTALL-PATH)/vmlinuz.old; fi
	if [ -f $(instalL-PATH)/System.map ]; then mv $(INSTALL-PATH)/System.map $(INSTALL-PATH)/System.old; fi
	cat $(bootimage) > $(INSTALL-PATH)/vmlinuz
	cp $(topdir)/system.map $(INSTALL-PATH)/
	if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi

install: $(configuRE) $(BOOTIMAGE)
	sh -x ./install.sh $(KERNELRELEASE) $(BOOTIMAGE) $(TOPDIR)/System.map "$(INSTALL-PATH)"

(3)
tools/build: tools/build.c
	$(hostcc) $(hostCFLAGS) -o $@ $< -I$(TOPDIR)/include

bootsect: bootsect.o
	$(ld) -ttext 0x0 -s --oformat binary -o $@ $<

bootsect.o: bootsect.s
	$(as) -o $@ $<

bootsect.s: bootsect.S Makefile $(BOOT-INCL)
	$(cpp) $(cppflagS) -traditional $(SVGA-MODE) $(RAMDISK) $< -o $@

(4)
bbootsect: bbootsect.o
	$(ld) -ttext 0x0 -s --oformat binary $< -o $@

bbootsect.o: bbootsect.s
	$(as) -o $@ $<

(5)
bbootsect.s: bootsect.S Makefile $(BOOT-INCL)
	$(cpp) $(cppflagS) -D--BIG-KERNEL-- -traditional $(SVGA-MODE) $(RAMDISK) $< -o $@

setup: setup.o
	$(ld) -ttext 0x0 -s --oformat binary -e begtext -o $@ $<

setup.o: setup.s
	$(as) -o $@ $<

setup.s: setup.s video.S Makefile $(BOOT-INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h
	$(cpp) $(cppflagS) -D--ASSEMBLY-- -traditional $(SVGA-MODE) $(RAMDISK) $< -o $@

(6)
bsetup: bsetup.o
	$(ld) -ttext 0x0 -s --oformat binary -e begtext -o $@ $<

bsetup.o: bsetup.s
	$(as) -o $@ $<

bsetup.s: setup.s video.S Makefile $(BOOT-INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h
	$(cpp) $(cppflagS) -D--BIG-KERNEL-- -D--ASSEMBLY-- -traditional $(SVGA-MODE) $(RAMDISK) $< -o $@

dep:

clean:
	rm -f tools/build
	rm -f setup bootsect zImage compressed/vmlinux.out
	rm -f bsetup bbootsect bzImage compressed/bvmlinux.out
	@$(make) -c compressed clean
			
(1)
ÇöÀç Ä¿³ÎÀº zImage, bzImage µÎ °¡Áö°¡ Á¸Àç ÇÑ´Ù.

zimage´Â gzipÀ¸·Î ¾ÐÃàµÇ°í ÇÏÀ§ 1M ¸Þ¸ð¸® ³»¿¡ ÀûÀçµÉ ¼ö ÀÖ´Â Å©±âÀÇ Ä¿³Î [1]

bzimage´Â gzipÀ¸·Î ¾ÐÃàµÇ°í ÇÏÀ§ 1M ¸Þ¸ð¸® ³»¿¡ ÀûÀçµÉ ¼ö ¾ø´Â Å©±âÀÇ Ä¿³Î

$(objcOPY)´Â $(TOPDIR)/arch/i386/Makefile¿¡¼­ Á¤ÀÇµÈ °ÍÀ» µû¸¥´Ù. Áï 'objcoPY=$(CROSS-COMPILE)objcopy -O binary -R .note -R .comment -S'°¡ µÈ´Ù.

(2)
bvmlinux¸¦ objcopy¸¦ »ç¿ëÇØ ½Éº¼ µîÀ» »©°í build¶õ °ÍÀ» »ç¿ëÇØ ÃÖÁ¾ Ä¿³ÎÀ» ¸¸µç´Ù. build´Â bbootsect(512 bytes)+bsetup+bvmlinux.outÀ» ÇÕÃÄ ÇϳªÀÇ bzImage¸¦ ¸¸µç´Ù (±×¸² 2-2).
(3)
build ÇÁ·Î±×·¥Àº ÃÖÁ¾ Ä¿³ÎÀ» ¸¸µå´Â À¯Æ¿¸®Æ¼´Ù. ´õ ÀÚ¼¼ÇÑ °ÍÀº ¿©±â¿¡¼­ ´Ù·é´Ù.
(4)
¾î¼Àºí ³¡³­ bbootsect.o¸¦ ¸µÅ©ÇÑ´Ù. »ç¿ëµÈ ¿É¼ÇÀº

-ttext 0x0 : ÄÚµåÀÇ ½ÃÀÛÀ» 0¹øÁö ºÎÅÍ ½ÃÀÛÇÑ´Ù°í ÇÏ°í ¸µÅ©ÇÑ´Ù. ÀÌ·¸°Ô ÇÏ¸é ¸µÅ©µÈ ÃÖÁ¾ Ãâ·Â¹°Àº Ưº°ÇÑ À§Ä¡¸¦ °¡¸®Áö ¾Ê°í ¸Þ¸ð¸®ÀÇ ¾Æ¹« À§Ä¡¿¡³ª ÀûÀç°¡ °¡´ÉÇÏ°í ½ÇÇà °¡´ÉÇØÁø´Ù.

-s : Ãâ·Â¹°¿¡¼­ ½Éº¼ Á¤º¸¸¦ ¸ðµÎ ¾ø¾Ø´Ù.

--oformat binary : Ãâ·Â¹°ÀÇ Æ÷¸ËÀ» ¹ÙÀ̳ʸ®·Î ÇÑ´Ù.

(5)
bootsect.S¸¦ ÇÁ¸®ÄÄÆÄÀÏÇϴµ¥ --BIG-KERNEL--À» Á¤ÀÇÇØ bzImageÀÇ ºÎÆ® ¼½Å͸¦ ¸¸µç´Ù. Ãʱâ vga ¸ðµå¿Í ·¥µð½ºÅ© Å©±â µîÀ» Á¤º¸·Î Àü´ÞÇØ ÁØ´Ù.
(6)
bsetup ¶ÇÇÑ bbootsect¿Í °°Àº ¹æ¹ýÀ¸·Î ¸¸µé¾îÁø´Ù.

2.3.4. $(topDIR)/arch/i386/boot/compressed/Makefile

#
# linux/arch/i386/boot/compressed/Makefile
#
# create a compressed vmlinux image from the original vmlinux
#

head = head.o
system = $(topdir)/vmlinux

objects = $(head) misc.o

zldflags = -e startup-32

(1)
# zimage-offset is the load offset of the compression loader
# bzimage-offset is the load offset of the high loaded compression loader
#
zimage-offset = 0x1000
bzimage-offset = 0x100000

zlinkflags = -ttext $(ZIMAGE-OFFSET) $(ZLDFLAGS)
bzlinkflags = -ttext $(BZIMAGE-OFFSET) $(ZLDFLAGS)

all: vmlinux

vmlinux: piggy.o $(OBJECTS)
	$(ld) $(zlinkflaGS) -o vmlinux $(OBJECTS) piggy.o

(2)
bvmlinux: piggy.o $(OBJECTS)
	$(ld) $(bzlinkflAGS) -o bvmlinux $(OBJECTS) piggy.o

(3)
head.o: head.s
	$(cc) $(aflags) -traditional -c head.S

misc.o: misc.c
	$(cc) $(cflags) -c misc.c

(4)
piggy.o:	$(system)
	tmppiggy=-tmp-$$$$piggy; \
	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
	$(objcopy) $(sysTEM) $$tmppiggy; \
	gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
	echo "sections { .data : { input-len = .; LONG(input-data-end - input-data) input-data = .; *(.data) input-data-end = .; }}" >gt; $$tmppiggy.lnk; \
	$(ld) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
	rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk

clean:
	rm -f vmlinux bvmlinux -tmp-*
			
(1)
zimage¿Í bzImageÀÇ ¸Þ¸ð¸® ÀûÀç À§Ä¡°¡ ¼­·Î ´Þ¶ó zImage´Â 0x1000¿¡¼­ ºÎÅÍ ¸Þ¸ð¸®¿¡ ÀûÀçµÇ°í bzImage´Â 0x100000¿¡ ÀûÀçµÈ´Ù.
(2)
bvmlinux´Â vmlinux¿Í ¸¶Âù°¡Áö·Î heas.o, misc.o, piggy.o°¡ ÇÕÃÄÁ® ¸¸µé¾îÁø´Ù. ±×·¯³ª ¸µÅ© Ç÷¡±×°¡ ¼­·Î ´Ù¸£°Ô ¼³Á¤µÇ¾îÀÖ´Ù.
(3)
Ä¿³ÎÀÇ ¾ÐÃàÀ» Ç®°í ¸Þ¸ð¸®¿¡ ÀûÀç ÇÏ´Â µîÀÇ ÀÏÀ» ÇÏ´Â ºÎºÐÀÌ´Ù.
(4)
Ä¿³ÎÀÇ ÇÙ½É ºÎºÐÀÌ ¸ðµÎ ÄÄÆÄÀ쵂 ¸µÅ©µÇ¸é elf typeÀ¸·Î $(TOP-DIR)/vmlinux°¡ ¸¸µé¾îÁö´Âµ¥ À̰Ϳ¡¼­ µð¹ö±ë Á¤º¸ µîÀ» ¾ø¾Ö°í ¾ÐÃàÇØ¼­ ¸¸µç °ÍÀÌ piggy.o°¡ µÈ´Ù. ¾ÐÃàÀº gzipÀ¸·Î ÇÑ´Ù.

$$$$piggyÀÇ 4°³ÀÇ $´Â 4ÀÚ¸®ÀÇ ÀÓÀÇÀÇ ¼ýÀڷΠä¿öÁø´Ù. Áï tmppiggy=-tmp-1234piggy¿Í °°À̵ȴÙ. ´õºÒ¾î $$tmppiggy.gz Àº -tmp-1234piggy.gz, tmppiggy.lnk´Â -tmp-1234piggy.lnk¿Í °°ÀÌ µÈ´Ù.

piggy.o´Â head.o, misc.o¿Í ÇÕÃÄÁ® ÇϳªÀÇ ´Ù¸¥ file·Î ¸¸µé¾îÁ®¾ßÇϹǷΠ´Ù½Ã ¸µÄ¿¸¦ ÅëÇØ elf-i386 Æ÷¸ËÀ¸·Î ¸¸µé¾îÁø´Ù.

$(objcOPY)¿¡ »ç¿ëµÈ ¿É¼ÇÀº ´ÙÀ½°ú °°´Ù.

  • -O : output format. ¿©±â¼± binary

  • -R : ÁöÁ¤µÈ section À̸§À» Áö¿î´Ù. .note, .comment´Â ¾ø¾Ø´Ù.

  • -S : input fileÀ» ÁöÁ¤ÇÑ´Ù.

$(ld)¿¡ »ç¿ëµÈ ¿É¼ÇÀº ´ÙÀ½°ú °°´Ù.

  • -m elf-i386 : ld°¡ elf-i386À» emulation Çϵµ·Ï ÁöÁ¤ÇÑ´Ù.

  • -r : relocatable, ¸Þ¸ð¸®¿¡ ÀûÀçµÉ ¶§ Àç¹èÄ¡ °¡´ÉÇϵµ·Ï ÇÑ´Ù.

  • -b binary : input fileÀÇ formatÀ» ¸»ÇÑ´Ù. ¿©±â¼± $$tmppiggy.gzÀº binary

  • -T : linker script fileÀ» ÁöÁ¤ÇÑ´Ù.

  • -b elf32-i386 : outputÀ» elf-i386 formatÀ¸·Î ÁöÁ¤ÇÑ´Ù.

2.3.5. $(topDIR)/arch/i386/boot/tools/build.c

$(topdir)/arch/i386/boot/tools/build´Â Ä¿³Î À̹ÌÁö ¸¸µå´Â °úÁ¤ÀÇ ÃÖÁ¾ ´Ü°è¿¡¼­ ¸î °³ÀÇ ÆÄÀÏÀ» ÇÕÃÄ ÇϳªÀÇ Ä¿³Î À̹ÌÁö¸¦ ¸¸µé¾î³½´Ù. ÀÌ·± ÀÏÀ» ´ã´çÇÏ´Â ÇÁ·Î±×·¥À» ºÐ¼®ÇØ¾ß ÀÌ¹Ì ³ª¿Â ºÎÆÃ °úÁ¤¿¡¼­ÀÇ µ¿ÀÛÀ» ÀÌÇØÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.

ÃÖÁ¾ ¸¸µé¾îÁö´Â À̹ÌÁö´Â ±×¸² 2-2ÀÌ µÈ´Ù. ºÎÆÃÇÒ ¶§ bootsect´Â build¿¡ ÀÇÇØ ±â·ÏµÈ ·çÆ® µð¹ÙÀ̽º, setupÀÇ Å©±â, ¾ÐÃà Ä¿³ÎÀÇ Å©±â¸¦ ¹ÙÅÁÀ» ºÎÆÃ ÀýÂ÷¸¦ °è¼Ó ÁøÇàÇÑ´Ù.

/*
 *  $id: chap2.sgml,v 1.8 2002/02/15 15:59:43 halite Exp $
 *
 *  copyright (c) 1991, 1992  Linus Torvalds
 *  copyright (c) 1997 Martin Mares
 */

/*
 * this file builds a disk-image from three different files:
 *
 * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
 * - setup: 8086 machine code, sets up system parm
 * - system: 80386 code for actual system
 *
 * it does some checking that all files are of the correct type, and
 * just writes the result to stdout, removing headers and padding to
 * the right amount. It also writes some system data to stderr.
 */

/*
 * changes by tytso to allow root device specification
 * high loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
 * cross compiling fixes by Gertjan van Wingerde, July 1996
 * rewritten by martin Mares, April 1997
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <unistd.h>
#include <fcntl.h>
#include <asm/boot.h>

typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long u32;

#define default-maJOR-ROOT 0
#define default-miNOR-ROOT 0

/* minimal number of setup sectors (see also bootsect.S) */
#define setup-sectS 4

byte buf[1024];
int fd;
int is-big-kernel;

void die(const char * str, ...)
{
	va-list args;
	va-start(args, str);
	vfprintf(stderr, str, args);
	fputc('\n', stderr);
	exit(1);
}

void file-open(const char *name)
{
	if ((fd = open(name, O-RDONLY, 0)) < 0)
		die("unable to open `%s': %m", name);
}

void usage(void)
{
	die("usage: build [-b] bootsect setup system [rootdev] [> image]");
}

int main(int argc, char ** argv)
{
	unsigned int i, c, sz, setup-sectors;
	u32 sys-size;
	byte major-root, minor-root;
	struct stat sb;

(1)
	if (argc > 2 && !strcmp(argv[1], "-b"))
	  {
	    is-big-kernel = 1;
	    argc--, argv++;
	  }
	if ((argc < 4) || (argc > 5))
		usage();
	if (argc > 4) {
(2)
		if (!strcmp(argv[4], "CURRENT")) {
			if (stat("/", &sb)) {
				perror("/");
				die("couldn't stat /");
			}
			major-root = major(sb.st-dev);
			minor-root = minor(sb.st-dev);
		} else if (strcmp(argv[4], "FLOPPY")) {
			if (stat(argv[4], &sb)) {
				perror(argv[4]);
				die("couldn't stat root device.");
			}
			major-root = major(sb.st-rdev);
			minor-root = minor(sb.st-rdev);
		} else {
			major-root = 0;
			minor-root = 0;
		}
	} else {
		major-root = dEFAULT-MAJOR-ROOT;
		minor-root = dEFAULT-MINOR-ROOT;
	}
	fprintf(stderr, "Root device is (%d, %d)\n", major-root, minor-root);

(3)
	file-open(argv[1]);
	i = read(fd, buf, sizeof(buf));
	fprintf(stderr,"Boot sector %d bytes.\n",i);
	if (i != 512)
		die("boot block must be exactly 512 bytes");
	if (buf[510] != 0x55 || buf[511] != 0xaa)
		die("boot block hasn't got boot flag (0xAA55)");
	buf[508] = minor-root;
	buf[509] = major-root;
	if (write(1, buf, 512) != 512)
		die("write call failed");
	close (fd);

(4)
	file-open(argv[2]);				    /* Copy the setup code */
	for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
		if (write(1, buf, c) != c)
			die("write call failed");
	if (c != 0)
		die("read-error on `setup'");
	close (fd);

(5)
	setup-sectors = (i + 511) / 512;	/* Pad unused space with zeros */
	/* for compatibility with ancient versions of LILO. */
	if (setup-sectors < SETUP-SECTS)
		setup-sectors = SETUP-SECTS;
	fprintf(stderr, "Setup is %d bytes.\n", i);
	memset(buf, 0, sizeof(buf));
	while (i < setup-sectors * 512) {
		c = setup-sectors * 512 - i;
		if (c > sizeof(buf))
			c = sizeof(buf);
		if (write(1, buf, c) != c)
			die("write call failed");
		i += c;
	}

(6)
	file-open(argv[3]);
	if (fstat (fd, &sb))
		die("unable to stat `%s': %m", argv[3]);
	sz = sb.st-size;
	fprintf (stderr, "System is %d kB\n", sz/1024);
	sys-size = (sz + 15) / 16;
	/* 0x28000*16 = 2.5 MB, conservative estimate for the current maximum */
	if (sys-size > (is-big-kernel ? 0x28000 : DEF-SYSSIZE))
		die("system is too big. Try using %smodules.",
			is-big-kernel ? "" : "bzImage or ");
	if (sys-size > 0xefff)
		fprintf(stderr,"warning: kernel is too big for standalone boot "
		    "from floppy\n");
	while (sz > 0) {
		int l, n;

		l = (sz > sizeof(buf)) ? sizeof(buf) : sz;
		if ((n=read(fd, buf, l)) != l) {
			if (n < 0)
				die("error reading %s: %m", argv[3]);
			else
				die("%s: unexpected EOF", argv[3]);
		}
		if (write(1, buf, l) != l)
			die("write failed");
		sz -= l;
	}
	close(fd);

	if (lseek(1, 497, SEEK-SET) != 497)		    /* Write sizes to the bootsector */
		die("output: seek failed");
	buf[0] = setup-sectors;
	if (write(1, buf, 1) != 1)
		die("write of setup sector count failed");
	if (lseek(1, 500, SEEK-SET) != 500)
		die("output: seek failed");
	buf[0] = (sys-size & 0xff);
	buf[1] = ((sys-size >> 8) & 0xff);
	if (write(1, buf, 2) != 2)
		die("write of image length failed");

	return 0;					    /* Everything is OK */
}
			
(1)
buildÀÇ command line¿¡ -b ¿É¼ÇÀ» ÁÖ¸é ÀÌ´Â big kernel ÀÓÀ» ÀǹÌÇÏ°Ô µÈ´Ù.
(2)
·çÆ® µð¹ÙÀ̽ºÀÇ major, minor ¹øÈ£¸¦ ¾Ë¾Æ³½´Ù.

currenT´Â /ÀÇ major, minor number¸¦ »ç¿ëÇÑ´Ù. ÇÊÀÚÀÇ ¸®´ª½º ¹Ú½º´Â hda1ÀÌ /À̹ǷΠmajor=0x03, minor=0x01ÀÌ µÉ°ÍÀÌ´Ù.

Ç÷ÎÇǰ¡ ·çÆ® µð¹ÙÀ̽º·Î ÁöÁ¤µÆÀ¸¸é major=minor=0ÀÌ µÈ´Ù.

command line¿¡ ¾Æ¹« °Íµµ ÁöÁ¤µÇÁö ¾ÊÀ¸¸é ±âº» °ªÀÌ »ç¿ëµÈ´Ù(±âº» °ªÀº »ç½Ç Ç÷ÎÇÇ¿Í °°Àº °ªÀ» °®´Â´Ù).

(3)
ºÎÆ® ¼½ÅÍ ÆÄÀÏÀ» Àоî 512 byte°¡ ¾Æ´Ï¸é ¿¡·¯¸¦ ³½´Ù. ºÎÆ® ¼½ÅÍ´Â Á¤È®È÷ 512 byte¿©¾ß Çϱ⠶§¹®ÀÌ´Ù. ±×¸®°í MagicNumber¸¦ Ã¼Å©ÇØ Á¤¸» ºÎÆ® ¼½ÅÍÀÎÁö È®ÀÎÇÑ´Ù.

¶Ç 508(0x1FC), 509(0x1FD) ¹øÂ° ¹ÙÀÌÆ®¿¡ ·çÆ® µð¹ÙÀ̽ºÀÇ minor, major ¹øÈ£¸¦ ½á ³Ö´Â´Ù.

¼öÁ¤ ÈÄ Ç¥ÁØ Ãâ·ÂÀ¸·Î bootsectÀÇ 512 byte¸¦ Ãâ·ÂÇÑ´Ù(¿ø·¡ 512 byte ¿´À¸¹Ç·Î ¼öÁ¤ ³»¿ëÀ» Æ÷ÇÔÇØ ±×´ë·Î Ãâ·ÂµÉ °ÍÀÌ´Ù).

(4)
setupÀº Å©±â°¡ Á¤È®È÷ ¾ó¸¶ÀÎÁö ¾Ë¼ö ¾øÀ¸¹Ç·Î 1024 byte ´ÜÀ§·Î ÀÐÀ¸¸é¼­ Å©±â¸¦ º¯¼ö i¿¡ ±â¾ïÇØ ³õ´Â´Ù. ÀÐÀº 1KB´Â Àд Áï½Ã Ç¥ÁØ Ãâ·ÂÀ» Ãâ·ÂµÈ´Ù.
(5)
setupÀ» 512 byte ´ÜÀ§·Î ²÷°í Àû¾îµµ SETUP-SECTOR(°ªÀº 4) ¸¸Å­ÀÌ µÇ´ÂÁö È®ÀÎÇØ ¸ðÀÚ¶õ ºÎºÐÀº 0À¸·Î ä¿ö ³Ö´Â´Ù. µð½ºÅ©´Â ¼½ÅÍ ´ÜÀ§·Î ÀÔÃâ·ÂÇÑ´Ù´Â °ÍÀ» ±â¾ïÇϱ⠹ٶõ´Ù.

¿¹¸¦ µé¾î setupÀÇ Å©±â°¡ 4768 byte¶ó¸é 4768/512=9.3125 À̹ǷΠ9 ¼½Å͸¦ Â÷ÁöÇϰí 10¹øÂ° ¼½ÅÍ´Â ´Ù »ç¿ëÇÏÁö ¾Ê°í Á¶±Ý¸¸ »ç¿ëÇÏ°Ô µÈ´Ù. 10¹øÂ° ¼½ÅÍÀÇ °æ¿ì 160 byte¸¦ Á¦¿ÜÇÑ 352 byte ¸¸Å­À» 0À¸·Î ä¿ö ³Ö´Â´Ù.

(6)
¾ÐÃàµÈ Ä¿³ÎÀÇ Å©±â¸¦ °è»êÇØ zImageÀÇ °æ¿ì 0x7F000 º¸´Ù Å«Áö È®ÀÎÇϰí, bzImage´Â 0x280000 º¸´Ù Å«Áö È®ÀÎÇÑ´Ù. ¸¸¾à ÁöÁ¤µÈ Å©±âº¸´Ù Å©´Ù¸é ÇöÀç·Î¼­´Â ¼ö¿ëÇÒ ¼ö ¾ø´Â Å©±âÀÇ Ä¿³ÎÀ̹ǷΠ¿¡·¯¸¦ ³½´Ù. ¶Ç Ç÷ÎÇÇ ºÎÆÃÀÇ °æ¿ì Ç÷ÎÇÇ¿¡ µé¾î°¥ ¼ö ÀÖ´Â Å©±âÀÎÁö È®ÀÎÇÑ´Ù.

1024 byte ´ÜÀ§·Î Àоî Ç¥ÁØ Ãâ·Â¿¡ Ãâ·ÂÇϰí bootsectÀÇ 497(0x1F1)¿¡ setupÀÌ ¸î ¼½Å͸¦ Â÷ÁöÇÏ´ÂÁö ±â·ÏÇϰí 500(0x1F4)¿¡ ¾ÐÃà Ä¿³ÎÀÇ Å©±â¸¦ 16 byte ´ÜÀ§·Î ±â·ÏÇØÁØ´Ù.

ÁÖ¼®

[1]

ÇÏÀ§ 1M¿¡ ´ëÇÑ °ÍÀº 2.2.2ÀýÀ» ÂüÁ¶ÇÑ´Ù.

EmailÀ» ±âÀÔÇϸé, ´ñ±ÛÀÌ ¸ÞÀÏ·Î Àü´ÞµË´Ï´Ù.