| |
| /pliant/fullpliant/kernel.pli |
| |
| 1 |
abstract | |
| 2 |
[This module will install, patch, and compile the Linux kernel source.] | |
| 3 |
| |
| 4 |
module "/pliant/language/context.pli" | |
| 5 |
module "/pliant/language/compiler.pli" | |
| 6 |
module "/pliant/language/stream.pli" | |
| 7 |
module "/pliant/admin/file.pli" | |
| 8 |
module "/pliant/admin/execute.pli" | |
| 9 |
module "/pliant/admin/asciifile.pli" | |
| 10 |
module "/pliant/admin/md5.pli" | |
| 11 |
submodule "computer.pli" | |
| 12 |
| |
| 13 |
| |
| 14 |
public | |
| 15 |
constant kernel_source_path "file:/fullpliant/kernel/src/" | |
| 16 |
constant kernel_binary_path "file:/fullpliant/kernel/bin/" | |
| 17 |
| |
| 18 |
| |
| 19 |
function command cmd subpath input -> err | |
| 20 |
arg Str cmd subpath input ; arg Int err | |
| 21 |
if (constant this_computer:env:"pliant":"system":"embedded")<>"" | |
| 22 |
var Array:Str env | |
| 23 |
env += "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin" | |
| 24 |
var Array:Address ptrs | |
| 25 |
ptrs size := env:size+1 | |
| 26 |
for (var Int i) 0 env:size-1 | |
| 27 |
if (env:i env:i:len-1 1)<>"[0]" | |
| 28 |
env i += "[0]" | |
| 29 |
ptrs i := env:i characters | |
| 30 |
ptrs env:size := null | |
| 31 |
var Address memo := linux_process_env | |
| 32 |
linux_process_env := addressof Address ptrs:0 | |
| 33 |
err := execute cmd path "embedded:/usr/src/"+subpath root "embedded:/" input input quiet | |
| 34 |
linux_process_env := memo | |
| 35 |
else | |
| 36 |
err := execute cmd path "embedded:/usr/src/"+subpath input input quiet | |
| 37 |
| |
| 38 |
function command cmd subpath -> err | |
| 39 |
arg Str cmd subpath ; arg Int err | |
| 40 |
err := command cmd subpath "" | |
| 41 |
| |
| 42 |
| |
| 43 |
| |
| 44 |
| |
| 45 |
doc | |
| 46 |
[installing the kernel source tree] | |
| 47 |
| |
| 48 |
| |
| 49 |
function kernel_signature c extended -> s | |
| 50 |
arg Data:Computer c ; arg CBool extended ; arg Str s | |
| 51 |
s := "" | |
| 52 |
each cst c:env:"kernel":"constant" | |
| 53 |
if keyof:cst<>"signature" | |
| 54 |
s += "constant "+keyof:cst+" "+string:cst+"[lf]" | |
| 55 |
each patch c:env:"patch" | |
| 56 |
s += "patch "+(string patch:"file") | |
| 57 |
if patch:"fuzzy"="true" | |
| 58 |
s += " fuzzy" | |
| 59 |
each f patch | |
| 60 |
if (keyof:f parse "ignore" any) | |
| 61 |
s += " ignore "+string:f | |
| 62 |
s += "[lf]" | |
| 63 |
if extended | |
| 64 |
each k c:env:"kernel":"make" | |
| 65 |
if k<>"n" | |
| 66 |
s += "make "+keyof:k+"="+k+"[lf]" | |
| 67 |
| |
| 68 |
| |
| 69 |
function apply_patch file filter patch | |
| 70 |
arg Str file filter patch | |
| 71 |
var Str temp1 := replace file_temporary "file:/" "embedded:/" ; var Str temp2 := replace file_temporary "file:/" "embedded:/" | |
| 72 |
file_copy file temp1 | |
| 73 |
execute filter root "embedded:/" input temp1 output temp2 | |
| 74 |
execute patch path "embedded:/usr/src/" root "embedded:/" input temp2 | |
| 75 |
file_delete temp1 ; file_delete temp2 | |
| 76 |
| |
| 77 |
function kernel_install c -> status | |
| 78 |
arg Data:Computer c ; arg ExtendedStatus status | |
| 79 |
var Str linux_version := c:env:"kernel":"constant":"linux_version" | |
| 80 |
if not (linux_version parse (var Int v1) "." (var Int v2) "." (var Int v3) any:(var Str extra)) | |
| 81 |
return (failure "Incorrect kernel version ("+linux_version+")") | |
| 82 |
var Str pcmcia_version := c:env:"kernel":"constant":"pcmcia_version" | |
| 83 |
var Str alsa_version := shunt v1=2 and v2=4 c:env:"kernel":"constant":"alsa_version" "" | |
| 84 |
var Str fuse_version := c:env:"kernel":"constant":"fuse_version" | |
| 85 |
var Int base := 0 | |
| 86 |
var Int final := v3 | |
| 87 |
var Int maxi := 0 ; var Str v := "" | |
| 88 |
var Array:FileInfo files := file_list kernel_source_path standard+relative | |
| 89 |
for (var Int i) 0 files:size-1 | |
| 90 |
if (files:i:name parse "linux-" (var Int vi1) "." (var Int vi2) "." (var Int vi3) ".tar.gz") | |
| 91 |
if vi1=v1 and vi2=v2 and (vi3>base and vi3<=v3) | |
| 92 |
base := vi3 | |
| 93 |
part check_for_same | |
| 94 |
(var Stream sign) open "embedded:/usr/src/linux/.pliant" in+safe | |
| 95 |
var Str s := "" | |
| 96 |
while not sign:atend | |
| 97 |
s += sign:readline+"[lf]" | |
| 98 |
sign close | |
| 99 |
if s=(kernel_signature c false) | |
| 100 |
return success | |
| 101 |
console " installing Linux kernel " linux_version " source" eol | |
| 102 |
status := success | |
| 103 |
if (file_query "embedded:/usr/src/linux-"+linux_version+"/" standard)=defined | |
| 104 |
console " removing old kernel source" eol | |
| 105 |
file_tree_delete "embedded:/usr/src/linux-"+linux_version+"/" | |
| 106 |
console " unpacking linux-"+string:v1+"."+string:v2+"."+string:base+".tar.gz" eol | |
| 107 |
file_delete "embedded:/usr/src/linux" | |
| 108 |
file_tree_delete "embedded:/usr/src/linux/" | |
| 109 |
file_tree_delete "embedded:/usr/src/linux-"+string:v1+"."+string:v2+"."+string:base+"/" | |
| 110 |
if (file_extract kernel_source_path+"linux-"+string:v1+"."+string:v2+"."+string:base+".tar.gz" "embedded:/usr/src/")=failure | |
| 111 |
return failure:"Failed to extract Linux source" | |
| 112 |
file_link "linux-"+string:v1+"."+string:v2+"."+string:base+"/" "embedded:/usr/src/linux/" | |
| 113 |
if pcmcia_version<>"" | |
| 114 |
if (file_query "embedded:/usr/src/pcmcia-cs-"+pcmcia_version+"/" standard)=defined | |
| 115 |
console " removing old pcmcia source" eol | |
| 116 |
file_tree_delete "embedded:/usr/src/pcmcia-cs-"+pcmcia_version+"/" | |
| 117 |
file_delete "embedded:/usr/src/pcmcia-cs" ; file_tree_delete "embedded:/usr/src/pcmcia-cs/" | |
| 118 |
var Str pcmcia_tar := "pcmcia-cs-"+pcmcia_version+".tar.gz" | |
| 119 |
console " unpacking "+pcmcia_tar eol | |
| 120 |
if (file_extract kernel_source_path+pcmcia_tar "embedded:/usr/src/")=failure | |
| 121 |
return failure:"Failed to extract PCMCIA source" | |
| 122 |
file_link "pcmcia-cs-"+pcmcia_version+"/" "embedded:/usr/src/pcmcia-cs/" | |
| 123 |
if alsa_version<>"" | |
| 124 |
if (file_query "embedded:/usr/src/alsa-driver-"+alsa_version+"/" standard)=defined | |
| 125 |
console " removing old ALSA source" eol | |
| 126 |
file_tree_delete "embedded:/usr/src/alsa-driver-"+alsa_version+"/" | |
| 127 |
var Str alsa_tar := "alsa-driver-"+alsa_version+".tar.bz2" | |
| 128 |
console " unpacking "+alsa_tar eol | |
| 129 |
if (file_extract kernel_source_path+alsa_tar "embedded:/usr/src/")=failure | |
| 130 |
return failure:"Failed to extract ALSA source" | |
| 131 |
for i base+1 final | |
| 132 |
console " applying patch-"+string:v1+"."+string:v2+"."+string:i+".gz" eol | |
| 133 |
# file_tree_delete "embedded:/usr/src/linux-"+string:v1+"."+string:v2+"."+string:i+"/" | |
| 134 |
file_tree_delete "os_file:"+(file_os_name "embedded:/usr/src/linux-"+string:v1+"."+string:v2+"."+string:i+"/") # there are some ..tmp files | |
| 135 |
each patch c:env:"patch" | |
| 136 |
if patch:"file"="patch-"+string:v1+"."+string:v2+"."+string:i+".gz" | |
| 137 |
each f patch | |
| 138 |
if (keyof:f parse "ignore" any) | |
| 139 |
console " ignoring " f eol | |
| 140 |
file_copy "embedded:/usr/src/linux/"+f "embedded:/usr/src/linux/"+f+".original" | |
| 141 |
if v1>2 or (v1>=2 and v2>=6) | |
| 142 |
file_link "linux-"+string:v1+"."+string:v2+"."+(string i-1)+"/" "embedded:/usr/src/a/" | |
| 143 |
file_link "linux-"+string:v1+"."+string:v2+"."+(string i-1)+"/" "embedded:/usr/src/b/" | |
| 144 |
apply_patch kernel_source_path+"patch-"+string:v1+"."+string:v2+"."+string:i+".gz" "gzip -d" "patch -p0 -s" | |
| 145 |
if v1>2 or (v1>=2 and v2>=6) | |
| 146 |
file_delete "embedded:/usr/src/a/" | |
| 147 |
file_delete "embedded:/usr/src/b/" | |
| 148 |
each patch c:env:"patch" | |
| 149 |
if patch:"file"="patch-"+string:v1+"."+string:v2+"."+string:i+".gz" | |
| 150 |
each f patch | |
| 151 |
if (keyof:f parse "ignore" any) | |
| 152 |
file_copy "embedded:/usr/src/linux/"+f+".original" "embedded:/usr/src/linux/"+f | |
| 153 |
file_delete "embedded:/usr/src/linux/"+f+".original" | |
| 154 |
file_move "embedded:/usr/src/linux-"+string:v1+"."+string:v2+"."+(string i-1)+"/" "embedded:/usr/src/linux-"+string:v1+"."+string:v2+"."+string:i+"/" | |
| 155 |
file_delete "embedded:/usr/src/linux" | |
| 156 |
file_link "linux-"+string:v1+"."+string:v2+"."+string:i+"/" "embedded:/usr/src/linux/" | |
| 157 |
each patch c:env:"patch" filter patch:"file"<>"" | |
| 158 |
each f patch | |
| 159 |
if (keyof:f parse "alias" any) | |
| 160 |
file_link "linux-"+string:v1+"."+string:v2+"."+string:final+"/" "embedded:/usr/src/"+f+"/" | |
| 161 |
each f patch | |
| 162 |
if (keyof:f parse "ignore" any) | |
| 163 |
file_copy "embedded:/usr/src/linux/"+f "embedded:/usr/src/linux/"+f+".original" | |
| 164 |
var Str file := patch "file" | |
| 165 |
var Str options := shunt patch:"fuzzy"="true" " -N -F 10000" "" | |
| 166 |
console " applying "+file eol | |
| 167 |
if (file search ".gz" -1)<>(-1) | |
| 168 |
apply_patch kernel_source_path+file "gzip -d" "patch -p0 -s"+options | |
| 169 |
eif (file search ".bz2" -1)<>(-1) | |
| 170 |
apply_patch kernel_source_path+file "bzip2 -d" "patch -p0 -s"+options | |
| 171 |
else | |
| 172 |
apply_patch kernel_source_path+file "cat" "patch -p0 -l -s"+options | |
| 173 |
each f patch | |
| 174 |
if (keyof:f parse "ignore" any) | |
| 175 |
file_copy "embedded:/usr/src/linux/"+f+".original" "embedded:/usr/src/linux/"+f | |
| 176 |
file_delete "embedded:/usr/src/linux/"+f+".original" | |
| 177 |
each f patch | |
| 178 |
if (keyof:f parse "alias" any) | |
| 179 |
file_delete "embedded:/usr/src/"+f+"/" | |
| 180 |
if fuse_version<>"" | |
| 181 |
file_extract "file:/fullpliant/kernel/src/fuse-"+fuse_version+".tar.gz" "embedded:/usr/src/" | |
| 182 |
if v1=2 and v2=2 and computer_fullname="hubert.heliogroup.fr" and c:env:"hardware":"processor":"model"="i586" and c:env:"hardware":"processor":"count">="2" | |
| 183 |
# dirty hack for my HP XU 5/90C SMP systems | |
| 184 |
(var AsciiFile apic) load "embedded:/usr/src/linux/arch/i386/kernel/io_apic.c" | |
| 185 |
apic set "static inline int" "irq_polarity" "static inline int irq_polarity(int idx) { return default_EISA_polarity(idx); } static inline int irq_polarity0(int idx)" | |
| 186 |
apic set "static inline int" "irq_trigger" "static inline int irq_trigger(int idx) { return default_EISA_trigger(idx); } static inline int irq_trigger0(int idx)" | |
| 187 |
apic store | |
| 188 |
if false # no console blanking: replaced by terminal configuration sequence in /pliant/fullpliant/boot.pli | |
| 189 |
# 2.4 | |
| 190 |
(var AsciiFile console) load "embedded:/usr/src/linux/drivers/char/console.c" | |
| 191 |
console set "static void" "timer_do_blank_screen" "static void timer_do_blank_screen(int entering_gfx, int from_timer_handler)[lf]{}[lf]static void dropped_code(int entering_gfx, int from_timer_handler)" | |
| 192 |
console store | |
| 193 |
# 2.6 | |
| 194 |
(var AsciiFile console) load "embedded:/usr/src/linux/drivers/char/vt.c" | |
| 195 |
console set "static int" "blankinterval" "static int blankinterval = 0;" | |
| 196 |
console store | |
| 197 |
if status=success | |
| 198 |
(var Stream sign) open "embedded:/usr/src/linux/.pliant" out | |
| 199 |
sign writechars (kernel_signature c false) | |
| 200 |
else | |
| 201 |
file_delete "embedded:/usr/src/linux/.pliant" | |
| 202 |
| |
| 203 |
| |
| 204 |
function kernel_remove | |
| 205 |
file_tree_delete "embedded:/usr/src/linux/" | |
| 206 |
file_tree_delete "embedded:/usr/src/pcmcia/" | |
| 207 |
var Array:FileInfo files := file_list "embedded:/usr/src/" standard+directories+relative | |
| 208 |
for (var Int i) 0 files:size-1 | |
| 209 |
if (files:i:name parse "linux-" any:(var Str v) "/") | |
| 210 |
file_tree_delete "embedded:/usr/src/"+files:i:name | |
| 211 |
if (files:i:name parse "pcmcia-cs-" any:(var Str v) "/") | |
| 212 |
file_tree_delete "embedded:/usr/src/"+files:i:name | |
| 213 |
file_delete "embedded:/usr/src/linux" | |
| 214 |
file_delete "embedded:/usr/src/pcmcia-cs" | |
| 215 |
file_tree_delete kernel_binary_path | |
| 216 |
| |
| 217 |
| |
| 218 |
| |
| 219 |
| |
| 220 |
doc | |
| 221 |
[creating the kernel configuration file] | |
| 222 |
| |
| 223 |
function set_implicit_kernel_settings c conf | |
| 224 |
arg Data:Computer c ; arg_rw Stream conf | |
| 225 |
var Array:FileInfo files := file_list "embedded:/usr/src/linux/" standard+recursive | |
| 226 |
for (var Int i) 0 files:size-1 | |
| 227 |
if (lower files:i:name_without_path)="config.in" | |
| 228 |
(var Stream s) open files:i:name in | |
| 229 |
while not s:atend | |
| 230 |
var Str l := s readline | |
| 231 |
var Str option default | |
| 232 |
if (l parse word:"bool" "'" any "'" _ any:option _ any) or (l parse word:"bool" "'" any "'" _ any:option) | |
| 233 |
default := "n" | |
| 234 |
eif (l parse word:"tristate" "'" any "'" _ any:option _ any) or (l parse word:"tristate" "'" any "'" _ any:option) | |
| 235 |
default := "n" | |
| 236 |
eif (l parse word:"dep_tristate" "'" any "'" _ any:option _ any) or (l parse word:"dep_tristate" "'" any "'" _ any:option) | |
| 237 |
default := "n" | |
| 238 |
eif (l parse word:"int" "'" any "'" _ any:option _ any:default) | |
| 239 |
void | |
| 240 |
eif (l parse word:"string" "'" any "'" _ any:option _ any:default) | |
| 241 |
void | |
| 242 |
else | |
| 243 |
option := "" | |
| 244 |
if option<>"" and not (exists c:env:"kernel":"make":option) | |
| 245 |
if default<>"n" | |
| 246 |
conf writeline option+"="+default | |
| 247 |
else | |
| 248 |
conf writeline "# "+option+" is not set" | |
| 249 |
eif files:i:name_without_path="Kconfig" | |
| 250 |
(var Stream s) open files:i:name in | |
| 251 |
while not s:atend | |
| 252 |
if (s:readline parse word:"config" any:(var Str option)) | |
| 253 |
option := "CONFIG_"+option | |
| 254 |
var Str default := "n" | |
| 255 |
while { var Str l := s readline ; not l:parse and not (l parse word:"help") } | |
| 256 |
if (l parse word:"default" (var Str value)) | |
| 257 |
default := value | |
| 258 |
while l<>"" | |
| 259 |
l := s readline | |
| 260 |
if not (exists c:env:"kernel":"make":option) | |
| 261 |
if default<>"n" | |
| 262 |
conf writeline option+"="+default | |
| 263 |
else | |
| 264 |
conf writeline "# "+option+" is not set" | |
| 265 |
| |
| 266 |
function write_kernel_configuration c | |
| 267 |
arg_rw Data:Computer c | |
| 268 |
(var AsciiFile makefile) load "embedded:/usr/src/linux/Makefile" | |
| 269 |
makefile set "EXTRAVERSION" "=" "EXTRAVERSION =" | |
| 270 |
if c:env:"kernel":"make":"CONFIG_SMP"="y" | |
| 271 |
makefile fuzzy_set "SMP" "=" "SMP = 1" | |
| 272 |
else | |
| 273 |
makefile fuzzy_set "SMP" "=" "# SMP = 1" | |
| 274 |
if c:env:"kernel":"constant":"architecture"<>"" | |
| 275 |
makefile set "ARCH" "?=" "ARCH ?= "+c:env:"kernel":"constant":"architecture" | |
| 276 |
if c:env:"kernel":"constant":"hostcc"<>"" | |
| 277 |
makefile set "HOSTCC" "=" "HOSTCC = "+c:env:"kernel":"constant":"hostcc" | |
| 278 |
if c:env:"kernel":"constant":"gcc"<>"" | |
| 279 |
makefile set "HOSTCC" "=" "HOSTCC = "+c:env:"kernel":"constant":"gcc" | |
| 280 |
makefile set "CC" "=" "CC = $(CROSS_COMPILE)"+c:env:"kernel":"constant":"gcc" | |
| 281 |
if c:env:"kernel":"constant":"gccflags"<>"" | |
| 282 |
makefile set "CFLAGS" ":=" "CFLAGS := "+c:env:"kernel":"constant":"gccflags"+" -Wall -Wstrict-prototypes -Wno-trigraphs \" | |
| 283 |
makefile set "AFLAGS" ":=" "AFLAGS := "+c:env:"kernel":"constant":"gccflags"+" -D__ASSEMBLY__" | |
| 284 |
makefile store | |
| 285 |
var Str port := c:env:"kernel":"constant":"de620/io_port" | |
| 286 |
if port="" | |
| 287 |
port := "0x378" | |
| 288 |
# 0x3BC for Thinkpad 750 | |
| 289 |
(var AsciiFile de620) load "embedded:/usr/src/linux/drivers/net/de620.c" | |
| 290 |
de620 set "#define" "DE620_IO" "#define DE620_IO "+port | |
| 291 |
de620 store | |
| 292 |
(var Stream conf) open "embedded:/usr/src/linux/.config" out | |
| 293 |
conf writeline "# This file has been automatically generated by Pliant" | |
| 294 |
conf writeline "# module /pliant/linux/kernel/build.pli" | |
| 295 |
conf writeline "# (Pliant is available at http://fullpliant.org/)" | |
| 296 |
conf writeline "#" | |
| 297 |
conf writeline "# Pliant extra informations:" | |
| 298 |
(var Stream version) open "embedded:/usr/src/linux/.pliant" in | |
| 299 |
while not version:atend | |
| 300 |
conf writeline "# "+version:readline | |
| 301 |
conf writeline "#" | |
| 302 |
conf writeline "# Linux kernel standard informations:" | |
| 303 |
var CBool has_modules := c:env:"kernel":"make":"CONFIG_MODULES"="y" | |
| 304 |
each k c:env:"kernel":"make" | |
| 305 |
if k="m" and not has_modules | |
| 306 |
conf writeline keyof:k+"=y" | |
| 307 |
eif k<>"n" | |
| 308 |
conf writeline keyof:k+"="+k | |
| 309 |
else | |
| 310 |
conf writeline "# "+keyof:k+" is not set" | |
| 311 |
set_implicit_kernel_settings c conf | |
| 312 |
conf close | |
| 313 |
(var AsciiFile f) load "embedded:/usr/src/linux/include/net/sock.h" | |
| 314 |
f set "#define" "PROT_SOCK" "#define PROT_SOCK 0" | |
| 315 |
f store | |
| 316 |
| |
| 317 |
| |
| 318 |
| |
| 319 |
| |
| 320 |
doc | |
| 321 |
[lazy compiling the custom kernel] | |
| 322 |
| |
| 323 |
| |
| 324 |
function kernel_compile c -> status | |
| 325 |
arg_rw Data:Computer c ; arg ExtendedStatus status | |
| 326 |
(var AsciiFile makefile) load "embedded:/usr/src/linux/Makefile" | |
| 327 |
var Str computer_name := c:env:"pliant":"identity":"name" | |
| 328 |
var Str kernel_version := c:env:"kernel":"constant":"linux_version" | |
| 329 |
var Str extra_version := makefile get "EXTRAVERSION" "=" | |
| 330 |
var Str pcmcia_version := c:env:"kernel":"constant":"pcmcia_version" | |
| 331 |
kernel_version parse (var Int v1) "." (var Int v2) "." (var Int v3) any | |
| 332 |
var Str alsa_version := shunt v1=2 and v2=4 c:env:"kernel":"constant":"alsa_version" "" | |
| 333 |
var Str fuse_version := c:env:"kernel":"constant":"fuse_version" | |
| 334 |
status := kernel_install c | |
| 335 |
if status=failure | |
| 336 |
return | |
| 337 |
var Str sign := string_md5_hexa_signature:(kernel_signature c true) | |
| 338 |
if (file_query kernel_binary_path+"kernel-"+kernel_version+"-"+sign+".tgz" standard)=defined | |
| 339 |
return success | |
| 340 |
console " configuring the kernel" eol | |
| 341 |
write_kernel_configuration c | |
| 342 |
var Str temp := file_temporary | |
| 343 |
(var Stream s) open temp out | |
| 344 |
for (var Int i) 1 4096 | |
| 345 |
s writeline "" | |
| 346 |
s close | |
| 347 |
command "make oldconfig" "linux/" temp | |
| 348 |
file_delete temp | |
| 349 |
var Str kernel_image := shunt v1>2 or v2>=2 "bzImage" "zImage" | |
| 350 |
var CBool modules := c:env:"kernel":"make":"CONFIG_MODULES"="y" | |
| 351 |
file_tree_delete "embedded:/tmp/kernel/" ; file_tree_create "embedded:/tmp/kernel/" | |
| 352 |
if true # build the kernel | |
| 353 |
command "make dep" "linux/" | |
| 354 |
command "make clean" "linux/" | |
| 355 |
console " compiling the kernel (be patient)" eol | |
| 356 |
if (command "make "+kernel_image "linux/")<>0 | |
| 357 |
return (failure "Failed to build kernel for computer "+computer_name+" !") | |
| 358 |
if modules # build the modules | |
| 359 |
console " compiling the modules (be patient)" eol | |
| 360 |
(var AsciiFile makefile) load "embedded:/usr/src/linux/Makefile" | |
| 361 |
makefile fuzzy_set "INSTALL_MOD_PATH" "" "INSTALL_MOD_PATH=/tmp/kernel" | |
| 362 |
makefile store | |
| 363 |
if (command "make modules" "linux/")<>0 | |
| 364 |
return (failure "Failed to build kernel modules for computer "+computer_name+" !") | |
| 365 |
command "make modules_install" "linux/" | |
| 366 |
var Str mpath := "embedded:/tmp/kernel/lib/modules/"+string:v1+"."+string:v2+"."+string:v3+"/" | |
| 367 |
file_delete mpath+"build" | |
| 368 |
if false | |
| 369 |
file_tree_copy mpath+"kernel/drivers/" mpath ; file_tree_delete mpath+"kernel/drivers/" | |
| 370 |
file_tree_copy mpath+"kernel/" mpath ; file_tree_delete mpath+"kernel/" | |
| 371 |
if modules and c:env:"kernel":"make":"CONFIG_PCMCIA"="y" and pcmcia_version<>"" # build pcmcia support | |
| 372 |
console " compiling PCMCIA support (be patient)" eol | |
| 373 |
(var AsciiFile config_in) load "embedded:/usr/src/pcmcia-cs/config.in" | |
| 374 |
config_in set "RC_DIR" "=" "RC_DIR=/etc" | |
| 375 |
config_in set "SYSV_INIT" "=" "SYSV_INIT=y" | |
| 376 |
config_in store | |
| 377 |
file_delete "embedded:/usr/src/pcmcia-cs/config.out" | |
| 378 |
var Str params := " --noprompt" | |
| 379 |
params += " --kernel=/usr/src/linux" | |
| 380 |
params += " --target=/tmp/kernel" | |
| 381 |
params += " --moddir=/lib/modules/"+string:v1+"."+string:v2+"."+string:v3 | |
| 382 |
params += " --cc=gcc" | |
| 383 |
params += " --ld=ld" | |
| 384 |
params += " --debug=[dq][dq]" | |
| 385 |
params += " --trust" | |
| 386 |
params += shunt c:env:"kernel":"make":"CONFIG_CARDBUS"="y" " --cardbus" " --nocardbus" | |
| 387 |
params += " --srctree" | |
| 388 |
command "Configure"+params "pcmcia-cs/" | |
| 389 |
if (command "make all" "pcmcia-cs/")<>0 | |
| 390 |
return (failure "Failed to build pcmcia support for computer "+computer_name+" !") | |
| 391 |
command "make install" "pcmcia-cs/" | |
| 392 |
if modules and alsa_version<>"" # build ALSA sound support | |
| 393 |
console " compiling ALSA sound support (be patient)" eol | |
| 394 |
command "configure" "alsa-driver-"+alsa_version+"/" | |
| 395 |
command "make" "alsa-driver-"+alsa_version+"/" | |
| 396 |
(var AsciiFile mk_conf) load "embedded:/usr/src/alsa-driver-"+alsa_version+"/Makefile.conf" | |
| 397 |
mk_conf set "moddir" "=" "moddir = /tmp/kernel/lib/modules/"+string:v1+"."+string:v2+"."+string:v3+"/kernel/sound" | |
| 398 |
mk_conf store | |
| 399 |
command "make install" "alsa-driver-"+alsa_version+"/" | |
| 400 |
if modules and fuse_version<>"" # build FUSE filesystem support | |
| 401 |
console " compiling FUSE support" eol | |
| 402 |
command "configure --with-kernel=/usr/src/linux" "fuse-"+fuse_version+"/" | |
| 403 |
command "make clean" "fuse-"+fuse_version+"/" | |
| 404 |
command "make" "fuse-"+fuse_version+"/" | |
| 405 |
file_copy "embedded:/usr/src/fuse-"+fuse_version+"/kernel/fuse.ko" "embedded:/tmp/kernel/lib/modules/"+string:v1+"."+string:v2+"."+string:v3+"/kernel/fs/fuse/fuse.ko" | |
| 406 |
if modules and (file_query kernel_source_path+"vmmon.tar" standard)=defined | |
| 407 |
console " compiling VMWare modules" eol | |
| 408 |
file_tree_delete "embedded:/usr/src/vmmon-only/" | |
| 409 |
file_extract kernel_source_path+"vmmon.tar" "embedded:/usr/src/" | |
| 410 |
(var AsciiFile f) load "embedded:/usr/src/vmmon-only/Makefile" | |
| 411 |
if c:env:"kernel":"make":"CONFIG_SMP"="y" | |
| 412 |
f fuzzy_set "SUPPORT_SMP" "=" "SUPPORT_SMP=1" | |
| 413 |
f set "DESTDIR" "=" "DESTDIR = driver" | |
| 414 |
f set_all "DRIVERNAME" "=" "DRIVERNAME = vmmon.o" | |
| 415 |
f store | |
| 416 |
command "make" "vmmon-only/" | |
| 417 |
file_copy "embedded:/usr/src/vmmon-only/driver/vmmon.o" "embedded:/tmp/kernel/lib/modules/"+kernel_version+extra_version+"/misc/vmmon.o" | |
| 418 |
if modules and (file_query kernel_source_path+"vmnet.tar" standard)=defined | |
| 419 |
file_tree_delete "embedded:/usr/src/vmnet-only/" | |
| 420 |
file_extract kernel_source_path+"vmnet.tar" "embedded:/usr/src/" | |
| 421 |
f load "embedded:/usr/src/vmnet-only/Makefile" | |
| 422 |
if c:env:"kernel":"make":"CONFIG_SMP"="y" | |
| 423 |
f fuzzy_set "SUPPORT_SMP" "=" "SUPPORT_SMP=1" | |
| 424 |
f set_all "DRIVERNAME" "=" "DRIVERNAME = vmnet.o" | |
| 425 |
f store | |
| 426 |
command "make" "vmnet-only/" | |
| 427 |
file_copy "embedded:/usr/src/vmnet-only/vmnet.o" "embedded:/tmp/kernel/lib/modules/"+kernel_version+extra_version+"/misc/vmnet.o" | |
| 428 |
if modules and (file_query kernel_source_path+"vmppuser.tar" standard)=defined | |
| 429 |
file_tree_delete "embedded:/usr/src/vmppuser-only/" | |
| 430 |
file_extract kernel_source_path+"vmppuser.tar" "embedded:/usr/src/" | |
| 431 |
f load "embedded:/usr/src/vmppuser-only/Makefile" | |
| 432 |
if c:env:"kernel":"make":"CONFIG_SMP"="y" | |
| 433 |
f fuzzy_set "SUPPORT_SMP" "=" "SUPPORT_SMP=1" | |
| 434 |
f set_all "DRIVERNAME" "=" "DRIVERNAME = vmppuser.o" | |
| 435 |
f store | |
| 436 |
command "make" "vmppuser-only/" | |
| 437 |
file_copy "embedded:/usr/src/vmppuser-only/vmppuser.o" "embedded:/tmp/kernel/lib/modules/"+kernel_version+extra_version+"/misc/vmppuser.o" | |
| 438 |
void ? | |
| 439 |
console " storing the newly compiled kernel." eol | |
| 440 |
file_tree_create kernel_binary_path | |
| 441 |
var Str arch := c:env:"kernel":"constant":"architecture" | |
| 442 |
if arch="" | |
| 443 |
arch := "i386" | |
| 444 |
file_copy "embedded:/usr/src/linux/arch/"+arch+"/boot/"+kernel_image "embedded:/tmp/kernel/boot/kernel" | |
| 445 |
file_copy "embedded:/usr/src/linux/System.map" "embedded:/tmp/kernel/boot/System.map" | |
| 446 |
execute "tar -zc -f "+file_os_name:kernel_binary_path+"kernel-"+kernel_version+"-"+sign+".tgz ." path "embedded:/tmp/kernel/" | |
| 447 |
file_tree_delete "embedded:/tmp/kernel/" | |
| 448 |
status := success | |
| 449 |
| |
| 450 |
export kernel_signature | |
| 451 |
export kernel_install kernel_remove | |
| 452 |
export kernel_compile | |
| 453 |
| |
| 454 |
| |
| 455 |
| |
| 456 |
| |
| 457 |
| |
| 458 |
| |
| 459 |
| |
| 460 |
| |
| 461 |
| |
| |