Skip to content

Commit f04101e

Browse files
committed
[build] Tree & scripts housekeeping
1 parent 3907129 commit f04101e

File tree

15 files changed

+124
-144
lines changed

15 files changed

+124
-144
lines changed

.gitignore

+7-20
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,29 @@
11
#
22
# IDE local settings
33
#
4+
45
.project
5-
.DS_Store
66

77
#
88
# Build ignores
99
#
10+
1011
.config
1112
.config.old
1213

1314
*.o
1415
*.a
15-
*.1.gz
16-
Kbuild
17-
cross
18-
19-
#
20-
# Never ignore these
21-
#
22-
!.gitignore
16+
*.map
2317

2418
#
2519
# Normal output and testing dirs
2620
#
21+
22+
cross
2723
target
2824

2925
#
30-
# Backups / patches
26+
# Never ignore these
3127
#
32-
*~
33-
*.orig
34-
*.rej
3528

36-
#
37-
# Debugging stuff
38-
#
39-
*.map
40-
core
41-
.gdb_history
42-
.gdbinit
29+
!.gitignore

Makefile

+5-30
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,6 @@ endif
55

66
include $(TOPDIR)/Make.defs
77

8-
#########################################################################
9-
# Variables
10-
11-
# Specify the configuration shell to use.
12-
13-
CFG_SHELL := $(shell \
14-
if [ -x "$$bash" ]; \
15-
then echo $$bash ; \
16-
else if [ -x /bin/bash ]; \
17-
then echo /bin/bash ; \
18-
else if [ -x /usr/bin/bash ]; \
19-
then echo /usr/bin/bash ; \
20-
else if [ -x /usr/local/bin/bash ]; \
21-
then echo /usr/local/bin/bash ; \
22-
else echo sh ; \
23-
fi ; \
24-
fi ; \
25-
fi ; \
26-
fi)
27-
28-
#########################################################################
29-
# Rules
30-
318
.PHONY: all clean kconfig defconfig config menuconfig
329

3310
all: .config
@@ -36,7 +13,7 @@ all: .config
3613
$(MAKE) -C elks all
3714
$(MAKE) -C elkscmd all
3815
$(MAKE) -C image all
39-
-$(MAKE) -C elksemu PREFIX='$(TOPDIR)/cross' elksemu
16+
$(MAKE) -C elksemu PREFIX='$(TOPDIR)/cross' elksemu
4017

4118
clean:
4219
$(MAKE) -C libc clean
@@ -61,10 +38,8 @@ kconfig:
6138
defconfig:
6239
@yes '' | ${MAKE} config
6340

64-
config: elks/arch/i86/drivers/char/KeyMaps/config.in kconfig
65-
$(CFG_SHELL) config/Configure config.in
66-
67-
menuconfig: elks/arch/i86/drivers/char/KeyMaps/config.in kconfig
68-
$(CFG_SHELL) config/Menuconfig config.in
41+
config: elks/arch/i86/drivers/char/KeyMaps/config.in kconfig
42+
config/Configure config.in
6943

70-
#########################################################################
44+
menuconfig: elks/arch/i86/drivers/char/KeyMaps/config.in kconfig
45+
config/Menuconfig config.in

README.md

+55-38
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
![main](https://github.com/elks-org/elks/workflows/main/badge.svg)
66

77

8-
What is this ?
9-
--------------
8+
# What is this ?
109

1110
This is a project to write a Linux-like OS for systems based on the Intel
1211
IA16 architecture (16 bits processors: 8088, 8086, 80188, 80186, 80286,
@@ -17,61 +16,79 @@ recent SBC / SoC / FPGA that reuse the huge hardware & software legacy
1716
from that popular platform.
1817

1918

20-
How to build ?
21-
--------------
19+
# How to build ?
2220

23-
To build ELKS, you need a cross build tool chain, mainly based on the latest
24-
GCC-IA16 (DEV86 including BCC was used for previous versions, but has been
25-
dropped because it was obsolete and no more actively maintained).
21+
## Prerequisites
2622

27-
Among the dependencies there are packages (for Debian and Ubuntu distros):
28-
texinfo bison flex libgmp-dev libmpfr-dev libmpc-dev libncurses5-dev
23+
To build ELKS, you need a GNU development environment, including:
24+
- flex
25+
- bison
26+
- texinfo
27+
- libncurses5-dev
2928

30-
A script is provided to automatically download and build that tool chain:
29+
## Quickstart
3130

32-
'tools/build.sh'
31+
A script is provided to automate the whole build process
32+
(cross toool chain, configuration, kernel, user land and target image),
33+
and make it easier for ELKS newbies:
3334

34-
Note: all the scripts must be executed within the top folder 'elks/' as the
35-
current one.
35+
`./build.sh`
3636

37-
A script is provided to automate the whole build process (configuration,
38-
kernel, user land and target image) and make it easier for ELKS newbies:
37+
Note: all the scripts must be executed within the top folder of
38+
the ELKS repository as the current one (= TOPDIR).
3939

40-
'./build.sh'
40+
If you want to clean everything up afterwards (except the cross tool chain):
4141

42-
If you want to clean everything up afterwards, run './build.sh clean'
43-
and it will run 'make clean' in the build directories for you.
42+
`./clean.sh`
4443

45-
The general build procedure for ELKS is as follows:
44+
## Build steps
4645

47-
* Set up your environment (PATH, TOPDIR and CROSSDIR):
46+
1- Create a `cross` subfolder:
4847

49-
'. tools/env.sh' (note the '.' before the script)
48+
`mkdir cross`
5049

51-
* Build the cross chain in 'cross/' (see above)
50+
2- Build the cross tool chain, mainly based on a recent GCC-IA16
51+
(DEV86 including BCC was used for previous versions, but has been
52+
dropped because it was obsolete and no more maintained):
5253

53-
* Configure the build chain, the kernel, the user land and the target image
54-
format:
54+
`tools/build.sh`
5555

56-
'make menuconfig'
56+
Ubuntu 18.04 LTS users: as this step is quite long,
57+
you can download an already built cross folder from here:
58+
https://github.com/elks-org/elks/actions?query=workflow%3Across
5759

58-
* Build the kernel, the user land and the target image:
60+
3- Set up your environment (PATH, TOPDIR and CROSSDIR):
5961

60-
'make all'
62+
`. env.sh` (note the '.' before the script)
6163

62-
The target root folder is built in 'target/', and depending on your
63-
configuration, that folder is packed as either a floppy disk image (fd1440,
64-
fd1680, fd1200, fd720, fd360, without MBR), a hard-disk image (hd, with MBR),
65-
or a file image (ROM, TAR), into the '/image' folder.
64+
4- Configure the kernel, the user land and the target image format:
6665

67-
Before writting the image on the real device, you can test it first on QEMU
68-
with './qemu.sh' (will configure QEMU as an ISA system).
66+
`make menuconfig`
6967

68+
5- Build the kernel, the user land and the target image:
7069

71-
More information
72-
----------------
70+
`make all`
7371

74-
Questions? Problems? Patches? Open an issue in this project! You can also join
75-
and email the 'Linux-8086' list at [email protected].
72+
The target root folder is built in `target`', and depending on your
73+
configuration, that folder is packed as either a floppy disk image
74+
(fd360, fd720, fd1440), a hard disk image (hd, without MBR),
75+
or a file image (ROM, TAR), into the `image` folder.
7676

77-
More information in the Documentation folder: Documentation/index.html
77+
6- Before writting that image on the real medium,
78+
you can test it first on QEMU:
79+
80+
`./qemu.sh`
81+
82+
7- You can then modify the configuration or the sources and repeat from the
83+
step 4 after cleaning only the kernel, the user land and the image:
84+
85+
`make clean`
86+
87+
88+
# More information
89+
90+
Questions? Problems? Patches? Open an issue in this project!
91+
92+
You can also join and email the 'Linux-8086' list at [email protected].
93+
94+
More information in the Documentation folder: `Documentation/index.html`

build.sh

+21-43
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
#!/bin/bash
22

3-
# Quick and dirty build script for ELKS
3+
# Full build (including the cross tool chain)
4+
45
# Arguments:
5-
# - 'clean': full cleanup
66
# - 'auto' : continuous integration context
77

8-
DELAY=7
9-
10-
pause () {
11-
echo
12-
# 'read -n/-s' are bashisms, so work around them
13-
if [ -z "$BASH_VERSION" ]
14-
then
15-
echo "Starting in $DELAY seconds."
16-
sleep $DELAY
17-
else
18-
echo -n "Press a key to continue... "
19-
read -n 1 -s 2>/dev/null || sleep $DELAY
20-
fi
21-
echo
22-
}
8+
SCRIPTDIR="$(dirname "$0")"
239

2410
clean_exit () {
2511
E="$1"
@@ -31,56 +17,48 @@ clean_exit () {
3117
exit $E
3218
}
3319

34-
# Build environment setup
35-
# TODO: check script status on return
36-
. tools/env.sh
20+
# Environment setup
21+
22+
. "$SCRIPTDIR/env.sh"
23+
[ $? -ne 0 ] && clean_exit 1
3724

3825
# Build cross tools if not already
26+
3927
if [ "$1" != "auto" ]; then
4028
mkdir -p "$CROSSDIR"
41-
test -x "$CROSSDIR/bin/ia16-elf-gcc" || tools/build.sh || clean_exit 1
29+
test -f "$CROSSDIR/.gcc.install" || tools/build.sh || clean_exit 1
4230
fi
4331

44-
# Working directory
45-
WD="$(pwd)"
46-
47-
### Clean if asked
48-
if [ "$1" = "clean" ]
49-
then echo
50-
echo "Cleaning up. Please wait."
51-
sleep 1
52-
for X in config elks elkscmd
53-
do cd $X; make clean; cd "$WD"
54-
done
55-
clean_exit 0
56-
fi
32+
# Configure all
5733

58-
### Configure all (kernel + user land)
5934
if [ "$1" = "auto" ]; then
60-
echo "Invoking 'make defconfig'."
35+
echo "Invoking 'make defconfig'..."
6136
make defconfig || clean_exit 2
6237
else
6338
echo
6439
echo "Now invoking 'make menuconfig' for you to configure the system."
6540
echo "The defaults should be OK for many systems, but you may want to review them."
66-
pause
41+
echo -n "Press ENTER to continue..."
42+
read
6743
make menuconfig || clean_exit 2
6844
fi
6945

7046
test -e .config || clean_exit 3
7147

72-
### Clean all
48+
# Clean kernel, user land and image
49+
7350
if [ "$1" != "auto" ]; then
7451
echo "Cleaning all..."
75-
sleep 1
7652
make clean || clean_exit 4
7753
fi
7854

79-
### Build all
80-
echo "Building all..."
55+
# Build kernel, user land and image
8156
# Forcing single threaded build because of dirty dependencies (see #273)
57+
58+
echo "Building all..."
8259
make -j1 all || clean_exit 5
83-
test -e elks/arch/i86/boot/Image || clean_exit 6
8460

85-
echo "Target image is under 'image'."
61+
# Success
62+
63+
echo "Target image is in 'image' folder."
8664
clean_exit 0

clean.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Full clean (except the cross build chain)
4+
5+
SCRIPTDIR="$(dirname "$0")"
6+
7+
# Environment setup
8+
9+
. "$SCRIPTDIR/env.sh"
10+
[ $? -ne 0 ] && exit 1
11+
12+
make -C config clean
13+
14+
rm -f .config
15+
rm -f .config.old
16+
17+
make -C include clean
18+
19+
make clean

config/Configure

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /bin/sh
1+
#!/bin/bash
22
#
33
# This script is used to configure the ELKS kernel.
44
#

config/Makefile

-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ all:
66

77
clean:
88
$(MAKE) -C lxdialog clean
9-
-rm ../.config
10-
-rm ../.config.old
11-
-rm ../include/autoconf.h

config/Menuconfig

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /bin/sh
1+
#!/bin/bash
22
#
33
# This script is used to configure the ELKS kernel.
44
#

elkscmd/bootblocks/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ boot_probe.o: boot_probe.S
3333

3434
boot_minix.o: boot_minix.c
3535

36-
clean realclean:
37-
rm -f *.o *.bin
36+
clean:
37+
rm -f *.o *.bin *.map
3838

3939
# Boot blocks are not part of the target filesystem
4040
# but embedded in the target disk image

elksemu/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
elksemu

0 commit comments

Comments
 (0)