Changeset 96416 in vbox for trunk/tools/linux.x86/kmodbuild/build-kernel.sh
- Timestamp:
- Aug 22, 2022 8:36:29 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/linux.x86/kmodbuild/build-kernel.sh
r78141 r96416 17 17 18 18 # 19 # Copyright (C) 2019 Oracle Corporation 20 # 21 # This file is part of VirtualBox Open Source Edition (OSE), as 22 # available from http://www.virtualbox.org. This file is free software; 23 # you can redistribute it and/or modify it under the terms of the GNU 24 # General Public License (GPL) as published by the Free Software 25 # Foundation, in version 2 as it comes in the "COPYING" file of the 26 # VirtualBox OSE distribution. VirtualBox OSE is distributed in the 27 # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 19 # Copyright (C) 2019-2022 Oracle and/or its affiliates. 20 # 21 # This file is part of VirtualBox base platform packages, as 22 # available from https://www.virtualbox.org. 23 # 24 # This program is free software; you can redistribute it and/or 25 # modify it under the terms of the GNU General Public License 26 # as published by the Free Software Foundation, in version 3 of the 27 # License. 28 # 29 # This program is distributed in the hope that it will be useful, but 30 # WITHOUT ANY WARRANTY; without even the implied warranty of 31 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 32 # General Public License for more details. 33 # 34 # You should have received a copy of the GNU General Public License 35 # along with this program; if not, see <https://www.gnu.org/licenses>. 36 # 37 # SPDX-License-Identifier: GPL-3.0-only 28 38 # 29 39 … … 129 139 if [ -f kernel/timeconst.pl ]; then 130 140 if patch --output /tmp/build.$$ -Np1 <<EOF 131 --- a/kernel/timeconst.pl 132 +++ b/kernel/timeconst.pl 141 --- a/kernel/timeconst.pl 2019-04-15 13:44:55.434946090 +0200 142 +++ b/kernel/timeconst.pl 2019-04-15 13:57:29.330140587 +0200 133 143 @@ -372,5 +372,5 @@ 134 135 - 136 + 137 138 139 144 @val = @{\$canned_values{\$hz}}; 145 - if (!defined(@val)) { 146 + if (!@val) { 147 @val = compute_values(\$hz); 148 } 149 output(\$hz, @val); 140 150 EOF 141 151 then … … 153 163 +++ b/arch/x86/kernel/machine_kexec_64.c 154 164 @@ -542,6 +542,7 @@ int arch_kexec_apply_relocations_add(const Elf64_Ehdr *ehdr, 155 156 157 158 + 159 160 161 165 goto overflow; 166 break; 167 case R_X86_64_PC32: 168 + case R_X86_64_PLT32: 169 value -= (u64)address; 170 *(u32 *)location = value; 171 break; 162 172 EOF 163 173 then … … 172 182 +++ b/arch/x86/kernel/module.c 173 183 @@ -191,6 +191,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, 174 175 176 177 + 178 179 184 goto overflow; 185 break; 186 case R_X86_64_PC32: 187 + case R_X86_64_PLT32: 188 val -= (u64)loc; 189 *(u32 *)loc = val; 180 190 #if 0 181 191 EOF … … 190 200 +++ b/arch/x86/kernel/module.c 191 201 @@ -191,6 +191,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, 192 193 194 195 + 196 197 198 202 goto overflow; 203 break; 204 case R_X86_64_PC32: 205 + case R_X86_64_PLT32: 206 if (*(u32 *)loc != 0) 207 goto invalid_relocation; 208 val -= (u64)loc; 199 209 EOF 200 210 then … … 208 218 +++ b/arch/x86/tools/relocs.c 209 219 @@ -770,9 +770,12 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym, 210 211 212 213 + 214 215 216 217 + 218 + 219 220 221 220 break; 221 222 case R_X86_64_PC32: 223 + case R_X86_64_PLT32: 224 /* 225 * PC relative relocations don't need to be adjusted unless 226 * referencing a percpu symbol. 227 + * 228 + * NB: R_X86_64_PLT32 can be treated as R_X86_64_PC32. 229 */ 230 if (is_percpu_sym(sym, symname)) 231 add_reloc(&relocs32neg, offset); 222 232 EOF 223 233 then … … 225 235 fi 226 236 if patch --output /tmp/build.$$ -Np1 <<EOF 227 --- linux-4.15/tools/lib/subcmd/pager.c 228 +++ linux-4.17/tools/lib/subcmd/pager.c 237 --- linux-4.15/tools/lib/subcmd/pager.c 2017-11-12 19:46:13.000000000 +0100 238 +++ linux-4.17/tools/lib/subcmd/pager.c 2018-06-03 23:15:21.000000000 +0200 229 239 @@ -30,10 +30,13 @@ 230 231 232 233 + 234 235 236 + 237 238 - 239 + 240 + 241 242 240 * have real input 241 */ 242 fd_set in; 243 + fd_set exception; 244 245 FD_ZERO(&in); 246 + FD_ZERO(&exception); 247 FD_SET(0, &in); 248 - select(1, &in, NULL, &in, NULL); 249 + FD_SET(0, &exception); 250 + select(1, &in, NULL, &exception, NULL); 251 252 setenv("LESS", "FRSX", 0); 243 253 } 244 254 EOF … … 247 257 fi 248 258 if patch --output /tmp/build.$$ -Np1 <<EOF 249 --- linux-4.16/tools/lib/str_error_r.c 250 +++ linux-4.17/tools/lib/str_error_r.c 259 --- linux-4.16/tools/lib/str_error_r.c 2019-04-15 06:04:50.978464217 +0200 260 +++ linux-4.17/tools/lib/str_error_r.c 2018-06-03 23:15:21.000000000 +0200 251 261 @@ -22,6 +22,6 @@ 252 262 { 253 254 255 - 256 + 257 263 int err = strerror_r(errnum, buf, buflen); 264 if (err) 265 - snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err); 266 + snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err); 267 return buf; 258 268 } 259 269 EOF … … 269 279 4.10.*|4.[9].*) 270 280 if patch --output /tmp/build.$$ -Np1 <<EOF 271 --- linux-4.10/include/linux/log2.h 272 +++ linux-4.11/include/linux/log2.h 281 --- linux-4.10/include/linux/log2.h 2017-02-19 23:34:00.000000000 +0100 282 +++ linux-4.11/include/linux/log2.h 2017-11-12 19:46:13.000000000 +0100 273 283 @@ -15,14 +15,8 @@ 274 284 #include <linux/types.h> … … 288 298 @@ -84,9 +78,9 @@ 289 299 */ 290 #define ilog2(n) 291 ( 292 __builtin_constant_p(n) ? (\\293 - (n) < 1 ? ____ilog2_NaN() :\\294 + (n) < 2 ? 0 :\\295 (n) & (1ULL << 63) ? 63 :\\296 (n) & (1ULL << 62) ? 62 :\\297 (n) & (1ULL << 61) ? 61 :\\298 (n) & (1ULL << 60) ? 60 :\\300 #define ilog2(n) \\ 301 ( \\ 302 __builtin_constant_p(n) ? ( \\ 303 - (n) < 1 ? ____ilog2_NaN() : \\ 304 + (n) < 2 ? 0 : \\ 305 (n) & (1ULL << 63) ? 63 : \\ 306 (n) & (1ULL << 62) ? 62 : \\ 307 (n) & (1ULL << 61) ? 61 : \\ 308 (n) & (1ULL << 60) ? 60 : \\ 299 309 @@ -147,12 +141,9 @@ 300 (n) & (1ULL << 5) ? 5 :\\301 (n) & (1ULL << 4) ? 4 :\\302 (n) & (1ULL << 3) ? 3 :\\303 (n) & (1ULL << 2) ? 2 :\\304 - (n) & (1ULL << 1) ? 1 :\\305 - (n) & (1ULL << 0) ? 0 :\\306 - ____ilog2_NaN()\\307 - ) :\\308 + 1 ) :\\309 (sizeof(n) <= 4) ?\\310 __ilog2_u32(n) :\\311 __ilog2_u64(n)\\310 (n) & (1ULL << 5) ? 5 : \\ 311 (n) & (1ULL << 4) ? 4 : \\ 312 (n) & (1ULL << 3) ? 3 : \\ 313 (n) & (1ULL << 2) ? 2 : \\ 314 - (n) & (1ULL << 1) ? 1 : \\ 315 - (n) & (1ULL << 0) ? 0 : \\ 316 - ____ilog2_NaN() \\ 317 - ) : \\ 318 + 1 ) : \\ 319 (sizeof(n) <= 4) ? \\ 320 __ilog2_u32(n) : \\ 321 __ilog2_u64(n) \\ 312 322 ) 313 323 EOF … … 326 336 2.5.*|2.6.[012345678]) 327 337 if patch --output /tmp/build.$$ -Np1 <<EOF 328 --- linux-2.6.8/scripts/kconfig/mconf.c 329 +++ linux-2.6.8/scripts/kconfig/mconf.c 338 --- linux-2.6.8/scripts/kconfig/mconf.c 2004-08-14 07:36:32.000000000 +0200 339 +++ linux-2.6.8/scripts/kconfig/mconf.c 2019-04-15 15:52:42.143587966 +0200 330 340 @@ -88,5 +88,5 @@ 331 341 static struct termios ios_org; … … 347 357 2.6.2[456]*) 348 358 if patch --output /tmp/build.$$ -Np1 <<EOF 349 --- linux-2.6.26/arch/x86/lib/copy_user_64.S 350 +++ linux-2.6.26/arch/x86/lib/copy_user_64.S 359 --- linux-2.6.26/arch/x86/lib/copy_user_64.S 2019-04-15 16:21:49.475846822 +0200 360 +++ linux-2.6.26/arch/x86/lib/copy_user_64.S 2019-04-15 16:21:50.883863141 +0200 351 361 @@ -341,7 +341,7 @@ 352 11: 353 7: 354 362 11: pop %rax 363 7: ret 364 CFI_ENDPROC 355 365 -END(copy_user_generic_c) 356 366 +END(copy_user_generic_string) 357 367 358 359 368 .section __ex_table,"a" 369 .quad 1b,3b 360 370 EOF 361 371 then … … 365 375 2.6.2[0123]*|2.6.19*) 366 376 if patch --output /tmp/build.$$ -Np1 <<EOF 367 --- linux-2.6.23/arch/x86_64/lib/copy_user.S 368 +++ linux-2.6.23/arch/x86_64/lib/copy_user.S 377 --- linux-2.6.23/arch/x86_64/lib/copy_user.S 2019-04-15 16:42:16.898006203 +0200 378 +++ linux-2.6.23/arch/x86_64/lib/copy_user.S 2019-04-15 16:42:25.906109885 +0200 369 379 @@ -344,7 +344,7 @@ 370 11: 371 7: 372 380 11: pop %rax 381 7: ret 382 CFI_ENDPROC 373 383 -END(copy_user_generic_c) 374 384 +END(copy_user_generic_string) 375 385 376 377 386 .section __ex_table,"a" 387 .quad 1b,3b 378 388 EOF 379 389 then … … 386 396 if [ -f arch/x86_64/vdso/vdso.lds.S ]; then 387 397 if patch --output /tmp/build.$$ -Np1 <<EOF 388 --- linux-2.6.23/arch/x86_64/vdso/vdso.lds.S 389 +++ linux-2.6.23/arch/x86_64/vdso/vdso.lds.S 398 --- linux-2.6.23/arch/x86_64/vdso/vdso.lds.S 2019-04-15 17:20:27.567440594 +0200 399 +++ linux-2.6.23/arch/x86_64/vdso/vdso.lds.S 2019-04-15 17:20:29.635463886 +0200 390 400 @@ -28,5 +28,5 @@ 391 .text : { *(.text) } 392 .text.ptr : { *(.text.ptr) } 401 .text : { *(.text) } :text 402 .text.ptr : { *(.text.ptr) } :text 393 403 - . = VDSO_PRELINK + 0x900; 394 404 + . = VDSO_PRELINK + 0xa00; 395 .data : { *(.data) } 396 .bss : { *(.bss) } 405 .data : { *(.data) } :text 406 .bss : { *(.bss) } :text 397 407 EOF 398 408 then … … 406 416 2.6.[0-9]!([0-9])*|2.6.1[0-9]*|2.6.2[01]*) 407 417 if patch --output /tmp/build.$$ -Np1 <<EOF 408 --- linux-2.6.21/scripts/mod/sumversion.c 409 +++ linux-2.6.21/scripts/mod/sumversion.c 418 --- linux-2.6.21/scripts/mod/sumversion.c 2007-02-04 19:44:54.000000000 +0100 419 +++ linux-2.6.21/scripts/mod/sumversion.c 2019-02-15 16:10:12.956678862 +0100 410 420 @@ -7,4 +7,5 @@ 411 421 #include <ctype.h> … … 426 436 2.6.[0-9]!([0-9])*|2.6.1[0-7]*) 427 437 if patch --output /tmp/build.$$ -Np1 <<EOF 428 --- linux-2.6.17/arch/x86_64/boot/tools/build.c 429 +++ linux-2.6.18/arch/x86_64/boot/tools/build.c 438 --- linux-2.6.17/arch/x86_64/boot/tools/build.c 2006-01-03 04:21:10.000000000 +0100 439 +++ linux-2.6.18/arch/x86_64/boot/tools/build.c 2007-02-04 19:44:54.000000000 +0100 430 440 @@ -149,9 +149,7 @@ 431 432 433 434 - 435 - 436 - 437 - 438 + 439 + 440 441 441 sz = sb.st_size; 442 fprintf (stderr, "System is %d kB\n", sz/1024); 443 sys_size = (sz + 15) / 16; 444 - /* 0x40000*16 = 4.0 MB, reasonable estimate for the current maximum */ 445 - if (sys_size > (is_big_kernel ? 0x40000 : DEF_SYSSIZE)) 446 - die("System is too big. Try using %smodules.", 447 - is_big_kernel ? "" : "bzImage or "); 448 + if (!is_big_kernel && sys_size > DEF_SYSSIZE) 449 + die("System is too big. Try using bzImage or modules."); 450 while (sz > 0) { 451 int l, n; 442 452 EOF 443 453 then … … 452 462 2.6.[0-9]!([0-9])*|2.6.1[01]*) 453 463 if patch --output /tmp/build.$$ -lNp1 <<EOF 454 --- linux-2.6.11/arch/x86_64/kernel/process.c 455 +++ linux-2.6.11/arch/x86_64/kernel/process.c 464 --- linux-2.6.11/arch/x86_64/kernel/process.c 2005-03-02 08:38:10.000000000 +0100 465 +++ linux-2.6.11/arch/x86_64/kernel/process.c 2019-02-15 16:57:47.653585327 +0100 456 466 @@ -390,10 +390,10 @@ 457 458 459 460 - 461 - 462 - 463 - 464 + 465 + 466 + 467 + 468 469 470 467 p->thread.fs = me->thread.fs; 468 p->thread.gs = me->thread.gs; 469 470 - asm("movl %%gs,%0" : "=m" (p->thread.gsindex)); 471 - asm("movl %%fs,%0" : "=m" (p->thread.fsindex)); 472 - asm("movl %%es,%0" : "=m" (p->thread.es)); 473 - asm("movl %%ds,%0" : "=m" (p->thread.ds)); 474 + asm("movw %%gs,%0" : "=m" (p->thread.gsindex)); 475 + asm("movw %%fs,%0" : "=m" (p->thread.fsindex)); 476 + asm("movw %%es,%0" : "=m" (p->thread.es)); 477 + asm("movw %%ds,%0" : "=m" (p->thread.ds)); 478 479 if (unlikely(me->thread.io_bitmap_ptr != NULL)) { 480 p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); 471 481 @@ -456,11 +456,11 @@ 472 473 474 475 - 476 + 477 478 479 480 - 481 + 482 483 482 * Switch DS and ES. 483 * This won't pick up thread selector changes, but I guess that is ok. 484 */ 485 - asm volatile("movl %%es,%0" : "=m" (prev->es)); 486 + asm volatile("movw %%es,%0" : "=m" (prev->es)); 487 if (unlikely(next->es | prev->es)) 488 loadsegment(es, next->es); 489 490 - asm volatile ("movl %%ds,%0" : "=m" (prev->ds)); 491 + asm volatile ("movw %%ds,%0" : "=m" (prev->ds)); 492 if (unlikely(next->ds | prev->ds)) 493 loadsegment(ds, next->ds); 484 494 EOF 485 495 then
Note:
See TracChangeset
for help on using the changeset viewer.