Skip to content

Commit 86ba31d

Browse files
committed
Move image build from /elkscmd to /image
1 parent af9df8c commit 86ba31d

File tree

12 files changed

+146
-173
lines changed

12 files changed

+146
-173
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ cross
2525
# Normal output and testing dirs
2626
#
2727
target
28-
image
2928

3029
#
3130
# Backups / patches

Make.defs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#
2-
# Top level Makefile definitions
3-
#
1+
# Top level Makefile common definitions
42

53
ifndef TOPDIR
64
$(error TOPDIR is not defined)

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ CFG_SHELL := $(shell \
3333
all: .config
3434
$(MAKE) -C elks all
3535
$(MAKE) -C elkscmd all
36+
$(MAKE) -C image all
3637

3738
clean:
3839
$(MAKE) -C elks clean
3940
$(MAKE) -C elkscmd clean
41+
$(MAKE) -C image clean
4042
@echo
4143
@if [ ! -f .config ]; then \
4244
echo ' * This system is not configured. You need to run' ;\

build.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,5 @@ sleep 1
8989
make all || clean_exit 5
9090
test -e elks/arch/i86/boot/Image || clean_exit 6
9191

92-
### Make image files
93-
cd elkscmd
94-
make image
95-
96-
# TODO: restore the distribution build
97-
#make images.zip || clean_exit 8
98-
#make images.tar.gz || clean_exit 8
99-
#make images.tar.xz || clean_exit 8
100-
cd "$WD"
101-
102-
echo "Images and image file archives are under 'elkscmd'."
92+
echo "Target image is under 'image'."
10393
clean_exit 0

elkscmd/Make.defs

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ ELKSCMD_DIR=$(TOPDIR)/elkscmd
5454

5555
INCLUDES=-I$(TOPDIR)/include -I$(ELKS_DIR)/include
5656

57+
TARGET_MNT=$(TOPDIR)/target
58+
5759
##############################################################################
5860
#
5961
# Determine the ELKS kernel version.
@@ -87,7 +89,7 @@ CFLAGS=$(CFLBASE) $(LOCALFLAGS) $(INCLUDES) -D__ELKS__ -DELKS_VERSION=\"$(ELKS_V
8789

8890
LD=ld86
8991

90-
##############################################################################
92+
###############################################################################
9193
#
9294
# Standard compilation rules.
9395

@@ -103,62 +105,4 @@ LD=ld86
103105
.c.o:
104106
$(CC) $(CFLAGS) -c -o $*.o $<
105107

106-
#
107-
# Image file options
108-
#
109-
110-
IMGDIR=$(TOPDIR)/image
111-
112-
ifdef CONFIG_IMG_FD360
113-
TARGET_FILE=$(IMGDIR)/fd360
114-
TARGET_BLKS=360
115-
endif
116-
117-
ifdef CONFIG_IMG_FD720
118-
TARGET_FILE=$(IMGDIR)/fd720
119-
TARGET_BLKS=720
120-
endif
121-
122-
ifdef CONFIG_IMG_FD1200
123-
TARGET_FILE=$(IMGDIR)/fd1200
124-
TARGET_BLKS=1200
125-
endif
126-
127-
ifdef CONFIG_IMG_FD1440
128-
TARGET_FILE=$(IMGDIR)/fd1440
129-
TARGET_BLKS=1440
130-
endif
131-
132-
ifdef CONFIG_IMG_FD1680
133-
TARGET_FILE=$(IMGDIR)/fd1680
134-
TARGET_BLKS=1680
135-
endif
136-
137-
# FIXME: should use SIBODEV instead of MAKEDEV
138-
ifdef CONFIG_IMG_SIBO
139-
TARGET_FILE=$(IMGDIR)/sibo
140-
TARGET_BLKS=128
141-
endif
142-
143-
ifdef CONFIG_IMG_HD
144-
TARGET_FILE=$(IMGDIR)/hd
145-
TARGET_BLKS=$(CONFIG_IMG_BLOCKS)
146-
endif
147-
148-
#
149-
# Image filesystem options
150-
#
151-
152-
ifdef CONFIG_IMG_MINIX
153-
MKFS=mkfs.minix
154-
MKFS_OPTS=-1 -n14 -i360
155-
endif
156-
157-
MINIX_BOOT=$(ELKSCMD_DIR)/bootblocks
158-
159-
ifdef CONFIG_IMG_FAT
160-
MKFS=mkfs.vfat
161-
MKFS_OPTS=-v
162-
endif
163-
164-
TARGET_MNT=$(TOPDIR)/target
108+
###############################################################################

elkscmd/Make.rules

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#
2-
# ELKS Commands
3-
# Common rules
4-
#
1+
# Commands common rules
52

63
.PHONY: all clean install

elkscmd/Makefile

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -115,108 +115,21 @@ ifdef CONFIG_APP_TEST
115115
BUILDDIRS += test
116116
endif
117117

118-
###############################################################################
119-
#
120-
# State location of boot sector and boot helper.
121-
122-
FD_BSECT = $(MINIX_BOOT)/minix.bin
123-
124-
KHELPER = $(MINIX_BOOT)/minix_elks.bin
125-
126-
###############################################################################
127-
#
128-
# Names of all possible image files.
129-
130-
IMAGES = fd360 fd720 fd1440 fd1680
131-
132118
###############################################################################
133119
#
134120
# Compile everything.
135121

122+
include $(BASEDIR)/Make.rules
123+
136124
all:
137125
@if [ ! -e $(TOPDIR)/include/autoconf.h ]; \
138126
then echo -e "\n*** ERROR: You must configure ELKS first ***\n" >&2; exit 1; fi
139-
+@for DIR in $(BUILDDIRS); do $(MAKE) -C $$DIR all || exit 1; done
127+
for DIR in $(BUILDDIRS); do $(MAKE) -C $$DIR all || exit 1; done
140128

141-
images_clean:
142-
-umount -d $(IMAGES) || true
143-
-rm -f $(IMAGES) images.zip images.tar.*
129+
install:
130+
for i in $(BUILDDIRS); do $(MAKE) -C $$i install || exit 1; done
144131

145132
clean:
146-
-sudo umount -d $(TARGET_MNT) || true
147-
-rm -f $(IMAGES) core images.zip images.tar.*
148-
-rm -f *~
149-
@for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR clean || exit 1; done
133+
for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR clean || exit 1; done
150134

151135
###############################################################################
152-
#
153-
# Include standard packaging commands.
154-
155-
include $(BASEDIR)/Make.rules
156-
157-
###############################################################################
158-
#
159-
# Create disk images
160-
161-
kernel_image: $(ELKS_DIR)/arch/i86/boot/Image
162-
163-
boot_blocks: $(FD_BSECT) $(KHELPER)
164-
165-
ifdef CONFIG_IMG_BOOT
166-
image: boot_blocks kernel_image
167-
else
168-
image:
169-
endif
170-
mkdir -p $(IMGDIR)
171-
ifdef CONFIG_IMG_DEV
172-
-sudo umount -d $(TARGET_FILE)
173-
endif
174-
-sudo rm -rf $(TARGET_FILE)
175-
ifdef CONFIG_IMG_DEV
176-
dd if=/dev/zero of=$(TARGET_FILE) bs=1024 count=$(TARGET_BLKS)
177-
sudo $(MKFS) $(MKFS_OPTS) $(TARGET_FILE)
178-
endif
179-
-sudo rm -rf $(TARGET_MNT)
180-
mkdir -p $(TARGET_MNT)
181-
ifdef CONFIG_IMG_DEV
182-
sudo mount $(LOOP) $(TARGET_FILE) $(TARGET_MNT)
183-
endif
184-
(cd $(ELKSCMD_DIR)/rootfs_template; \
185-
tar cf - --exclude CVS --exclude .keep *) | \
186-
(cd $(TARGET_MNT); sudo tar xpf - --no-same-owner)
187-
ifdef CONFIG_IMG_LINK
188-
(cd $(TARGET_MNT)/dev; sudo ./MAKEDEV; sudo rm MAKEDEV MAKESET)
189-
endif
190-
for i in $(BUILDDIRS); do $(MAKE) -C $$i install || exit 1; done
191-
sudo bash -c "$(ELKSCMD_DIR)/tools/ver.pl $(ELKS_DIR)/Makefile-rules > $(TARGET_MNT)/etc/issue"
192-
ifdef CONFIG_IMG_BOOT
193-
sudo mkdir -p $(TARGET_MNT)/boot
194-
sudo install $(ELKS_DIR)/arch/i86/boot/Image $(TARGET_MNT)/boot/linux
195-
sudo install $(KHELPER) $(TARGET_MNT)/boot/boot
196-
endif
197-
ifdef CONFIG_IMG_DEV
198-
sudo umount -d $(TARGET_FILE)
199-
ifdef CONFIG_IMG_BOOT
200-
dd if=$(FD_BSECT) of=$(TARGET_FILE) bs=512 count=2 conv=notrunc
201-
endif
202-
endif
203-
ifdef CONFIG_IMG_ROM
204-
cd $(IMGDIR) && $(ELKS_DIR)/tools/mkromfs $(TARGET_MNT)
205-
endif
206-
207-
# These ones are now broken
208-
# Should be moved into a global script
209-
210-
images: $(IMAGES)
211-
212-
images.zip: $(IMAGES)
213-
zip -9q images.zip $(IMAGES)
214-
-@stat -c "%s %n" images.zip
215-
216-
images.tar.gz: $(IMAGES)
217-
tar -c $(IMAGES) | gzip -9 > images.tar.gz
218-
-@stat -c "%s %n" images.tar.gz
219-
220-
images.tar.xz: $(IMAGES)
221-
tar -c $(IMAGES) | xz -e > images.tar.xz
222-
-@stat -c "%s %n" images.tar.xz

image/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Image files
2+
*.bin

image/Make.defs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Make defines for images
2+
3+
ifndef TOPDIR
4+
$(error TOPDIR is not defined)
5+
endif
6+
7+
include $(TOPDIR)/Make.defs
8+
9+
# Dependencies folders
10+
11+
ELKS_DIR = $(TOPDIR)/elks
12+
ELKSCMD_DIR = $(TOPDIR)/elkscmd
13+
14+
MINIX_BOOT = $(ELKSCMD_DIR)/bootblocks
15+
FD_BSECT = $(MINIX_BOOT)/minix.bin
16+
KHELPER = $(MINIX_BOOT)/minix_elks.bin
17+
18+
# Image file options
19+
20+
IMGDIR=$(TOPDIR)/image
21+
22+
ifdef CONFIG_IMG_FD360
23+
TARGET_FILE = $(IMGDIR)/fd360.bin
24+
TARGET_BLKS = 360
25+
endif
26+
27+
ifdef CONFIG_IMG_FD720
28+
TARGET_FILE = $(IMGDIR)/fd720.bin
29+
TARGET_BLKS = 720
30+
endif
31+
32+
ifdef CONFIG_IMG_FD1200
33+
TARGET_FILE = $(IMGDIR)/fd1200.bin
34+
TARGET_BLKS = 1200
35+
endif
36+
37+
ifdef CONFIG_IMG_FD1440
38+
TARGET_FILE = $(IMGDIR)/fd1440.bin
39+
TARGET_BLKS = 1440
40+
endif
41+
42+
ifdef CONFIG_IMG_FD1680
43+
TARGET_FILE = $(IMGDIR)/fd1680.bin
44+
TARGET_BLKS = 1680
45+
endif
46+
47+
# FIXME: should use SIBODEV instead of MAKEDEV
48+
ifdef CONFIG_IMG_SIBO
49+
TARGET_FILE = $(IMGDIR)/sibo.bin
50+
TARGET_BLKS = 128
51+
endif
52+
53+
ifdef CONFIG_IMG_HD
54+
TARGET_FILE = $(IMGDIR)/hd.bin
55+
TARGET_BLKS = $(CONFIG_IMG_BLOCKS)
56+
endif
57+
58+
# Image filesystem options
59+
60+
ifdef CONFIG_IMG_MINIX
61+
MKFS = mkfs.minix
62+
MKFS_OPTS = -1 -n14 -i360
63+
endif
64+
65+
ifdef CONFIG_IMG_FAT
66+
MKFS = mkfs.vfat
67+
MKFS_OPTS = -v
68+
endif
69+
70+
TARGET_MNT = $(TOPDIR)/target

image/Make.rules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Images common rules
2+
3+
.PHONY: all clean install

0 commit comments

Comments
 (0)