Overview
Context
Changes
Added Makefile version [280dbb44bc].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
MKDOSFS = /sbin/mkdosfs
ISOLINUX_BIN = /usr/share/syslinux/isolinux.bin
all: boot.fs boot.iso
boot.iso: boot.dir
mkisofs -o boot.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table boot.dir
boot.fs: boot.dir
-@mv ~/.mtoolsrc.appboxbak ~/.mtoolsrc >/dev/null 2>/dev/null
-@mv ~/.mtoolsrc ~/.mtoolsrc.appboxbak >/dev/null 2>/dev/null
rm -f boot.fs
$(MKDOSFS) -C boot.fs $$[$(shell du -sk boot.dir | cut -f 1) + 512]
echo -e 'drive m: file="'"$(shell pwd)/boot.fs"'"\nmtools_skip_check=1' > ~/.mtoolsrc
mcopy boot.dir/* m:
-@rm -f ~/.mtoolsrc
-@mv ~/.mtoolsrc.appboxbak ~/.mtoolsrc >/dev/null 2>/dev/null
syslinux boot.fs
boot.dir: boot.dir/vmlinuz boot.dir/initrd.img boot.dir/isolinux.cfg boot.dir/isolinux.bin boot.dir/syslinux.cfg
boot.dir/syslinux.cfg:
echo 'DEFAULT appbox' > boot.dir/syslinux.cfg
echo 'LABEL appbox' >> boot.dir/syslinux.cfg
echo ' KERNEL vmlinuz' >> boot.dir/syslinux.cfg
echo ' INITRD initrd.img' >> boot.dir/syslinux.cfg
boot.dir/isolinux.cfg: boot.dir/syslinux.cfg
cp boot.dir/syslinux.cfg boot.dir/isolinux.cfg
boot.dir/isolinux.bin: $(ISOLINUX_BIN)
cp $(ISOLINUX_BIN) boot.dir/isolinux.bin
boot.dir/vmlinuz: kernel/vmlinuz
-mkdir boot.dir
cp kernel/vmlinuz boot.dir/
boot.dir/initrd.img: kernel/modules initrd/init-earlyboot/init initrd/admin-tclkit/tclkit
rm -rf __tmp__initrd
mkdir __tmp__initrd
cp -rp kernel/modules __tmp__initrd/
cp initrd/init-earlyboot/init __tmp__initrd/
cp initrd/admin-tclkit/tclkit __tmp__initrd/
-mkdir boot.dir
( cd __tmp__initrd; find . | cpio -H newc -o > ../__tmp__initrd.img )
rm -rf __tmp__initrd
gzip -9c __tmp__initrd.img > boot.dir/initrd.img
rm -f __tmp__initrd.img
initrd/admin-tclkit/tclkit:
$(MAKE) -C initrd/admin-tclkit
kernel/vmlinuz kernel/modules:
$(MAKE) -C kernel vmlinuz modules
clean:
rm -rf boot.dir __tmp__initrd
rm -f boot.fs __tmp__initrd.img
$(MAKE) -C kernel clean
$(MAKE) -C initrd/admin-tclkit clean
distclean: clean
$(MAKE) -C kernel distclean
$(MAKE) -C initrd/admin-tclkit distclean
.PHONY: all clean distclean
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Modified build/doc
from [c28faf884f]
to [bc048b35bd].
︙ | | |
34
35
36
37
38
39
40
41
42
43
|
34
35
36
37
38
39
40
41
42
43
44
|
+
|
boot/modules/load
fstab
hostname
apps/<appname>
initrd:
/init
/tclkit
/modules/*.ko
/modules/load
|
Added build/images/logo-favicon.png version [9f4cf6829d].
cannot compute difference between binary files
Deleted components/init-earlyboot/functions version [7e04e0736f].
1
2
3
4
5
6
7
8
9
10
|
|
-
-
-
-
-
-
-
-
-
-
|
1. Load kernel modules
2. Mount devfs
3. Locate config partition
-> If not found, mount "/system" as tmpfs and perform installation
-> Offer to install
4. Load more kernel modules
5. Mount /system (if needed)
6. Mount /system/config (tmpfs) and copy contents to it
7. Unmount devfs
8. Pass control to later boot's init
|
Deleted components/init-earlyboot/init version [ecdb2e7262].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
#! /tclkit
proc load_modules {path} {
catch {
set fd [open [file join $path load]]
set modules [split [read $fd] "\n"]
close $fd
}
foreach module $modules {
if {![file exists $module]} {
puts stderr "\[module\] File not found: $module"
continue
}
if {[catch {
system::syscall::insmod $module
} err]} {
puts stderr "\[module\] Failed to load $module: $err"
}
}
}
proc locate_config_partition {} {
foreach dev [glob -nocomplain /dev/*] {
unset -nocomplain devinfo
catch {
file stat $dev devinfo
}
if {![info exists devinfo(type)]} {
continue
}
if {$devinfo(type) != "blockSpecial"} {
continue
}
unset -nocomplain fd
catch {
set fd [open $dev]
fconfigure $fd -translation binary
}
if {![info exists fd]} {
continue
}
set magic [read $fd 32]
binary scan $magic H* magic
if {$magic != "1daa459b9772ef5d7d58c814458246c69dbd1d53fa75f396462910250bf7a4b6"} {
continue
}
return $dev
}
return ""
}
proc boot {} {
package require system
# 1. Load kernel modules
load_modules /modules
# 2. Mount devfs
file mkdir /dev
system::syscall::mount devfs /dev devfs [list]
# 3. Locate Config partition
set dev [locate_config_partition]
if {$dev == ""} {
## XXX: Install to tmpfs
## XXX: Offer to do installation
} else {
# 4. Mount config partition
mount_config_partition $dev /config
# 5. Load kernel modules
load_modules /config/modules
# 5. Mount /system (from fstab)
## XXX: TODO
}
# 6. Mount /system/config and populate
system::syscall::mount tmpfs /system/config tmpfs [list]
# 7. Unmount devfs
system::syscall::umount /dev
file rmdir /dev
# 8. Pass control to later boot init
system::syscall::execve init /system/apps/appbox-core/default/sbin/init
}
if {[catch {
boot
} err]} {
puts stderr "\[boot\] Boot failed: $err"
}
while 1 {
puts -nonewline "> "
flush stdout
gets stdin line
set ret [catch {
eval $line
}]
if {$ret != ""} {
puts $ret
}
}
|
Added initrd/admin-tclkit/Makefile version [68532771b8].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
TCL_VERSION = 8.5.12
KITCREATOR_VERSION = 0.6.1
KITCREATOR_URL = http://www.rkeene.org/devel/kitcreator-$(KITCREATOR_VERSION).tar.gz
CC = diet gcc
all: tclkit
tclkit: kitcreator-$(KITCREATOR_VERSION) kitcreator-$(KITCREATOR_VERSION)/system
echo 'echo "#include <strings.h>" >> generic/tclInt.h' > kitcreator-$(KITCREATOR_VERSION)/tcl/patchscripts/fixstrcasecmp.sh
cd kitcreator-$(KITCREATOR_VERSION); KITCREATOR_PKGS='system' CC='$(CC)' ./kitcreator $(TCL_VERSION) --enable-kit-storage=cvfs --disable-load --disable-threads
cp kitcreator-$(KITCREATOR_VERSION)/tclkit-$(TCL_VERSION) tclkit
kitcreator-$(KITCREATOR_VERSION)/system: kitcreator-$(KITCREATOR_VERSION)
cp -rp kitcreator-modules/system kitcreator-$(KITCREATOR_VERSION)/
kitcreator-$(KITCREATOR_VERSION): kitcreator-$(KITCREATOR_VERSION).tar.gz
tar -xf kitcreator-$(KITCREATOR_VERSION).tar.gz
kitcreator-$(KITCREATOR_VERSION).tar.gz:
wget -O "$@.new" $(KITCREATOR_URL)
tar -tf "$@.new" >/dev/null
mv "$@.new" "$@"
clean:
rm -f kitcreator-$(KITCREATOR_VERSION).tar.gz kitcreator-$(KITCREATOR_VERSION).tar.gz.new
rm -f tclkit
rm -rf kitcreator-$(KITCREATOR_VERSION)
distclean: clean
.PHONY: all clean distclean
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added initrd/admin-tclkit/kitcreator-modules/system/build-common.sh version [1b93b7f590].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#! /bin/bash
set -e
case "$1" in
clean|distclean)
rm -rf out inst
rm -f libsystem.a system.o system.so
rm -f system.tcl.h
exit 0
;;
esac
./stringify.tcl system.tcl > system.tcl.h
|
| | | | | | | | | | | | |
Added initrd/admin-tclkit/kitcreator-modules/system/build-dyn.sh version [02da656833].
|
1
2
3
4
5
6
7
8
9
10
11
12
|
+
+
+
+
+
+
+
+
+
+
+
+
|
# /bin/bash
# Perform common build options
. build-common.sh
# Compile using the same options as Tcl
TCLCONFIGSH="$(find /usr/lib /usr/local/lib /lib -name tclConfig.sh -print -quit)"
. "${TCLCONFIGSH}"
echo "${TCL_CC} -Wall -DUSE_TCL_STUBS=1 ${TCL_DEFS} ${TCL_INCLUDE_SPEC} ${TCL_STUB_LIB_SPEC} -shared -rdynamic -o system.so system.c"
eval ${TCL_CC} -Wall -DUSE_TCL_STUBS=1 ${TCL_DEFS} ${TCL_INCLUDE_SPEC} ${TCL_STUB_LIB_SPEC} -shared -rdynamic -o system.so system.c
|
| | | | | | | | | | |
Added initrd/admin-tclkit/kitcreator-modules/system/build-static.sh version [a001c327e9].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#! /bin/bash
# Perform common build options
. build-common.sh
# Define variables
KITCREATORROOT="$(readlink -f '..')"
# Compile using the same options as Tcl
TCLCONFIGSH='/usr/lib/tclConfig.sh'
. "${TCLCONFIGSH}"
echo "diet ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c"
eval diet ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c
ar rcu libsystem.a system.o
ranlib libsystem.a
|
| | | | | | | | | | | | | | | |
Added initrd/admin-tclkit/kitcreator-modules/system/build.sh version [ad274edd90].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#! /bin/bash
# Perform common build options
. build-common.sh
# Define variables
KITCREATORROOT="$(readlink -f '..')"
# Compile using the same options as Tcl
TCLCONFIGSH="${KITCREATORROOT}/tcl/inst/lib/tclConfig.sh"
. "${TCLCONFIGSH}"
echo "${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c"
eval ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c
ar rcu libsystem.a system.o
ranlib libsystem.a
mkdir -p inst/lib/system1.0
mkdir -p out/lib/system1.0
cp libsystem.a inst/lib/system1.0
cp pkgIndex.tcl out/lib/system1.0
|
| | | | | | | | | | | | | | | | | | | | |
Added initrd/admin-tclkit/kitcreator-modules/system/pkgIndex.tcl version [1495e7ac95].
|
1
|
+
|
package ifneeded system 0.1 [list load "" system]
|
Added initrd/admin-tclkit/kitcreator-modules/system/stringify.tcl version [07e25e6903].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#! /usr/bin/env tclsh
proc stringifyfile {filename {key 0}} {
catch {
set fd [open $filename r]
}
if {![info exists fd]} {
return ""
}
set data [read -nonewline $fd]
close $fd
foreach line [split $data \n] {
set line [string map [list "\\" "\\\\" "\"" "\\\""] $line]
append ret " \"$line\\n\"\n"
}
return $ret
}
foreach file $argv {
puts -nonewline [stringifyfile $file]
}
exit 0
|
| | | | | | | | | | | | | | | | | | | | | | | | | |
Added initrd/admin-tclkit/kitcreator-modules/system/system.c version [0957cdeb4b].