2 # we are heading towards a RCS (Reduced Command Set), expect much more verbosity and simplicity
3 printf "NYAN:RELEASE.SH -- START\n" >&2
4 # OUTPUT ON STDOUT THE KERNEL RELEASE
9 if test -z "$nyan_root"; then
10 printf 'NYAN:ERROR:missing nyan root\n' >&2
13 printf "NYAN:using nyan_root \"$nyan_root\"\n" >&2
15 if test -z "$linux_config"; then
16 printf 'NYAN:ERROR:missing linux_config\n' >&2
19 printf "NYAN:using linux_config \"$linux_config\"\n" >&2
21 if test ! -d "$patched_linux_dir"; then
22 printf 'NYAN:ERROR:missing patched linux directory\n' >&2
25 printf "NYAN:using patched linux directory \"$patched_linux_dir\"\n" >&2
33 if test -e /bin
/bash.HIDDEN
; then
34 printf 'NYAN:detected hidden bash, restoring\n' >&2
35 mv /bin
/bash.HIDDEN
/bin
/bash
>&2
37 if test $false_installed; then
38 printf 'NYAN:detected installed /bin/false, removing\n' >&2
41 if test $bracket_installed; then
42 printf 'NYAN:detected installed /bin/[, removing\n' >&2
45 rmdir /bin || true
>&2
46 printf "NYAN:RELEASE.SH -- END\n" >&2
49 ################################################################################
50 if test -e /bin
/bash
;then
51 printf 'NYAN:detected /bin/bash, hidding\n' >&2
52 mv /bin
/bash
/bin
/bash.HIDDEN
>&2
56 /opt/toolchains/x64/elf/binutils-gcc/current/bin:\
57 /nyan/make/current/bin:\
58 /nyan/flex/current/bin:\
59 /nyan/bison/current/bin:\
62 # linux sdk wants direct sh invocation
63 if ! command -v sh
>/dev
/null
2>/dev
/null
; then
64 printf 'NYAN:ERROR:no direct invocation of sh found, linux SDK will fail, exiting\n' >&2
67 # linux sdk wants false in /bin
68 if test ! -e /bin
/false
; then
69 printf 'NYAN:you are missing the false utility in /bin, using the one in PATH\n' >&2
72 printf 'NYAN:no false utility found in PATH, linux SDK will fail, exiting\n' >&2
75 printf 'NYAN:linking %s to /bin/false, will be removed on exiting\n' $r >&2
76 ln -s $r /bin
/false
>&2
79 if test ! -x /bin
/false
; then
80 printf 'NYAN:ERROR:/bin/false not executable, linux SDK will fail, exiting\n' >&2
83 # linux sdk wants [ in /bin
84 if test ! -e '/bin/['; then
85 printf 'NYAN:you are missing the "[" utility in /bin, using "test" in PATH\n' >&2
88 printf 'NYAN:ERROR:no test utility found in PATH, linux SDK will fail, exiting\n' >&2
91 printf 'NYAN:linking %s to /bin/[, will be removed on exiting\n' $r >&2
95 if test ! -x '/bin/['; then
96 printf 'NYAN:ERROR:/bin/[ not executable, linux SDK will fail, exiting\n' >&2
99 export "KCONFIG_CONFIG=$linux_config"
101 export "HOSTCFLAGS=-isystem /nyan/glibc/current/include -isystem /nyan/linux-headers/current/include -O2 -pipe -fPIC -static-libgcc"
102 export "HOSTLDFLAGS=-B/nyan/glibc/current/lib -L/nyan/glibc/current/lib -static-libgcc"
104 cd $patched_linux_dir
105 # HOSTCC environment variable seems ignored, overridding the makefile variable
106 make oldconfig
"HOSTCC=$HOSTCC" >&2
107 make -s kernelrelease
"HOSTCC=$HOSTCC"