-
Notifications
You must be signed in to change notification settings - Fork 0
/
minilinux.sh
executable file
·3417 lines (2871 loc) · 103 KB
/
minilinux.sh
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# shellcheck shell=dash
# FIXME! http_get() => curl + wget + autodelete on errors
# FIXME! document ttm.sh
# FIXME! uml-linux arch=um - make sure that this is OK:
# Checking that ptrace can change system call numbers...OK
# Checking syscall emulation patch for ptrace...OK
# Checking advanced syscall emulation patch for ptrace...OK
# Checking environment variables for a tempdir.../tmp/tmp.o9KloEryk0
# Checking if /tmp/tmp.o9KloEryk0 is on tmpfs...OK
# Checking PROT_EXEC mmap in /tmp/tmp.o9KloEryk0...OK
KERNEL="$1" # e.g. 'latest' or 'stable' or '5.4.89' or '4.19.x' or URL-to-tarball
ARG2="$2" # only used...
ARG3="$3" # ...for smoketest
ARG4="$4" # ...and 'plot'
for TAG in "$@"; do
case "$TAG" in
verbose) set -x ;;
*) export OPTIONS="$OPTIONS $TAG" ;; # see has_arg(), spaces are not working
esac
done
BASEDIR="$PWD/minilinux${BUILID:+_}${BUILDID}" # autoclean removes it later
WGETOPTS='--no-check-certificate' # TODO: use hashes instead?
UNIX0="$( date +%s )"
URL_TOYBOX='https://landley.net/toybox/downloads/toybox-0.8.9.tar.gz'
URL_BUSYBOX='https://busybox.net/downloads/busybox-1.36.0.tar.bz2'
URL_DASH='https://git.kernel.org/pub/scm/utils/dash/dash.git/snapshot/dash-0.5.12.tar.gz'
URL_BASH='http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-5.2.tar.gz'
URL_WIREGUARD='https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-1.0.20210914.zip'
URL_DROPBEAR='https://matt.ucc.asn.au/dropbear/releases/dropbear-2022.83.tar.bz2'
URL_SLIRP='https://github.com/bittorf/slirp-uml-and-compiler-friendly.git'
URL_IODINE='https://github.com/frekky/iodine/archive/master.zip' # fork has 'configure' + crosscompile support
URL_ZLIB='https://github.com/madler/zlib/archive/v1.2.13.tar.gz'
URL_ICMPTUNNEL='https://github.com/DhavalKapil/icmptunnel/archive/master.zip'
#URL_TAILSCALE='https://pkgs.tailscale.com/stable/tailscale_1.16.2_386.tgz'
#URL_TAILSCALE='https://pkgs.tailscale.com/stable/tailscale_1.18.0_386.tgz'
#URL_TAILSCALE='https://pkgs.tailscale.com/unstable/tailscale_1.19.132_386.tgz'
URL_LIBMNL='https://www.netfilter.org/projects/libmnl/files/libmnl-1.0.4.tar.bz2'
URL_LIBNFTNL='https://www.netfilter.org/projects/libnftnl/files/libnftnl-1.1.9.tar.bz2'
URL_IPTABLES='https://www.netfilter.org/projects/iptables/files/iptables-1.8.7.tar.bz2'
log() { >&2 printf '%s\n' "$1"; }
>/tmp/mydoc.txt
document() { local arg; for arg in "$@"; do printf '%s\n' "$arg"; done >>/tmp/mydoc.txt; }
export LC_ALL=C && document "export LC_ALL=C"
export STORAGE="/tmp/storage"
mkdir -p "$STORAGE" && log "[OK] cache/storage is here: '$STORAGE'"
# e.g. CPUINFO="24 @ Intel(R) Xeon(R) CPU X5680 @ 3.33GHz"
# shellcheck disable=SC2046
test -e /proc/cpuinfo && set -- $( grep ^'model name' /proc/cpuinfo | head -n1 ); shift 3; CPUINFO="$*"
# needed for parallel build:
NPROC="$( nproc || sysctl -n hw.ncpu || lsconf | grep -c 'proc[0-9]' )"
[ -z "$CPU" ] && CPU="$NPROC"
[ "${CPU:-0}" -lt 1 ] && CPU=1
[ "$CPU" = 1 ] && DEBUG=true
log "[OK] parallel build with -j$CPU on $CPUINFO"
# change from comma to space delimited list
OPTIONS="$OPTIONS $( echo "$FEATURES" | tr ',' ' ' ) $( test -n "$DEBUG" && echo 'debug' )"
has_arg()
{
local wish="$1" # e.g. 'printk' or 'iodine:credentials'
local string="${2:-$OPTIONS}"
local sub
case " $string " in
*" $wish "*) true ;;
*" ${wish%:*}:${wish#*:}:"*) # e.g. 'iodine:credentials:'
for sub in $string; do
case "$sub" in
"$wish"*)
# shellcheck disable=SC2046
set -- $( echo "$sub" | tr ':' ' ' )
# iodine:credentials:foo:bar:baz
export PARAM1="$3" # foo
export PARAM2="$4" # bar
export PARAM3="$5" # baz
return 0
;;
esac
done
false
;;
*)
# e.g. has_arg '*defconfig' and given 'foo_defconfig'
# shellcheck disable=SC2254
for sub in $string; do
case "$sub" in
$wish)
export THIS_ARG="$sub"
return 0
;;
esac
done
false
;;
esac
}
emit_doc()
{
local message="$1" # e.g. <any> or 'all' or 'apply_order'
local context file="${LINUX_BUILD:-.}/doc.txt"
case "$message" in
all)
cat "$file"
echo "see: '$file'"
echo " '$LINUX_BUILD/.config'"
;;
apply_order)
# grep '| applied:' run.sh | grep '| linux' | cut -d: -f2 | grep -v '# CONFIG'
grep 'applied' "$file"
echo "# see: '$file'"
;;
*)
context="$( basename "$PWD" )" # e.g. busybox or linux
echo >>"$file" "# doc | $context | $message"
;;
esac
}
msg_and_die()
{
local rc="$1"
local txt="$2"
local message="[ERROR] rc:$rc | pwd: $PWD | $txt"
local log="${LOG:-/dev/null}"
{
emit_doc "$message"
emit_doc 'all'
} | tee "$log"
echo >&2 "$message"
exit "$rc"
}
install_dep()
{
local package="$1" # e.g. gcc-i686-linux-gnu
local option="$2" # e.g. <empty> or 'weak'
local rc
dpkg -L "$package" >/dev/null || {
echo "[OK] need to install package '$package'"
[ -n "$APT_UPDATE" ] || {
if sudo apt-get update; then
APT_UPDATE='true'
else
log "rc:$? sudo apt-get update | but trying to go further"
fi
}
# Need to get 235 kB of archives.
# After this operation, 563 kB of additional disk space will be used.
# WARNING: The following packages cannot be authenticated!
# libfl-dev flex
# E: There are problems and -y was used without --force-yes
sudo apt-get install --force-yes -y "$package" || {
rc=$?
has_arg 'weak' && return 0
if [ "$option" = 'weak' ]; then
log "rc:$rc sudo apt-get install --force-yes -y $package"
false
else
msg_and_die "$rc" "sudo apt-get install --force-yes -y $package"
fi
}
}
}
is_uml() { false; }
DSTARCH_CMDLINE="$DSTARCH"
# autotranslate for most DSTARCH via feature commandline:
for MARCH in riscv armel armhf arm64 or1k m68k uml uml32 ppc i386 x86 x86_64 amd64; do has_arg "$MARCH" && DSTARCH="$MARCH"; done
case "$DSTARCH" in
riscv)
export ARCH='ARCH=riscv' QEMU='qemu-system-riscv64'
export BOARD='virt' DEFCONFIG='rv32_defconfig LOADADDR=0x80008000'
CROSS_DL='http://musl.cc/riscv64-linux-musl-cross.tgz'
;;
armel) # FIXME! on arm / qemu-system-arm / we should switch to qemu -M virt without DTB and smaller config
# see: https://github.com/landley/aboriginal/blob/master/sources/targets/armv5l
# old ARM, 32bit - from aboriginal linux target armv5l:
#
# "ARM v5, little endian, EABI with vector floating point (vfp).
# ARMv5 is the Pentium of the ARM world. Most modern arm hardware should be
# able to run this, and hardware that supports the v5 instruction set should run
# this about 25% faster than code compiled for v4."
#
export ARCH='ARCH=arm' QEMU='qemu-system-arm'
export BOARD='versatilepb' DTB='versatile-pb.dtb' DEFCONFIG='versatile_defconfig'
# "If your GCC installation is riscv64-linux-gnu-gcc, I recommend --target=riscv64-linux-gnu-"
# install_dep 'gcc-arm-linux-gnueabi' && export CROSSCOMPILE='CROSS_COMPILE=arm-linux-gnueabi-'
CROSS_DL='https://musl.cc/armel-linux-musleabi-cross.tgz'
# https://github.com/zerotier/ZeroTierOne/blob/master/make-linux.mk#L278
export CF_ADD='-marm -march=armv5te -mfloat-abi=soft -msoft-float -mno-unaligned-access'
;;
armhf) # https://superuser.com/questions/1009540/difference-between-arm64-armel-and-armhf
# https://wiki.musl-libc.org/getting-started.html#Notes-on-ARM-Float-Mode
# https://landley.net/notes-2017.html#04-05-2017
# arm7 / 32bit with power / EABI hard float
export ARCH='ARCH=arm' QEMU='qemu-system-arm' # https://github.com/oreboot/oreboot
# FIXME! qemu-system-arm -machine virt -bios target/arm-none-eabihf/release//oreboot.bin -nographic -m 1024M
export BOARD='vexpress-a9' DTB='vexpress-v2p-ca9.dtb' DEFCONFIG='vexpress_defconfig'
# install_dep 'gcc-arm-linux-gnueabihf' && export CROSSCOMPILE='CROSS_COMPILE=arm-linux-gnueabihf-'
CROSS_DL='https://musl.cc/armv7l-linux-musleabihf-cross.tgz'
# https://wiki.alpinelinux.org/wiki/Custom_Kernel
export CF_ADD="-marm -march=armv7-a -mfpu=vfp"
;;
arm64) # new ARM, 64bit
# https://github.com/ssrg-vt/hermitux/wiki/Aarch64-support
export ARCH='ARCH=arm64' QEMU='qemu-system-aarch64'
export BOARD='virt' DEFCONFIG='tinyconfig'
# install_dep 'gcc-aarch64-linux-gnu' && export CROSSCOMPILE='CROSS_COMPILE=aarch64-linux-gnu-'
CROSS_DL='https://musl.cc/aarch64-linux-musl-cross.tgz'
;;
or1k) # OpenRISC, 32bit
# https://wiki.qemu.org/Documentation/Platforms/OpenRISC
export ARCH='ARCH=openrisc' QEMU='qemu-system-or1k'
export BOARD='or1k-sim' DEFCONFIG='tinyconfig'
CROSS_DL="https://musl.cc/or1k-linux-musl-cross.tgz"
OPTIONS="$OPTIONS 32bit"
;;
m68k)
# see: arch/m68k/Kconfig.cpu
# TODO: coldfire vs. m68k_classic vs. freescale/m68000 (nommu)
# https://www.reddit.com/r/archlinux/comments/ejkp1x/what_is_the_name_of_this_font/fczfy60/
# https://news.ycombinator.com/item?id=25027213
# http://users.telenet.be/geertu/Linux/68000/
# https://elinux.org/Flameman/mac68k
export ARCH='ARCH=m68k' QEMU='qemu-system-m68k'
export BOARD='q800' DEFCONFIG='tinyconfig'
# install_dep 'gcc-m68k-linux-gnu' && export CROSSCOMPILE='CROSS_COMPILE=m68k-linux-gnu-'
CROSS_DL='https://musl.cc/m68k-linux-musl-cross.tgz'
;;
ppc) # 32bit
# https://stackoverflow.com/questions/26450980/qemu-system-ppc-does-not-seem-to-boot
# https://stackoverflow.com/questions/22004616/how-to-debug-the-linux-kernel-with-qemu-and-kgdb
# https://github.com/66RING/Notes/blob/master/universe/qemu/powerpc_sim.md
# https://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02728.html
# https://github.com/torvalds/linux/blob/master/arch/powerpc/platforms/Kconfig.cputype
export ARCH='ARCH=powerpc' QEMU='qemu-system-ppc'
export BOARD='mpc8544ds' DEFCONFIG=mpc85xx_defconfig
CROSS_DL='http://musl.cc/powerpc-linux-muslsf-cross.tgz'
OPTIONS="$OPTIONS 32bit"
# TODO: u-boot-tools
;;
ppc64) # big endian
# https://issues.guix.gnu.org/41669
;;
ppc64le)# IBM Power8/9 = "PowerISA 3.1" = powerpc64le
:
;;
um*) # http://uml.devloop.org.uk/kernels.html
# https://unix.stackexchange.com/questions/90078/which-one-is-lighter-security-and-cpu-wise-lxc-versus-uml
[ "$DSTARCH" = 'uml32' ] && OPTIONS="$OPTIONS 32bit"
is_uml() { true; }
export ARCH='ARCH=um'
export DEFCONFIG='tinyconfig'
export UML_PATCHES_APPLY= # FIXME! must be true for older kernels
if has_arg '32bit'; then
export DSTARCH='uml32'
# install_dep 'gcc-i686-linux-gnu' && export CROSSCOMPILE='CROSS_COMPILE=i686-linux-gnu-'
if [ "$QEMUCPU" = 486 ]; then
CROSS_DL="https://musl.cc/i486-linux-musl-cross.tgz"
else
CROSS_DL="https://musl.cc/i686-linux-musl-cross.tgz" # test "$(arch)" != i686 ???
fi
else
export DSTARCH='uml'
CROSS_DL="https://musl.cc/x86_64-linux-musl-cross.tgz"
fi
;;
i386|i486|i586|i686|x86|x86_32)
DSTARCH='i686' # 32bit
OPTIONS="$OPTIONS 32bit"
export DEFCONFIG='tinyconfig' QEMU='qemu-system-i386'
export ARCH='ARCH=i386'
if [ "$QEMUCPU" = 486 ]; then
CROSS_DL="https://musl.cc/i486-linux-musl-cross.tgz"
else
# install_dep 'gcc-i686-linux-gnu' && export CROSSCOMPILE='CROSS_COMPILE=i686-linux-gnu-'
CROSS_DL="https://musl.cc/i686-linux-musl-cross.tgz"
fi
;;
x86_64|amd64|*)
DSTARCH='x86_64'
# export ARCH='ARCH=x86_64' # TODO: keep native arch?
export DEFCONFIG='tinyconfig'
export QEMU='qemu-system-x86_64'
CROSS_DL="https://musl.cc/x86_64-linux-musl-cross.tgz"
has_arg 'zig' && CROSS_DL='https://ziglang.org/builds/zig-linux-x86_64-0.8.0-dev.1548+0d96a284e.tar.xz'
# CF_ADD='-fno-pie' # needed for kernel 2.6.32.71
;;
esac
has_arg 'tinyconfig' && DEFCONFIG='tinyconfig' # supported since kernel 3.17-rc1
has_arg 'allnoconfig' && DEFCONFIG='allnoconfig'
has_arg 'defconfig' && DEFCONFIG='defconfig'
has_arg 'config' && DEFCONFIG='config' # e.g. kernel 2.4.x
has_arg '*defconfig' && DEFCONFIG="$THIS_ARG" # e.g. mvme16x_defconfig
has_arg '*defconfig' && OPTIONS="$OPTIONS procfs sysfs" # a hack for generating proper init
case "$DSTARCH" in
uml*)
;;
ppc)
install_dep 'qemu-system'
install_dep 'qemu-system-misc'
install_dep 'u-boot-tools'
;;
or1k|m68k|riscv)
install_dep 'qemu-system'
install_dep 'qemu-system-misc'
;;
*)
install_dep 'qemu-system'
;;
esac
if has_arg 'debug'; then
SILENT_MAKE='V=s'
else
SILENT_MAKE='--silent'
SILENT_CONF='--enable-silent-rules'
fi
STRIP="$( command -v 'strip' || echo 'false' )"
log "[OK] building kernel '$KERNEL' on arch '$DSTARCH' and options '$OPTIONS'"
deps_check()
{
local cmd list
install_dep 'coreutils' # e.g. stdbuf
install_dep 'build-essential'
install_dep 'flex'
install_dep 'bison'
install_dep 'automake'
install_dep 'whois'
# FIXME! 'program_name' not always 'package_name',
# e.g. 'mkpasswd' is in package 'whois'
# essential:
list='arch base64 basename cat chmod cp file find grep gzip head make mkdir rm sed'
list="$list strip tar tee test touch tr wget mkpasswd"
# these commands are used, but are not essential:
# apt, bc, curl, dpkg, ent, hexdump, hunspell, sstrip, upx, vimdiff, xz, zstd, xxd
for cmd in $list; do {
command -v "$cmd" >/dev/null || {
printf '%s\n' "[ERROR] missing command: '$cmd' - please install"
return 1
}
} done
true
}
deps_check || exit
kernels()
{
case "$1" in
0) echo 'https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.16.83.tar.xz' ;; # TODO: 32bit
1) echo 'https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.222.tar.xz' ;;
2) echo 'https://mirrors.edge.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.xz' ;; # TODO: 32bit?
3) echo 'https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.222.tar.xz' ;;
4) echo 'https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.121.tar.xz' ;;
5) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.5.19.tar.xz' ;;
6) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.11.tar.xz' ;;
7) echo 'https://git.kernel.org/torvalds/t/linux-5.7-rc4.tar.gz' ;;
8) echo 'https://mirrors.edge.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.4.tar.xz' ;;
9) echo 'https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.0.1.tar.gz' ;;
10) echo 'https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/linux-2.4.git/snapshot/linux-2.4-2.4.37.11.tar.gz' ;;
11) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.7.tar.xz' ;;
12) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.8.12.tar.xz' ;;
13) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.9.tar.xz' ;;
14) echo 'https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.10.1.tar.bz2' ;;
15) echo 'https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.17.tar.xz' ;;
16) echo 'https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.18.tar.xz' ;;
17) echo 'https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.19.tar.xz' ;;
18) echo 'https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.19.8.tar.xz' ;;
19) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.9.1.tar.xz' ;;
20) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.6.tar.xz' ;;
21) echo 'https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.215.tar.xz' ;;
22) echo 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.89.tar.xz' ;;
23) echo 'https://mirrors.edge.kernel.org/pub/linux/kernel/v2.4/linux-2.4.26.tar.xz' ;;
latest|stable) wget $WGETOPTS -qO - https://www.kernel.org | grep -A1 "latest_link" | tail -n1 | cut -d'"' -f2 ;;
*) log "[ERROR] kernels() bad input '$1'"; false ;;
esac
}
string_hash()
{
echo "$1" | sha256sum | cut -d' ' -f1
}
download()
{
local url="$1"
local dest="${2:-.}"
local cache
[ -z "$url" ] && log "[ERROR] download() empty url" && exit 1
cache="$STORAGE/$( string_hash "$url" )-$( basename "$url" )"
# e.g. during massively parallel run / release
while [ -f "$cache-in_progress" ]; do {
log "wait for disappear of '$cache-in_progress'"
sleep 30
} done
if [ -s "$cache" ]; then
log "[OK] download, using cache: '$cache' url: '$url'"
cp "$cache" $dest
else
touch "$cache-in_progress"
wget $WGETOPTS -O "$cache" "$url" || rm -f "$cache"
rm "$cache-in_progress"
cp "$cache" $dest
fi
}
untar() # and delete
{
local file="$1"
local mime
mime="$( file --brief --mime "$file" )"
case "$mime" in
application/zip*) unzip "$1" && rm "$1" ;;
application/x-lzma*) tar xJf "$1" && rm "$1" ;;
application/x-xz*) tar xJf "$1" && rm "$1" ;;
application/x-bzip2*) tar xjf "$1" && rm "$1" ;;
application/gzip*) tar xzf "$1" && rm "$1" ;;
application/x-gzip*) tar xzf "$1" && rm "$1" ;;
*)
log "untar() file '$file' unknown mime-type: $mime"
false
;;
esac
}
autoclean_do()
{
cd "$BASEDIR" && cd .. && rm -fR "$BASEDIR"
{
printf '\n%s\n' "[OK] autoclean done, build ready after $(( $(date +%s) - UNIX0 )) sec"
printf '%s\n%s\n' "repeat with:" "CPU=$CPU DEBUG=true $0 smoketest_for_release $DSTARCH_CMDLINE $KERNEL"
} >>"${LOG:-/dev/null}"
}
makedir_gointo_and_cleanup()
{
local dir="$1"
mkdir -p "$dir" || exit 1
cd "$dir" || exit 1
rm -fR ./* || exit 1 # always cleanup
}
humanreadable_lines()
{
local file="$1"
local minlength="${2:-3}"
local line word lang lang_list=
local file_dict2 file_dict3 url_dict2
# maybe use: /usr/share/dict/words
file_dict2="$( mktemp )"
file_dict3="$( mktemp )"
url_dict2="https://users.cs.duke.edu/~ola/ap/linuxwords"
download "$url_dict2" "$file_dict2"
sed 's/[^a-zA-Z]/ /g' "$file" | while read -r line; do {
for word in $line; do {
case "${#word}" in
1|2) ;;
*) printf '%s\n' "$word" ;;
esac
} done
} done >"$file_dict3"
install_dep 'hunspell'
for lang in $( find /usr/share/hunspell/ -type f -iname '*.dic' | sed -n 's|^.*/\(.*\).dic|\1|p' | sort ); do {
case "$lang" in
en*|de*|es*|ro*)
lang_list="${lang_list}${lang_list:+,}$lang"
;;
esac
} done
log "[OK] lang_list: $lang_list"
words() {
# apt-get install myspell-fr myspell-es hunspell-en-* hunspell-de-at hunspell-de-ch hunspell-de-de hunspell-de-med
hunspell -G -d $lang_list -l "$file_dict3" | sed -r "/^.{,$minlength}$/d" | while read -r word; do {
printf '%s ' "$word"
} done
}
log "[OK] words: $( words )"
count() {
hunspell -G -d $lang_list -l "$file_dict3" | sed -r "/^.{,$minlength}$/d" | wc -l
}
log "[OK] word count: $( count )"
# strip spaces/tabs and non-printable (ascii-subset) and show only lines >6 chars
# tr -cd '\11\12\15\40-\176' <"$file" | sed "s/[[:space:]]\+//g" | sed -r "/^.{,$minlength}$/d" | wc -l
# sed 's/[^a-zA-Z0-9 ]//g' "$file" | grep --text -F -f "$file_dict1" | sed 's/[^a-zA-Z0-9 ]//g' | sed -r "/^.{,$minlength}$/d" | wc -l
rm "$file_dict2" "$file_dict3"
}
plot_progress()
{
local logfile="$1" # see init_meshack()
local x="${2:-5000}"
local y="${3:-880}"
local mem1 mem2 ramsize sec line line2 name max=0
local temp1 temp2 temp3 temp4 val1 val2 val3 taskname id sec_start min=9999
local heading1='bootstraping a full system'
local heading2='https://github.com/fosslinux/live-bootstrap @ 8504c35'
temp1="$( mktemp )" || return 1 # logfile -> DEBUG-lines only
temp2="$( mktemp )" || return 1 # DEBUG-lines -> values
temp3="$( mktemp )" || return 1 # GNU-plot.program
temp4="$( mktemp )" || return 1 # outfile.png
# sed -n 's/^\(..\)h\(..\)m\(..\)s .*\(DEBUG_MemFree:[0-9] kB\).*/\1 \2 \3 \4/p' LOG >T
# 00h59m48s | DEBUG_Mem free: 92728 avail: 448580
sed -n 's/^\(..\)h\(..\)m\(..\)s .*\(DEBUG_Mem free: [0-9].*\).*/\1 \2 \3 \4/p' "$logfile" >"$temp1"
# 00h52m55s | DEBUGps: before_build: automake-1.7 | 264
sed -n 's/^\(..\)h\(..\)m\(..\)s .*\(ps: .*_build: .* | [0-9]*\)/\1 \2 \3 \4/p' "$logfile" >>"$temp1"
# size in *megabytes* or FIXME: gigabytes
ramsize="$( grep 'qemu-system' "$logfile" | sed -n 's/^.*qemu-system.* -m \([0-9]*\)[MG] .*/\1/p' )"
timestamps_to_seconds()
{
local val1="$1"
local val2="$2"
local val3="$3"
while case "$val1" in 0*) ;; *) false ;; esac do val1=${val1#?}; done
while case "$val2" in 0*) ;; *) false ;; esac do val2=${val2#?}; done
while case "$val3" in 0*) ;; *) false ;; esac do val3=${val3#?}; done
sec=$(( val1*3600 + (val2*60) + val3 ))
}
isnumber()
{
case "$1" in
[0-9]|\
[0-9][0-9]|\
[0-9][0-9][0-9]|\
[0-9][0-9][0-9][0-9]|\
[0-9][0-9][0-9][0-9][0-9]| \
[0-9][0-9][0-9][0-9][0-9][0-9]| \
[0-9][0-9][0-9][0-9][0-9][0-9][0-9]) true ;;
*) false ;;
esac
}
# resulting FORMAT: seconds used_megabytes_free used_megabytes_avail
#
{
echo '#!/usr/bin/env gnuplot'
echo
echo "\$MEM <<EOD"
while read -r line; do {
case "$line" in *'DEBUG_Mem'*) ;; *) continue ;; esac
# e.g. 00 49 39 DEBUG_Mem free: 226296 avail: 670244
set -- $line
timestamps_to_seconds "$1" "$2" "$3" # sets var $sec
isnumber "$6" || continue
isnumber "$8" || continue
mem2=$((ramsize-($8/1024)))
mem1=$((ramsize-($6/1024))) && {
test $mem1 -gt $max && max=$mem1
test $mem1 -lt $min && min=$mem1
}
printf '%s\n' "$sec $mem1 $mem2"
} done <"$temp1"
echo 'EOD'
} >"$temp3"
insert_from_to_as()
{
local file="$logfile"
local from="$1"
local to="$2"
local as="$3"
local line1 line2 t1 t2
# first match:
line1="$( grep " | $from" "$file" )" || { log "notfound: $from" && return 1; }
line1="$( grep " | $from" "$file" | head -n1 )"
line2="$( grep " | $to" "$file" )" || { log "notfound: $to" && return 1; }
line2="$( grep " | $to" "$file" | head -n1 )"
line1="$( echo "$line1" | sed -n 's/^\(..\)h\(..\)m\(..\)s \(.*\)/\1 \2 \3 \4/p' )"
line2="$( echo "$line2" | sed -n 's/^\(..\)h\(..\)m\(..\)s \(.*\)/\1 \2 \3 \4/p' )"
set -- $line1
timestamps_to_seconds "$1" "$2" "$3"
t1=$sec
set -- $line2
timestamps_to_seconds "$1" "$2" "$3"
t2=$sec
printf '%s\n' "$as $t1 $t2 $(( t2 - t1 ))"
}
# TODO: add early tasks eplicitely using fixed search patterns
# 00 36 47 DEBUGps: before_build: perl-5.000 | buildid 20 | ps: 47
# 00 36 47 DEBUGps: before_build: perl-5.000 | buildid 20 | READY: 3284 <--- 1st
# 00 36 49 DEBUGps: after_build: perl-5.000 | buildid 20 | ps: 48
# 00 36 49 DEBUGps: after_build: perl-5.000 | buildid 20 | READY: 3284 <--- 2nd
{
echo
echo "\$STEPS <<EOD"
# https://github.com/fosslinux/live-bootstrap/blob/master/parts.rst
# +> ../bin/kaem --verbose --strict -f mescc-tools-full-kaem.kaem
insert_from_to_as '+> ./hex0 kaem-minimal.hex0 kaem-0' 'Hello,M2-mes!' 'stage0'
insert_from_to_as '+> .* -o cp.M1' '+> .*cp --exec_enable' 'cp'
insert_from_to_as '+> .* -o chmod.M1' '+> .*chmod --exec_enable' 'chmod'
insert_from_to_as '+> M2-Planet .* -f fletcher16.c' '/after/bin/fletcher16: OK' 'fletcher16'
insert_from_to_as 'Hello,M2-mes!' 'Hello,Mes!' 'M2-mes...Mes'
insert_from_to_as 'Hello,Mes!' '+> mes-tcc -version' 'mes-tcc'
insert_from_to_as 'tcc version 0.9.26 (i386 Linux)' '+> boot5-tcc -version' 'tcc-0.9.26'
insert_from_to_as '+> pkg=untar' '/after/bin/untar: OK' 'untar'
insert_from_to_as '+> pkg=gzip-1.2.4' '/after/bin/zcat: OK' 'gzip'
insert_from_to_as '+> pkg=tar-1.12' '/after/bin/tar: OK' 'tar'
insert_from_to_as '+> pkg=sed-4.0.9' '/after/bin/sed: OK' 'sed'
insert_from_to_as '+> pkg=patch-2.5.9' '/after/bin/patch: OK' 'patch'
insert_from_to_as '+> pkg=sha-2-61555d' '/after/bin/sha256sum: OK' 'sha256sum'
insert_from_to_as '+> pkg=make-3.80' '/after/bin/make: OK' 'make-3.80'
insert_from_to_as '+> pkg=bzip2-1.0.8' '/after/bin/bzip2: OK' 'bzip2'
insert_from_to_as '+> pkg=tcc-0.9.27' '/after/bin/tcc: OK' 'tinycc-0.9.27'
insert_from_to_as '+> pkg=coreutils-5.0' '/after/bin/rm: OK' 'coreutils-5.0'
insert_from_to_as '+> pkg=heirloom-devtools-070527' '/after/bin/yacc: OK' 'heirloom-yacc'
insert_from_to_as '+> pkg=bash-2.05b' '/after/bin/bash: OK' 'bash-2.05b'
# shellcheck disable=SC2094
while read -r line; do {
case "$line" in *'ps: before_build: '*' | READY: '*) ;; *) continue ;; esac
set -- $line
timestamps_to_seconds "$1" "$2" "$3" # sets var $sec
sec_start=$sec
taskname=$6
id=$9
# shellcheck disable=SC2094
if line2="$( grep "after_build: $taskname | buildid $id | " "$temp1" )"; then
set -- $line2
timestamps_to_seconds "$1" "$2" "$3" # sets var $sec
printf '%s\n' "$taskname-$id $sec_start $sec $(( sec - sec_start ))"
else
log "rc: $? line: $line"
log "strange: NOT found: 'after_build: $taskname | buildid $id | READY: '"
log "is: |$( grep "fter_build: $taskname" "$temp1" )|"
fi
} done <"$temp1"
echo 'EOD'
} >>"$temp3"
# printf '%s\n%s\n%s\n%s\n%s\n' "set term png size 1920,1080" "set output 'bootstrap.png'" "set xlabel 'run time in [seconds]'" "set ylabel 'used RAM in [megabytes] out of $RAM total'" "plot 'data.txt' using 1:2 with lines, '' using 1:3 with lines" >BOOT.gnuplot
#
cat >>"$temp3" <<EOF
set term png size $x,$y
set output '$temp4'
set xlabel 'run time in [seconds]'
set ylabel 'used RAM in [megabytes] out of $ramsize total (min: $min peak-usage: $max)'
set ytics 50
set xtics 60
set mxtics 4
set grid x y
set key left top
set title "{/=15 $heading1}\n\n{/:Bold $heading2}"
set border 3
set style arrow 66 head filled size 3, 3, 3 fixed linetype 3 linewidth 12
plot \$MEM using 1:2 title 'Used_A = MemTotal minus MemFree' with lines, \\
'' using 1:3 title 'Used_B = MemTotal minus MemAvail' with lines, \\
\$STEPS using 2 : (\$0)*16 : 4 : (0.0) with vector as 66 notitle, \\
\$STEPS using 2 : (\$0)*16 : 1 with labels font "Times,8" right offset 7 notitle
EOF
gnuplot -p "$temp3"
name="$( basename "$logfile" )-${ramsize}M"
set -x
chmod 777 "$temp4" "$temp3"
scp "$temp4" [email protected]:/var/www/bootstrap/memplot-$name.png
scp "$temp3" [email protected]:/var/www/bootstrap/memplot-$name.txt
scp "$logfile" [email protected]:/var/www/bootstrap/memplot-$name-log.txt
set +x
rm "$temp1" "$temp2" "$temp3" "$temp4"
}
case "$KERNEL" in
'humanreadable_lines'|'hl')
humanreadable_lines "$ARG2" "$ARG3"
exit $?
;;
'smoketest'*)
LIST_ARCH='armel armhf arm64 or1k m68k uml uml32 x86 x86_64'
LIST_KERNEL='3.18 3.18.140 3.19.8 4.0.9 4.1.52 4.2.8 4.3.6 4.4.261 4.9.261 4.14.225 4.19.180 5.4.105 5.10.23 5.11.6'
FULL='printk procfs sysfs busybox bash dash net wireguard iodine icmptunnel dropbear speedup'
TINY='printk busybox'
[ -n "$ARG2" ] && LIST_ARCH="$ARG2" # enforce building a subset
[ -n "$ARG3" ] && LIST_KERNEL="$ARG3"
;;
esac
case "$KERNEL" in
'plot')
plot_progress "$ARG2" "$ARG3" "$ARG4"
exit $?
;;
'smoketest_for_release')
load_integer() { local load rest; read -r load rest </proc/loadavg; printf '%s\n' "${load%.*}"; }
avoid_overload() { sleep 10; while test "$(load_integer)" -gt "$NPROC"; do sleep 10; done; }
touch 'SMOKE'
test -z "$ARG2" && \
(while [ -f SMOKE ];do J=;L=$(load_integer);for _ in $(seq "$L");do J="#$J";done;echo $J ${#J};sleep 10;done >load.txt;) &
for ARCH in $LIST_ARCH; do
for KERNEL in $LIST_KERNEL; do
I=$(( I + 2 ))
ID="${KERNEL}_${ARCH}"
L1="$PWD/log-$ID-tiny.txt" && rm -f "$L1"
L2="$PWD/log-$ID-full.txt" && rm -f "$L2"
B1="$L1.build.txt"
B2="$L2.build.txt"
export FAKEID='[email protected]'
export NOKVM='true' ONEFILE='true'
export CPU
if [ -n "$ARG2" ]; then
LOG="$L1" BUILDID="$ID-tiny" DSTARCH="$ARCH" "$0" "$KERNEL" "$TINY" autoclean >"$B1" 2>&1
LOG="$L2" BUILDID="$ID-full" DSTARCH="$ARCH" "$0" "$KERNEL" "$FULL" autoclean >"$B2" 2>&1
else
LOG="$L1" BUILDID="$ID-tiny" DSTARCH="$ARCH" "$0" "$KERNEL" "$TINY" autoclean >"$B1" 2>&1 &
avoid_overload
LOG="$L2" BUILDID="$ID-full" DSTARCH="$ARCH" "$0" "$KERNEL" "$FULL" autoclean >"$B2" 2>&1 &
avoid_overload
fi
done
done
count_logfiles() { find . -maxdepth 1 -type f -name 'log-[1-9]\.*' -size +0 -exec grep 'autoclean done' {} \; | wc -l; }
while C=$( count_logfiles ); test $C -lt $I; do {
test -f 'SMOKE' || break
log "waiting for $C/$I logfiles or '$PWD/SMOKE' disappear"
sleep 10
} done
rm 'SMOKE'
$0 'smoketest_report_html'
log "see '$PWD/load.txt"
exit
;;
'smoketest_report_html')
build_matrix_html() {
I=0
add_star() { STAR="${STAR}∗"; } # 8 chars long
add_hint() { HINT="${HINT}$1
";}
stars2color() { # https://werner-zenk.de/tools/farbverlauf.php
test -n "$1" && echo 'lightblue' && return # panic
case "$(( ${#STAR} / 8 ))" in
1) echo '#FFFFFF' ;; # white
2) echo '#D9FFD9' ;;
3) echo '#AEFFAE' ;;
4) echo '#84FF84' ;;
5) echo '#59FF59' ;;
6) echo '#00FF00' ;; # lime = green
*) echo 'crimson' ;; # red
esac
}
echo "<!DOCTYPE html>"
echo "<html lang='en' dir='ltr'><head>"
echo "<meta http-equiv='content-type' content='text/html; charset=UTF-8'>"
echo "<title>MATRIX</title></head><body>"
echo "<table cellspacing=1 cellpadding=1 border=1>"
COMMIT="$( git rev-parse --short HEAD )"
LINK="https://github.com/bittorf/kritis-linux/commit/$COMMIT"
printf '%s' "<tr><th><a href='$LINK'>github</a></th>"
for ARCH in $LIST_ARCH; do printf '%s' "<th>$ARCH</th>"; done
printf '%s\n' "</tr><!-- end headline arch -->"
for KERNEL in $LIST_KERNEL; do
RELEASE_DATE="$( download "http://intercity-vpn.de/kernel_history/$KERNEL" && read -r UNIX <"$KERNEL" && rm "$KERNEL" && LC_ALL=C date -d "@$UNIX" )"
printf '%s' "<tr><td title='release_date: ${RELEASE_DATE:-???}'>$KERNEL</td>"
for ARCH in $LIST_ARCH; do
I=$(( I + 2 ))
ID="${KERNEL}_${ARCH}"
L1="$PWD/log-$ID-tiny.txt" # e.g. log-5.4.100_x86_64-tiny.txt
L2="$PWD/log-$ID-full.txt"
B1="$L1.build.txt"
B2="$L2.build.txt"
HINT=
PANIC=
STAR=
grep -qs "BUILDTIME:" "$L1" && add_star && add_hint "tiny compiles: $L1"
grep -qs "Linux version $KERNEL" "$L1" && add_star && add_hint "tiny kernel boots"
grep -qs "BOOTTIME_SECONDS" "$L1" && add_star && add_hint "tiny initrd starts"
grep -qs "Attempted to kill init" "$L1" && PANIC=1 && add_hint "tiny kernel panics"
LINK1="<a href='$( basename "$L1" )'>$STAR</a>"
[ -z "$STAR" ] && LINK1="<a href='$( basename "$B1" )'>—</a> "
STAR_OLD="$STAR"
STAR=
grep -qs "BUILDTIME:" "$L2" && add_star && add_hint "full compiles: $L2"
grep -qs "Linux version $KERNEL" "$L2" && add_star && add_hint "full kernel boots"
grep -qs "BOOTTIME_SECONDS" "$L2" && add_star && add_hint "full initrd starts"
grep -qs "Attempted to kill init" "$L2" && PANIC=2 && add_hint "full kernel panics"
LINK2="<a href='$( basename "$L2" )'>$STAR</a>"
[ -z "$STAR" ] && LINK2="<a href='$( basename "$B2" )'>—</a> "
STAR="${STAR_OLD}${STAR}"
printf '%s' "<td bgcolor='$( stars2color "$PANIC" )' title='${HINT:-does_not_compile}'>${LINK1} $LINK2</td>"
done
printf '%s\n' "</tr><!-- end line kernel $KERNEL -->"
done
echo "</table>"
[ "$1" = 'only_table' ] && echo '</html>' && return
echo "<pre>"
echo "feature-set 'tiny' => $TINY"
echo "feature-set 'full' => $FULL"
echo
echo '# we mark each progress step reached with an "asterisk"'
echo '# step1: it compiles (tiny featureset)'
echo '# step2: kernel boots (tiny)'
echo '# step3: initrd runs (tiny)'
echo '# step4: it compiles (full featureset)'
echo '# step5: kernel boots (full)'
echo '# step6: initrd runs (full)'
echo
# 10 seconds for each line:
T="$( wc -l <load.txt || echo 0 )" && T=$(( T * 10 ))
echo "debug: build $I images in $T seconds = $(( T / I )) sec/image @ $( LC_ALL=C date )"
echo "uname: $( uname -a )"
echo "nproc/cpu: $NPROC @ $CPUINFO"
echo "$( test -f load.txt && printf '\n%s' 'load-1min during build each 10 sec:' && cat load.txt )</pre>"
echo "<br><pre># generated with: $0 smoketest_report_html</pre></html>"
}
DEST="[email protected]:/var/www/kritis-linux/"
build_matrix_html >'table.html' only_table
build_matrix_html >'index.html' && log "see: '$PWD/index.html', scp ./*.html log-* $DEST"
read -r USER_DEST <'autoupload.txt'
[ -n "$USER_DEST" ] && scp ./*.html "$USER_DEST"
[ -z "$NOUPLOAD" ] && [ -n "$USER_DEST" ] && scp log-* "$USER_DEST"
[ -z "$NO_IMAGE" ] && [ -n "$USER_DEST" ] && {
makedir_gointo_and_cleanup 'browsershots'
download "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2" || exit
untar ./* || exit
cd ./* || exit
HARDCODED_URL="http://intercity-vpn.de/kritis-linux/table.html" # ugly!
{
echo "var page = require('webpage').create();"
echo "page.open('$HARDCODED_URL', function() {"
echo " setTimeout(function() {"
echo " page.render('preview.png');"
echo " phantom.exit();"
echo " }, 200);"
echo "});"
} >script.js
bin/phantomjs script.js && scp preview.png "$USER_DEST"
}
exit
;;
'clean')
rm -fR "$BASEDIR"
exit
;;
'fill_cache')
mkdir -p fake
cd fake || exit
I=0
while KERNEL_URL="$( kernels $I )"; do {
download "$KERNEL_URL"
I=$(( I + 1 ))
} done
cd ..
rm -fR 'fake'
exit
;;
[0-9]|[0-9][0-9]|latest|stable)
# e.g. 1 or 22 or 'latest' or 'stable'
KERNEL_URL="$( kernels "$KERNEL" )"
echo "[OK] choosing '$KERNEL_URL'"
;;
[0-9].*)
# e.g. 4.19.x -> 4.19.169
case "$KERNEL" in
*'.x')
# this will fail, if not on mainpage anymore!
KERNEL="$( echo "$KERNEL" | cut -d'x' -f1 )"
KERNEL="$( wget $WGETOPTS -qO - https://www.kernel.org | sed -n "s/.*<strong>\(${KERNEL}[0-9]*\)<.*/\1/p" )"
;;
esac
case "$KERNEL" in
*'-rc'*)
# recent mainline:
KERNEL_URL="https://git.kernel.org/torvalds/t/linux-${KERNEL}.tar.gz"
;;
*)
# e.g. 5.4.89 -> dir v5.x + file 5.4.89
KERNEL_URL="https://cdn.kernel.org/pub/linux/kernel/v${KERNEL%%.*}.x/linux-${KERNEL}.tar.xz"
;;
esac
echo "[OK] choosing '$KERNEL_URL'"
;;
'http'*)
KERNEL_URL="$KERNEL"
echo "[OK] choosing '$KERNEL_URL'"
;;