NetBSD Problem Report #50435
From www@NetBSD.org Mon Nov 16 16:25:42 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 40765A5B2E
for <gnats-bugs@gnats.NetBSD.org>; Mon, 16 Nov 2015 16:25:42 +0000 (UTC)
Message-Id: <20151116162541.4D5FFA65B8@mollari.NetBSD.org>
Date: Mon, 16 Nov 2015 16:25:41 +0000 (UTC)
From: userm57@yahoo.com
Reply-To: userm57@yahoo.com
To: gnats-bugs@NetBSD.org
Subject: "BSD/Mac68k Booter" can't boot cross-compiled kernels from the NetBSD root partition.
X-Send-Pr-Version: www-1.0
>Number: 50435
>Category: port-mac68k
>Synopsis: "BSD/Mac68k Booter" can't boot cross-compiled kernels from the NetBSD root partition.
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: port-mac68k-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 16 16:30:00 +0000 2015
>Last-Modified: Tue Nov 17 00:05:01 +0000 2015
>Originator: Stanley Johnson
>Release: NetBSD 7.0 (release) with customized kernel
>Organization:
N/A
>Environment:
NetBSD maclciii 7.0 NetBSD 7.0 (MACLCIII) #1: Tue Nov 10 03:33:23 MST 2015 root@maclciii:/usr/src/sys/arch/mac68k/compile/MACLCIII mac68k
>Description:
A kernel compiled on a Mac LC III and optimized for a 68030 boots successfully from the NetBSD "/" partition using "BSD/Mac68k Booter". However, a kernel that is cross-compiled on a MacBook Pro running Debian GNU/Linux 7.8 using the same configuration file will not boot directly from the NetBSD "/" partition, though the compressed version will boot from Mac OS. "BSD/Mac68k Booter" complains that the cross-compiled kernel is not in a format that it can execute.
It's important to be able to boot directly from the NetBSD root partition; otherwise, kernels have to be maintained in both Mac OS and NetBSD.
>How-To-Repeat:
Compile a kernel on a native 68030 system (about 2-3 days on a Mac LC III). Confirm that it will boot from the "/" partition using "BSD/Mac68k Booter". Then re-compile with the same configuration file using a cross compiler (takes just a few minutes). The resulting kernel will not be bootable from the NetBSD "/" partition.
>Fix:
>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-mac68k/50435: "BSD/Mac68k Booter" can't boot cross-compiled kernels from the NetBSD root partition.
Date: Mon, 16 Nov 2015 17:41:26 +0100
Can you please show the output of the following commands (on NetBSD) with the
kernel file you can not boot (substitute the proper file name for /netbsd):
file /netbsd
readelf -l /netbsd
readelf -h /netbsd
Thanks!
Martin
From: Mac User <userm57@yahoo.com>
To: gnats-bugs@NetBSD.org
Cc: Martin Husemann <martin@duskware.de>,
port-mac68k-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: port-mac68k/50435: "BSD/Mac68k Booter" can't boot cross-compiled
kernels from the NetBSD root partition.
Date: Mon, 16 Nov 2015 10:10:25 -0700
> From: Martin Husemann <martin@duskware.de>
> ...
> Can you please show the output of the following commands (on NetBSD) with the
> kernel file you can not boot (substitute the proper file name for /netbsd):
>
> file /netbsd
> readelf -l /netbsd
> readelf -h /netbsd
>
> Thanks!
>
> Martin
>
1) *** Cross-compiled kernel ***
# ls -l /netbsd.new
-rwxr-xr-x 1 root wheel 2190185 Nov 16 09:52 /netbsd.new
# file /netbsd.new
/netbsd.new: ELF 32-bit MSB executable, Motorola m68k, 68020, version 1
(SYSV), statically linked, for NetBSD 7.0, not stripped
# readelf -l /netbsd.new
Elf file type is EXEC (Executable file)
Entry point 0x2e00
There are 1 program headers, starting at offset 52
Program Header:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000080 0x00000000 0x00000000 0x1a0054 0x1b30c0 RWE 0x40
Section to Segment mapping:
Segment Sections...
00 .text .rodata link_set_bufq_strats link_set_modules
link_set_dkwedge_methods link_set_evcnts link_set_sysctl_funcs
link_set_domains link_set_prop_linkpools .eh_frame .data .bss
# readelf -h /netbsd.new
ELF Header:
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: MC68000
Version: 0x1
Entry point address: 0x2e00
Start of program headers: 52 (bytes into file)
Start of section headers: 1732408 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 1
Size of section headers: 40 (bytes)
Number of section headers: 19
Section header string table index: 16
2) *** Locally-compiled (Mac LC III) kernel (currently running) ***
# ls -l /netbsd
-rwxr-xr-x 1 root wheel 2190082 Nov 10 03:37 /netbsd
# file /netbsd
/netbsd: ELF 32-bit MSB executable, Motorola m68k, 68020, version 1
(SYSV), statically linked, for NetBSD 7.0, not stripped
# readelf -l /netbsd
Elf file type is EXEC (Executable file)
Entry point 0x2e00
There are 1 program headers, starting at offset 52
Program Header:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000080 0x00000000 0x00000000 0x1a0054 0x1b30c0 RWE 0x40
Section to Segment mapping:
Segment Sections...
00 .text .rodata link_set_bufq_strats link_set_modules
link_set_dkwedge_methods link_set_evcnts link_set_sysctl_funcs
link_set_domains link_set_prop_linkpools .eh_frame .data .bss
# readelf -h /netbsd
ELF Header:
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: MC68000
Version: 0x1
Entry point address: 0x2e00
Start of program headers: 52 (bytes into file)
Start of section headers: 1732412 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 1
Size of section headers: 40 (bytes)
Number of section headers: 19
Section header string table index: 16
Note: This is the error reported by "BSD/Mac68k Booter" for /netbsd.new
(earlier I thought the error was something to the effect that the file
was in a format that the BSD/Mac68k Booter couldn't execute):
Booting...
transparent = 1
Huh????
Boot error: Failed to read header from kernel image - read 0 bytes.
*********** Boot Stopped. ***********
Boot error: kernel_parse(COUNT_KERNEL) failed
*********** Boot Stopped. ***********
From: Mac User <userm57@yahoo.com>
To: gnats-bugs@NetBSD.org
Cc: Martin Husemann <martin@duskware.de>,
port-mac68k-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: port-mac68k/50435: "BSD/Mac68k Booter" can't boot cross-compiled
kernels from the NetBSD root partition.
Date: Mon, 16 Nov 2015 15:12:39 -0700
Update:
Using
makeoptions COPTS="-O2 -m68030"
instead of
makeoptions COPTS="-Os -m68030"
in the config file makes (at least some) cross-compiled kernels
bootable, though somewhat larger:
-rwxr-xr-x 1 johnson johnson 2190185 Nov 14 13:54 MACLCIII/netbsd
-rwxr-xr-x 1 johnson johnson 2496135 Nov 16 14:38 TESTLCIII/netbsd
Stand by... I'm checking whether the GENERIC kernel (using sbc instead
of ncrscsi) works if -Os is specified instead of -O2...
% diff GENERIC GENERICTEST
27c27,28
< makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk
---
> #makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk
> makeoptions COPTS="-Os -fno-reorder-blocks" # see share/mk/sys.mk
254,255c255,256
< ncrscsi0 at obio? addr 0 # SCSI NCR 5380
< #sbc0 at obio? addr 0 flags 0x1 # MI SCSI NCR 5380
---
> #ncrscsi0 at obio? addr 0 # SCSI NCR 5380
> sbc0 at obio? addr 0 flags 0x1 # MI SCSI NCR 5380
The GENERICTEST kernel failed.
So it appears that the use of -Os instead of -O2 causes the
cross-compiled kernel to be (always?) unbootable, and it's likely that
some other combination of options makes "BSD/Mac68k Booter" think that
the resulting kernel file is not in a format that it can execute (I can
try to isolate a test case for that if it would be helpful).
-Stan
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.