1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
4 # T2 SDE: package/.../arcload/elf32-netboot.patch
5 # Copyright (C) 2020 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 Fix loading 32-bit kernel on 32-bit Arcs over bootp / tftp on earlier Sgi
18 machines, like the precious and famous O2.
20 Signed-off-by: René Rebe <rene@exactcode.de>
22 --- arcload-0.5-patched/loader/main.c.vanilla 2020-08-28 21:38:30.189076493 +0200
23 +++ arcload-0.5-patched/loader/main.c 2020-08-30 14:42:32.672622589 +0200
25 printf("Loading %s...\n\r", fname);
28 - if(bread(&file, sizeof(hdr), &hdr)<0) {
29 + if(bread(&file, sizeof(hdr.e_ident), &hdr)<0) {
30 printf("Error reading ELF header.\n\r");
37 + /* read the rest of the header */
38 + if(bread(&file, (hdr.e_ident[EI_CLASS] == ELFCLASS64 ?
39 + sizeof(Elf64_Ehdr) : sizeof(Elf32_Ehdr)) - EI_NIDENT,
40 + &hdr.e_ident[EI_NIDENT]) < 0) {
41 + printf("Error reading remaining ELF header.\n\r");
46 if(hdr.e_ident[EI_CLASS] == ELFCLASS64) {
47 kentry = load_elf64(&hdr.e64, &file);