public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] experimental: elkscmd: image building
@ 2004-06-10  0:46 claudio
  2004-07-28 13:55 ` *Applied* " Miguel Bolanos
  0 siblings, 1 reply; 2+ messages in thread
From: claudio @ 2004-06-10  0:46 UTC (permalink / raw)
  To: linux-8086

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1074 bytes --]


Experimental fix for image generation. Includes boto's fixes. The
idea is to use a common rule to build all disk images, instead of
duplicating all the code to create filesystem, mount and copy files
for each new disk image.

It builds full3, full5, comb, comb_net and boot. SIBO disk not working
yet, and root image not buildable because binary files are larger now
(see my previous post). full3 and full5 now include ktcp.

Make sure your dev86 directory is correctly set in the buildsystem.
bootblocks/version.h is created with make other OTHER=bootblocks
in dev86 toplevel.

Changes to disk_utils/Makefile are cosmetic. MAKEDEV changes prevent
inode depletion in the root disk (we may need to cut it further or
increase the number of inodes in the image).

Still TODO: create tcpdev node, set file permissions, fix sibo/root
images, create HD image.


 Makefile                    |  185 +++++++++++++++++---------------------------
 disk_utils/Makefile         |   26 +++---
 rootfs_template/dev/MAKEDEV |   12 +-
 3 files changed, 94 insertions(+), 129 deletions(-)


[-- Attachment #2: Type: TEXT/PLAIN, Size: 10877 bytes --]

diff -rud -x CVS elkscmd-orig/Makefile elkscmd/Makefile
--- elkscmd-orig/Makefile	2004-06-09 13:25:40.000000000 -0300
+++ elkscmd/Makefile	2004-06-09 21:28:38.000000000 -0300
@@ -46,11 +46,8 @@
 		$(FULL3_TARGET_FS) $(FULL5_TARGET_FS) || true
 	rm -f $(COMB_TARGET_FS) $(ROOT_TARGET_FS) $(ROOT_NET_TARGET_FS) \
 		$(FULL3_TARGET_FS) $(FULL5_TARGET_FS) boot images.zip core
-	rm -rf rootfs_template $(ROOTDIR)
+	rm -rf $(ROOTDIR)
 	@for i in $(DIRS); do make -C $$i clean ; done
-	-echo FIXME: make clean is temporarily broken, because there is no
-	-echo rootfs_template.tar anymore
-	tar xf rootfs_template.tar
 
 ###############################################################################
 #
@@ -122,138 +119,106 @@
 
 $(FD_BSECT):
 	make -C $(MINIX_BOOT)
-	make -C $(MINIX_BOOT) minix.bin
+	make -C $(MINIX_BOOT) bootbin
 
 $(KHELPER):
-	make -C $(MINIX_BOOT)
+	make -C $(MINIX_BOOT) minix_elks.bin
 
 ###############################################################################
 #
-# Old commands, left as is for now.
+# Create disk images
 
-$(COMB_TARGET_FS):
-	dd if=/dev/zero of=$(COMB_TARGET_FS) bs=1024 count=$(COMB_TARGET_BLKS)
+kernel_image: $(ELKS_DIR)/arch/i86/boot/Image
 
-$(FULL3_TARGET_FS):
-	dd if=/dev/zero of=$(FULL3_TARGET_FS) bs=1024 count=$(FULL3_TARGET_BLKS)
+boot_blocks: $(FD_BSECT) $(KHELPER)
 
-$(FULL5_TARGET_FS):
-	dd if=/dev/zero of=$(FULL5_TARGET_FS) bs=1024 count=$(FULL5_TARGET_BLKS)
+_build_bootable_target: _build_target kernel_image boot_blocks
+	mkdir -p $(TARGET_MNT)/boot
+	cp $(ELKS_DIR)/arch/i86/boot/Image $(TARGET_MNT)/boot/linux
+	cp $(KHELPER) $(TARGET_MNT)/boot/boot
+	umount $(TARGET_FS)
+	dd if=$(FD_BSECT) of=$(TARGET_FS) bs=512 count=2 conv=notrunc 2>/dev/null
 
-$(ROOT_TARGET_FS):
-	dd if=/dev/zero of=$(ROOT_TARGET_FS) bs=1024 count=$(ROOT_TARGET_BLKS)
+_build_nonbootable_target: _build_target
+	umount $(TARGET_FS)
 
-$(ROOT_NET_TARGET_FS):
-	dd if=/dev/zero of=$(ROOT_NET_TARGET_FS) bs=1024 count=$(ROOT_NET_TARGET_BLKS)
+_build_target: all banner check_id _populate_target
 
-$(SIBO_TARGET_FS):
-	dd if=/dev/zero of=$(SIBO_TARGET_FS) bs=1024 count=$(SIBO_TARGET_BLKS)
+_populate_target: _mount_target
+	for i in $(DIRS); do make -C $$i $(TARGET_RFS)||exit 1; done >/dev/null
+	$(ELKSCMD_DIR)/tools/ver.pl $(ELKS_DIR)/Makefile > $(TARGET_MNT)/etc/issue
+	[ "$(INSTALL_KTCP)" = "yes" ] && \
+		cp -p $(ELKSNET_DIR)/ktcp/ktcp $(TARGET_MNT)/bin || true
 
-$(ELKSCMD_DIR)/rootfs_template/etc/issue: $(ELKSCMD_DIR)/rootfs_template/etc/passwd $(ELKS_DIR)/Makefile
-	$(ELKSCMD_DIR)/tools/ver.pl $(ELKS_DIR)/Makefile > $(ELKSCMD_DIR)/rootfs_template/etc/issue
+_mount_target:
+	umount $(TARGET_FS) >/dev/null 2>&1 || true
+	dd if=/dev/zero of=$(TARGET_FS) bs=1024 count=$(TARGET_BLKS) 2>/dev/null
+	$(MKFS) $(MKFS_OPTS) $(TARGET_FS) $(TARGET_BLKS) >/dev/null
+	mkdir -p $(TARGET_MNT)
+	mount $(LOOP) $(TARGET_FS) $(TARGET_MNT)
+	(cd $(ELKSCMD_DIR)/rootfs_template; \
+		tar cf - --exclude CVS --exclude .keep *) | \
+		(cd $(TARGET_MNT); tar xpf -)
+	@(cd $(TARGET_MNT)/dev; ./MAKEDEV; rm MAKEDEV MAKESET)
 
-mount_combfs: $(COMB_TARGET_FS) $(ELKSCMD_DIR)/rootfs_template/etc/issue
-	$(MKFS) $(MKFS_OPTS) $(COMB_TARGET_FS) $(COMB_TARGET_BLKS)
-	sudo -u root mount $(COMB_TARGET_FS) $(TARGET_MNT) $(LOOP)
-	(cd $(ELKSCMD_DIR)/rootfs_template ; tar cf - --exclude CVS *) | \
-		(cd $(TARGET_MNT) ; tar xpvf -)
-	(cd $(TARGET_MNT)/dev ; ./MAKEDEV)
+banner:
+	@echo "*"
+	@echo "* Building image: `basename $(TARGET_FS)`"
+	@echo "*"
 
-mount_full3fs: $(FULL3_TARGET_FS) $(ELKSCMD_DIR)/rootfs_template/etc/issue
-	$(MKFS) $(MKFS_OPTS) $(FULL3_TARGET_FS) $(FULL3_TARGET_BLKS)
-	sudo -u root mount $(FULL3_TARGET_FS) $(TARGET_MNT) $(LOOP)
-	(cd $(ELKSCMD_DIR)/rootfs_template ; tar cf - --exclude CVS *) | \
-		(cd $(TARGET_MNT) ; tar xpvf -)
-	(cd $(TARGET_MNT)/dev ; ./MAKEDEV)
+check_id:
+	@if [ "`id -u`" -ne "0" ]; then \
+		echo -e "\n\nERROR: Only root can build disk images.\n\n"; \
+		exit 1; \
+	fi
 
-mount_full5fs: $(FULL5_TARGET_FS) $(ELKSCMD_DIR)/rootfs_template/etc/issue
-	$(MKFS) $(MKFS_OPTS) $(FULL5_TARGET_FS) $(FULL5_TARGET_BLKS)
-	sudo -u root mount $(FULL5_TARGET_FS) $(TARGET_MNT) $(LOOP)
-	(cd $(ELKSCMD_DIR)/rootfs_template ; tar cf - --exclude CVS *) | \
-		(cd $(TARGET_MNT) ; tar xpvf -)
-	(cd $(TARGET_MNT)/dev ; ./MAKEDEV)
+full3:
+	@$(MAKE) _build_bootable_target \
+		TARGET_FS=$(FULL3_TARGET_FS) \
+		TARGET_RFS=rfs \
+		TARGET_BLKS=$(FULL3_TARGET_BLKS) \
+		INSTALL_KTCP=yes
 
-mount_rootfs: $(ROOT_TARGET_FS) $(ELKSCMD_DIR)/rootfs_template/etc/issue
-	$(MKFS) $(MKFS_OPTS) $(ROOT_TARGET_FS) $(ROOT_TARGET_BLKS)
-	sudo -u root mount $(ROOT_TARGET_FS) $(TARGET_MNT) $(LOOP)
-	(cd $(ELKSCMD_DIR)/rootfs_template ; tar cf - --exclude CVS *) | \
-		(cd $(TARGET_MNT) ; tar xpvf -)
-	(cd $(TARGET_MNT)/dev ; ./MAKEDEV)
+full5:
+	@$(MAKE) _build_bootable_target \
+		TARGET_FS=$(FULL5_TARGET_FS) \
+		TARGET_RFS=rfs \
+		TARGET_BLKS=$(FULL5_TARGET_BLKS) \
+		INSTALL_KTCP=yes
 
-mount_rootnetfs: $(ROOT_NET_TARGET_FS) $(ELKSCMD_DIR)/rootfs_template/etc/issue
-	$(MKFS) $(MKFS_OPTS) $(ROOT_NET_TARGET_FS) $(ROOT_NET_TARGET_BLKS)
-	sudo -u root mount $(ROOT_NET_TARGET_FS) $(TARGET_MNT) $(LOOP)
-	(cd $(ELKSCMD_DIR)/rootfs_template ; tar cf - --exclude CVS *) | \
-		(cd $(TARGET_MNT) ; tar xpvf -)
-	(cd $(TARGET_MNT)/dev ; ./MAKEDEV)
-	
-mount_sibofs: $(SIBO_TARGET_FS) $(ELKSCMD_DIR)/rootfs_template/etc/issue
-	$(MKFS) $(MKFS_OPTS) $(SIBO_TARGET_FS) $(SIBO_TARGET_BLKS)
-	sudo -u root mount $(SIBO_TARGET_FS) $(TARGET_MNT) $(LOOP)
-	(cd $(ELKSCMD_DIR)/rootfs_template ; tar cf - --exclude CVS *) | \
-		(cd $(TARGET_MNT) ; tar xpvf -)
-	(cd $(TARGET_MNT) ; rm -rf home boot root var)
-	cp SIBODEV $(TARGET_MNT)/dev/SIBODEV
-	(cd $(TARGET_MNT)/dev ; ./SIBODEV ; rm -f MAKEDEV SIBODEV )
-	
+comb:
+	@$(MAKE) _build_bootable_target \
+		TARGET_FS=$(COMB_TARGET_FS) \
+		TARGET_RFS=min_rfs \
+		TARGET_BLKS=$(COMB_TARGET_BLKS)
 
-#rfs: mount_rfs
-#	@for i in $(DIRS); do make -C $$i rfs ; done
-#	umount $(TARGET_FS)
-	
-#min_rfs: mount_rfs
-#	@for i in $(DIRS); do make -C $$i min_rfs ; done
-#	umount $(TARGET_FS)
+comb_net:
+	@$(MAKE) _build_bootable_target \
+		TARGET_FS=$(ROOT_NET_TARGET_FS) \
+		TARGET_RFS=net_rfs \
+		TARGET_BLKS=$(ROOT_NET_TARGET_BLKS) \
+		INSTALL_KTCP=yes
 
 boot: $(ELKS_DIR)/arch/i86/boot/Image
 	cp $(ELKS_DIR)/arch/i86/boot/Image boot
 	
-
-comb: mount_combfs $(ELKS_DIR)/arch/i86/boot/Image $(FD_BSECT) $(KHELPER)
-	@for i in $(DIRS); do make -C $$i min_rfs ; done
-	cp $(ELKS_DIR)/arch/i86/boot/Image $(TARGET_MNT)/boot/linux
-	cp $(KHELPER) $(TARGET_MNT)/boot/boot
-	umount $(COMB_TARGET_FS)
-	dd if=$(FD_BSECT) of=$(COMB_TARGET_FS) bs=512 count=2 conv=notrunc
-
-full3: mount_full3fs $(ELKS_DIR)/arch/i86/boot/Image $(FD_BSECT) $(KHELPER)
-	@for i in $(DIRS); do make -C $$i rfs ; done
-	cp $(ELKS_DIR)/arch/i86/boot/Image $(TARGET_MNT)/boot/linux
-	cp $(KHELPER) $(TARGET_MNT)/boot/boot
-	umount $(FULL3_TARGET_FS)
-	dd if=$(FD_BSECT) of=$(FULL3_TARGET_FS) bs=512 count=2 conv=notrunc
-
-full5: mount_full3fs $(ELKS_DIR)/arch/i86/boot/Image $(FD_BSECT) $(KHELPER)
-	cd $(ELKSNET_DIR)/ktcp ; \
-        make ; \
-        cp -p -f ktcp $(TARGET_MNT)/bin
-	@for i in $(DIRS); do make -C $$i rfs ; done
-	cp $(ELKS_DIR)/arch/i86/boot/Image $(TARGET_MNT)/boot/linux
-	cp $(KHELPER) $(TARGET_MNT)/boot/boot
-	umount $(FULL3_TARGET_FS)
-	dd if=$(FD_BSECT) of=$(FULL3_TARGET_FS) bs=512 count=2 conv=notrunc
-
-root: mount_rootfs
-	@for i in $(DIRS); do make -C $$i min_rfs ; done
-	umount $(ROOT_TARGET_FS)
+root:
+	@$(MAKE) _build_nonbootable_target \
+		TARGET_FS=$(ROOT_TARGET_FS) \
+		TARGET_RFS=min_rfs \
+		TARGET_BLKS=$(ROOT_TARGET_BLKS)
+	
+# FIXME: should use SIBODEV instead of MAKEDEV
+sibo:
+	@$(MAKE) _build_nonbootable_target \
+		TARGET_FS=$(SIBO_TARGET_FS) \
+		TARGET_RFS=smin_rfs \
+		TARGET_BLKS=$(SIBO_TARGET_BLKS)
 	
-comb_net: mount_rootnetfs $(ELKS_DIR)/arch/i86/boot/Image $(FD_BSECT) $(KHELPER)
-	cd $(ELKSNET_DIR)/ktcp ; \
-	make ; \
-	cp -p -f ktcp $(TARGET_MNT)/bin
-	@for i in $(DIRS); do make -C $$i net_rfs ; done
-	cp $(ELKS_DIR)/arch/i86/boot/Image $(TARGET_MNT)/boot/linux
-	cp $(KHELPER) $(TARGET_MNT)/boot/boot
-	umount $(ROOT_NET_TARGET_FS)
-	dd if=$(FD_BSECT) of=$(ROOT_NET_TARGET_FS) bs=512 count=2 conv=notrunc
-
-sibo: mount_sibofs
-	@for i in $(DIRS); do make -C $$i smin_rfs ; done
-	umount $(SIBO_TARGET_FS)
-
 images.zip: boot comb root comb_net full3 full5
 	zip images.zip boot root comb comb_net full3 full5
 
+
 #######
 # EOF #
 #######
diff -rud -x CVS elkscmd-orig/disk_utils/Makefile elkscmd/disk_utils/Makefile
--- elkscmd-orig/disk_utils/Makefile	2004-05-31 17:00:05.000000000 -0300
+++ elkscmd/disk_utils/Makefile	2004-06-05 18:38:38.000000000 -0300
@@ -38,32 +38,32 @@
 
 SPROGS=mkfs
 
-all:		$(PROGS)
-	mkdir -p $(TARGET_MNT)/sbin
+all: $(PROGS)
 
-rfs:		install
+rfs: install
 
-min_rfs:	install
+min_rfs: install
 
-net_rfs:	install
+net_rfs: install
 
-smin_rfs:	install_sibo
+smin_rfs: install_sibo
 
-install_sibo:	all
+install_sibo: all
 	cp -p $(SPROGS) $(TARGET_MNT)/sbin
 
-install:	all
+install: all
 	cp -p $(PROGS) $(TARGET_MNT)/sbin
 
-fsck:		fsck.o
+fsck: fsck.o
 
-fdisk:		fdisk.o
+fdisk: fdisk.o
 
-mkfs:		mkfs.o
+mkfs: mkfs.o
 
-partype:	partype.o
+partype: partype.o
 
-ramdisk:	ramdisk.o
+ramdisk: ramdisk.o
 
 clean:
 	rm -f *.o $(FORMATMOD) core $(PROGS)
+
diff -rud -x CVS elkscmd-orig/rootfs_template/dev/MAKEDEV elkscmd/rootfs_template/dev/MAKEDEV
--- elkscmd-orig/rootfs_template/dev/MAKEDEV	2004-06-04 00:07:55.000000000 -0300
+++ elkscmd/rootfs_template/dev/MAKEDEV	2004-06-05 19:54:11.000000000 -0300
@@ -97,8 +97,8 @@
 ##############################################################################
 # Direct IDE disks, Primary channel.
 
-	$MKSET   0 63 $MKDEV hda b 5	# Currently.
-	$MKSET  64 63 $MKDEV hdb b 5	# Currently.
+	$MKSET   0 15 $MKDEV hda b 5	# Currently.
+	$MKSET  64 15 $MKDEV hdb b 5	# Currently.
 
 #	$MKSET   0 63 $MKDEV hda b 3	# Ought to be.
 #	$MKSET  64 63 $MKDEV hdb b 3	# Ought to be.
@@ -189,10 +189,10 @@
 ##############################################################################
 # BIOS hard disks.
 
-	$MKSET   0 63 $MKDEV bda b 3	# Currently
-	$MKSET  64 63 $MKDEV bdb b 3	# Currently
-	$MKSET 128 63 $MKDEV bdc b 3	# Currently
-	$MKSET 192 63 $MKDEV bdd b 3	# Currently
+	$MKSET   0 15 $MKDEV bda b 3	# Currently
+	$MKSET  64 15 $MKDEV bdb b 3	# Currently
+#	$MKSET 128 15 $MKDEV bdc b 3	# Currently
+#	$MKSET 192 15 $MKDEV bdd b 3	# Currently
 
 #	$MKSET   0 63 $MKDEV bda b 14	# Ought to be
 #	$MKSET  64 63 $MKDEV bdb b 14	# Ought to be

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-28 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-10  0:46 [PATCH] experimental: elkscmd: image building claudio
2004-07-28 13:55 ` *Applied* " Miguel Bolanos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox