Permalink
Browse files

Release ELKS 0.2.0 with massive improvements

Many improvements in this commit:

- Add a script "build.sh" that makes building ELKS dead simple

- Add a script "elkscmd/image_stats.sh" to get detailed image file
  statistics such as free space and inode counts

- Fix failure to build 360K floppy images due to insufficient
  available inodes. mkfs.minix defaults to 128 inodes for a 360K
  Minix filesystem, but the minimal root filesystem "min_rfs"
  would populate the image with well over 128 inodes. A disk image
  that has no free inodes is useless anyway, so the mkfs.minix
  options were modified to make 360 inodes for all images. The
  largest image available still has over 100 inodes available when
  fully populated, so there is plenty of room for the future.

- Add a new disk image type called 'full1722'. This image is made
  to fit on a 1.722MB formatted floppy disk. Most 1.44MB floppies
  can be formatted to 1.722MB using the Linux 'fdformat' command
  and special options. The only reason this has been added is to
  increase the available disk space for capable systems.

- Improved disk image creation options. There are now four ways to
  build all of the disk images and package them up:
  make images - build all image types but don't make an archive
  make images.zip - make images into a Zip archive
  make images.tar.xz - make images into a Gzip-compressed tarball
  make images.tar.xz - make images into a XZ-compressed tarball
  (images.tar.xz compresses to about 1/7 the size of the others)

- Disk image builds will automatically link /bin/sh to either ash
  (preferred) or sash, depending on what is available.

- All disk image build types were tested in QEMU to ensure they
  boot correctly.

- Bump kernel version to 0.2.0 (yay!)

- Pre-built disk images for ELKS 0.2.0 will be made generally
  available at:  https://github.com/jbruchon/elks/releases

Special thanks to Juan Perez-Sanchez for all his recent ELKS
kernel patches!
  • Loading branch information...
jbruchon committed Mar 1, 2015
1 parent dbffde5 commit 3c302cad12d34de58aba1b166da06c9173a43364
36 README
@@ -12,26 +12,54 @@ ELKS source code root. For a Dev86 source at /usr/src/dev86 do this:

user:/usr/src/elks$ ln -s /usr/src/dev86 dev86

The general build procedure is as follows:
A script that attempts to automate the build process and make it easier
for ELKS newbies has been provided. Simply run:

./build.sh

If you want to clean everything up afterwards, run './build.sh clean'
and it will run 'make clean' in the build directories for you.

The general build procedure for ELKS is as follows:

* Build Dev86, usually with default options

* Make sure 'dev86' is beside 'elks' 'elkscmd' etc.

* 'cd elks'

* 'make menuconfig' and configure the kernel

* Run 'make' to build the kernel
* 'cd ../elkscmd'
* 'make' (builds the core command line utilities)

* 'cd ../elksnet'

* 'make' (builds the networking components)

* 'cd ../elkscmd'

* 'make' (builds the core command line utilities)

* As root, run 'make [imagetype]' where image type is one of these:

- full3: 1.44MB 3.5" floppy image, all-inclusive

- full1722: same as full3 but on a 1.722MB 3.5" "extended format" floppy

- full5: 1.2MB 5.25" floppy image, all-inclusive

- comb: 720K floppy image, ELKS kernel plus minimal root filesystem

- comb_net: Same as 'comb' but with 'elksnet' components included

- boot: 360K floppy image, ELKS kernel only

- root: 360K floppy image, minimal root filesystem only
- images.zip: make every image type and zip them all into "images.zip"

- images: make all images but don't create an archive of them
- images.zip: make all images, pack into a Zip-compress archive
- images.tar.gz: make all images, pack into Gzip-compressed tar archive
- images.tar.xz: make all images, pack into XZ-compressed tar archive

Questions? Problems? Patches? Join and email the Linux-8086 mailing list at
linux-8086@vger.kernel.org or email the maintainer at jody@jodybruchon.com
110 build.sh
@@ -0,0 +1,110 @@
#!/bin/sh

# Quick and dirty build script for ELKS
# Probably buggy, but makes from-scratch builds easier

pause () {
echo
echo -n "Press a key to continue... "
read -n 1 -s
echo
}

clean_exit () {
E="$1"
test -z $1 && E=0
if [ $E -eq 0 ]
then echo "Build terminated successfully."
else echo "Build script has terminated with error $E"
fi
exit $E
}

# Disk images cannot be built unless we're UID 0
if [ "$UID" != "0" ]
then echo "WARNING: Disk images can only be built logged in as 'root'"
fi

# A copy of dev86 is REQUIRED to build!
if [ ! -e "./dev86" ]
then
echo "ERROR: You must copy or symlink 'dev86' to the root of the"
echo " ELKS source tree. If you don't have dev86, you can obtain"
echo " a copy at: https://github.com/lkundrak/dev86"
echo "Cannot build without dev86 in the source tree. Aborting."
exit 1
fi

# bcc is required (but has no --version switch, so test for stdio output)
if [ -z "$(bcc 2>&1)" ]
then
echo "ERROR: Cannot execute 'bcc'. You must build and install dev86 to"
echo " your system before attempting to build ELKS. Aborting."
exit 1
fi

# Working directory
WD="$(pwd)"


### Clean if asked
if [ "$1" = "clean" ]
then echo
echo "Cleaning up. Please wait."
sleep 1
for X in elks elkscmd elksnet
do cd $X; make clean; cd "$WD"
done
clean_exit 0
fi

### Kernel build
echo
echo "Preparing to build the ELKS kernel. This will invoke 'make menuconfig'"
echo "for you to configure the system. The defaults should be OK for many"
echo "systems, but you may want to review them."
pause
cd elks || clean_exit 1
make clean
make menuconfig || clean_exit 2
test -e .config || clean_exit 3
make defconfig || clean_exit 4
make -j4 || clean_exit 4
test -e arch/i86/boot/Image || clean_exit 4
cd "$WD"


### dev86 verification
echo "Verifying dev86 is built."
sleep 1
cd dev86 || clean_exit 5
make || clean_exit 5
cd "$WD"


### elksnet build
echo "Building 'elksnet'"
sleep 1
cd elksnet || clean_exit 6
make clean
make || clean_exit 6
cd "$WD"


### elkscmd build
echo "Building 'elkscmd'"
sleep 1
cd elkscmd || clean_exit 7
make clean
make || clean_exit 7


### Make image files
test $UID -ne 0 && echo "Skipping image file build (not root)." && clean_exit 0
make images.zip || clean_exit 8
make images.tar.gz || clean_exit 8
make images.tar.xz || clean_exit 8
cd "$WD"

echo "Images and image file archives are under 'elkscmd'."
clean_exit 0
@@ -72,16 +72,16 @@ endif
#########################################################################
# Define commands.

Image: include/linuxmt/autoconf.h $(ARCHIVES) init/main.o
Image: defconfig include/linuxmt/autoconf.h $(ARCHIVES) init/main.o
${MAKE} -C $(ARCH_DIR) Image

nbImage: include/linuxmt/autoconf.h $(ARCHIVES) init/main.o
nbImage: defconfig include/linuxmt/autoconf.h $(ARCHIVES) init/main.o
${MAKE} -C $(ARCH_DIR) nbImage

nb_install: nbImage
nb_install: defconfig nbImage
cp -f $(ARCH_DIR)/boot/nbImage $(TARGET_NB_IMAGE)

nbrd_install: nbImage
nbrd_install: defconfig nbImage
cp -f $(ARCH_DIR)/boot/nbImage $(ARCH_DIR)/boot/nbImage.rd
cat $(ARCH_DIR)/boot/nbRamdisk >> $(ARCH_DIR)/boot/nbImage.rd
cp -f $(ARCH_DIR)/boot/nbImage.rd $(TARGET_NB_IMAGE)
@@ -48,8 +48,8 @@
# State the current version of this system.

VERSION = 0 # (0-255)
PATCHLEVEL = 1 # (0-255)
SUBLEVEL = 5 # (0-255)
PATCHLEVEL = 2 # (0-255)
SUBLEVEL = 0 # (0-255)
#PRE = 1 # (0-255) If not a pre, comment this line.

#########################################################################
@@ -129,6 +129,9 @@ CFLAGS=$(CFLBASE) $(LOCALFLAGS) -I$(INC_DIR) "-DELKS_VERSION=\"$(ELKS_VSN)\""
COMB_TARGET_FS=$(ELKSCMD_DIR)/comb
COMB_TARGET_BLKS=720

FULL1722_TARGET_FS=$(ELKSCMD_DIR)/full1722
FULL1722_TARGET_BLKS=1722

FULL3_TARGET_FS=$(ELKSCMD_DIR)/full3
FULL3_TARGET_BLKS=1440

@@ -138,14 +141,14 @@ FULL5_TARGET_BLKS=1200
ROOT_TARGET_FS=$(ELKSCMD_DIR)/root
ROOT_TARGET_BLKS=360

ROOT_NET_TARGET_FS=$(ELKSCMD_DIR)/comb_net
ROOT_NET_TARGET_BLKS=720
COMB_NET_TARGET_FS=$(ELKSCMD_DIR)/comb_net
COMB_NET_TARGET_BLKS=720

SIBO_TARGET_FS=$(ELKSCMD_DIR)/sibo
SIBO_TARGET_BLKS=128

MKFS=/sbin/mkfs.minix
MKFS_OPTS=-n14
MKFS_OPTS=-n14 -1 -i360

MINIX_BOOT=$(DEV86_DIR)/bootblocks

@@ -35,20 +35,24 @@ FD_BSECT = $(MINIX_BOOT)/minix.bin

KHELPER = $(MINIX_BOOT)/minix_elks.bin

###############################################################################
#
# Names of all possible image files.

IMAGES = boot root comb comb_net full5 full3 full1722

###############################################################################
#
# Compile everything.

all:
if [ ! -e $(ELKS_DIR)/include/linuxmt/config.h ]; \
then echo -e "\n*** ERROR: You must build the ELKS kernel first ***\n" >&2; exit 1; fi
@for i in $(DIRS); do make -C $$i all ; done
+@for i in $(DIRS); do make -C $$i all ; done

clean:
-umount $(COMB_TARGET_FS) $(ROOT_TARGET_FS) $(ROOT_NET_TARGET_FS) \
$(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
-umount $(IMAGES) || true
-rm -f $(IMAGES) core images.zip images.tar.*
-rm -rf $(ROOTDIR)
-rm -f *~
-@for i in $(DIRS) $(DONTUSE) $(DONTWORK); do make -C $$i clean ; done
@@ -152,7 +156,9 @@ _build_nonbootable_target: _build_target
_build_target: all banner check_id _populate_target

_populate_target: _mount_target
-for i in $(DIRS); do make -C $$i $(TARGET_RFS); done >/dev/null
for i in $(DIRS); do make -C $$i $(TARGET_RFS); done >/dev/null
[ -e $(TARGET_MNT)/bin/ash ] && ln -sf ash $(TARGET_MNT)/bin/sh || \
ln -sf sash $(TARGET_MNT)/bin/sh
$(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
@@ -162,7 +168,7 @@ _mount_target:
then echo -e "\n\n *** Only root can build disk images *** \n\n"; exit 1; fi
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
$(MKFS) $(MKFS_OPTS) $(TARGET_FS) >/dev/null
mkdir -p $(TARGET_MNT)
mount $(LOOP) $(TARGET_FS) $(TARGET_MNT)
(cd $(ELKSCMD_DIR)/rootfs_template; \
@@ -181,6 +187,14 @@ check_id:
exit 1; \
fi

full1722:
@if [ "$(shell id -u)" != "0" ]; \
then echo -e "\n\n *** Only root can build disk images *** \n\n"; exit 1; fi
@$(MAKE) _build_bootable_target \
TARGET_FS=$(FULL1722_TARGET_FS) \
TARGET_RFS=rfs \
TARGET_BLKS=$(FULL1722_TARGET_BLKS) \
INSTALL_KTCP=yes
full3:
@if [ "$(shell id -u)" != "0" ]; \
then echo -e "\n\n *** Only root can build disk images *** \n\n"; exit 1; fi
@@ -195,7 +209,7 @@ full5:
then echo -e "\n\n *** Only root can build disk images *** \n\n"; exit 1; fi
@$(MAKE) _build_bootable_target \
TARGET_FS=$(FULL5_TARGET_FS) \
TARGET_RFS=rfs \
TARGET_RFS=max_rfs \
TARGET_BLKS=$(FULL5_TARGET_BLKS) \
INSTALL_KTCP=yes

@@ -211,9 +225,9 @@ comb_net:
@if [ "$(shell id -u)" != "0" ]; \
then echo -e "\n\n *** Only root can build disk images *** \n\n"; exit 1; fi
@$(MAKE) _build_bootable_target \
TARGET_FS=$(ROOT_NET_TARGET_FS) \
TARGET_RFS=net_rfs \
TARGET_BLKS=$(ROOT_NET_TARGET_BLKS) \
TARGET_FS=$(COMB_NET_TARGET_FS) \
TARGET_RFS=min_rfs \
TARGET_BLKS=$(COMB_NET_TARGET_BLKS) \
INSTALL_KTCP=yes

boot: $(ELKS_DIR)/arch/i86/boot/Image
@@ -235,8 +249,19 @@ sibo:
TARGET_RFS=smin_rfs \
TARGET_BLKS=$(SIBO_TARGET_BLKS)

images.zip: boot comb root comb_net full3 full5
zip images.zip boot root comb comb_net full3 full5
images: $(IMAGES)

images.zip: $(IMAGES)
zip -9q images.zip $(IMAGES)
-@stat -c "%s %n" images.zip

images.tar.gz: $(IMAGES)
tar -c $(IMAGES) | gzip -9 > images.tar.gz
-@stat -c "%s %n" images.tar.gz

images.tar.xz: $(IMAGES)
tar -c $(IMAGES) | xz -e > images.tar.xz
-@stat -c "%s %n" images.tar.xz

#######
# EOF #
@@ -68,18 +68,18 @@ all: ash
ash: $(OBJS)
$(CC) $(CFLAGS) -s -o ash $(OBJS) $(LIBS)

max_rfs: install

rfs: install

min_rfs: install
min_rfs:

net_rfs: install

smin_rfs:

install: ash
cp -p ash $(TARGET_MNT)/bin/ash
rm -f $(TARGET_MNT)/bin/sh
ln -s ash $(TARGET_MNT)/bin/sh

clean:
rm -f core ash $(CLEANFILES)
@@ -89,6 +89,8 @@ $(BINDIR)/bc: bc
$(LIBDIR)/libmath.b: libmath.b
install -c -o bin $? $@

max_rfs: all

rfs: all
cp -p bc $(TARGET_MNT)/bin
# cp -p fbc $(TARGET_MNT)/bin
@@ -86,9 +86,11 @@ all: $(PROGRAM)
$(PROGRAM): $(OBJS) $(LIBS)
$(LINKER) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)

max_rfs: install

rfs: install

min_rfs: all
min_rfs:

net_rfs:

@@ -40,6 +40,8 @@ SPROGS=mkfs

all: $(PROGS)

max_rfs: install

rfs: install

min_rfs: install
Oops, something went wrong.

0 comments on commit 3c302ca

Please sign in to comment.