NetBSD Problem Report #52124

From www@NetBSD.org  Thu Mar 30 01:40:05 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(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 19CCF7A266
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 30 Mar 2017 01:40:05 +0000 (UTC)
Message-Id: <20170330014003.4722A7A2A5@mollari.NetBSD.org>
Date: Thu, 30 Mar 2017 01:40:03 +0000 (UTC)
From: innes666@gmail.com
Reply-To: innes666@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Odroid C1 & Odroid C1+ installation bugs & fix
X-Send-Pr-Version: www-1.0

>Number:         52124
>Category:       port-evbarm
>Synopsis:       Odroid C1 & Odroid C1+ installation bugs & fix
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 30 01:45:00 +0000 2017
>Last-Modified:  Sat Apr 01 11:05:00 +0000 2017
>Originator:     innes
>Release:        7.0; 7.1; HEAD
>Organization:
>Environment:
(only possible when mentioned fixes are applied and thus installation worked at all)
NetBSD they_live 7.1 NetBSD 7.1 (MYKERNEL) #0: Thu Mar 30 02:23:23 UTC 2017 root@they_live:/usr/src/sys/arch/evbarm/compile/MYKERNEL evbarm
>Description:
Title: Odroid C1 & Odroid C1+ installation bugs & fix
(same error with 7.0, 7.1 and current)

1.)
The NetBSD wiki page (link in paragraph 3) states how to install NetBSD on an Odroid C1 or C1+.
This fails if one doesn't change the disklabel during installation. disklabel -i ld0 needs to be adjusted before attempting to resize_ffs, else it will not work.
The wiki page should be corrected according to the detailed info below.

Moreover, even if installing NetBSD according to the outlined steps and the proposed disklabel adjustment, one will see dmesg being flooded by following error messages: (only a few example lines were given, for the whole dmesg output fills dmesg completely and kernel needs to be rebuilt at least with options MSGBUFSIZE=131072 to catch it all)
kobj_checksyms, 882: [compat]: linker error: symbol 'cdevsw_lookup' not found
kobj_checksyms, 882: [compat]: linker error: symbol 'dosetitimer' not found
kobj_checksyms, 882: [compat]: linker error: symbol 'kern_free' not found
etc.
and a long list of other very similar messages
one line such as:
WARNING: module error: unable to affix module 'compat', error 8

Checking /usr/src/sys/arch/evbarm/conf/std.amlogic reveals that 'options MODULAR' and 'options MODULAR_DEFAULT_AUTOLOAD' are enabled which seems standard for other ARM platforms as well,

but in /usr/src/sys/arch/evbarm/conf/ODROID-C1 one notices that only 'options COMPAT_70' is enabled.
Other ARM platforms will have enabled in their kernel CONFIG the following: COMPAT_30; COMPAT_40; COMPAT_50; COMPAT_60


To solve the kobj_checksyms messages due to enabled MODULAR it's sufficient to enable following options in /usr/src/sys/arch/evbarm/conf/ODROID-C1 :
COMPAT_70; COMPAT_60 and COMPAT_50.

The other possible solution is to disable MODULAR and MODULAR_DEFAULT_AUTOLOAD in std.amlogic and disabling all COMPAT_XX options in the ODROID-C1 kernel configuration file.


2.)
When trying to run /usr/bin/systat the following error appears:
/netbsd: No such file or directory

When trying to run /usr/bin/vmstat the following error shows up:
vmstat: kvm_openfiles: /netbsd: No such file or directory

The above mentioned errors can be fixed via removing or commenting the following line in /usr/src/sys/arch/evbarm/conf/ODROID-C1
#makeoptions    COPY_SYMTAB=1

and replacing it with:
options    SYMTAB_SPACE=820000


3.)
Proposed additions/changes to the wiki installation page that include the necessary disklabel operation after the fdisk step:
https://wiki.netbsd.org/ports/evbarm/odroid-c1/

[...]
a) Write the image to a sd card     # Appending HOW to do it on 2 platforms to be explicit:

	+ dd if=armv7.img of=/dev/rsd0d bs=1m       # ON AMD64&i386
OR
	+ dd if=armv7.img of=/dev/rsd0c bs=1m		# ON ARM

(rsd0d or rsd0c specifies whole disk)


b) the netbsd wiki on the odroid c1 installation mentions nearly all steps including the usage of fdisk, however misses mentioning the necessary changes to disklabel

Without a correct disklabel the attempt to # resize_ffs -y /dev/rld0f will fail with: resize_ffs: read failed: Invalid argument

Thus one needs to adjust the disklabel _as well_ after changing fdisk according to wiki.

#PROPOSED WIKI ADDITION#: (after # fdisk -u ld0    and _before_ the entry # resize_ffs -y /dev/rld0f, the rest at the end can be removed as it has been included here already)

Executing # disklabel ld0 will show that partitions a and e overlap and partitions a and f overlap, thus:

Execute disklabel in interactive mode as root: 
# disklabel -i ld0

Remove partition 'a' via setting size to 0:
partition>a
Filesystem type [4.2BSD]: unused
Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: 0
Partition size: 0

Grow the label of partition f via setting size to all remaining ($):
partition>f
Filesystem type [4.2BSD]: 
Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: 188M
Partition size: $ 

Write the partition table: (it will complain although resize_ffs will work after this step)
partition>W
Label disk [n]?y
Label not written

Exit with Q
disklabel>Q

Attempt resizing the ffs filesystem and be patient, don't cancel/exit the process:
# resize_ffs -y /dev/rdl0f
It should exit quietly and return to shell:
#

Check the new disklabel:
# disklabel ld0

Reboot
# reboot

Change the root partition in /etc/fstab:
(vi won't work at this point, that's why mount and cat)

# mount -u -o rw /dev/ld0f /
# cat > /etc/fstab << EOF
/dev/ld0f       /               ffs     rw      1 1
/dev/ld0e       /boot           msdos   rw      1 1
kernfs          /kern           kernfs  rw
ptyfs           /dev/pts        ptyfs   rw
procfs          /proc           procfs  rw
tmpfs           /var/shm        tmpfs   rw,-m1777,-sram%25
EOF

# reboot


4)
Summary
When the wiki page to the installation is followed as is AND the disklabel prior to resize_ffs is adjusted (missing information in the wiki article) the install will be successful.
No error messages will appear IF the kernel configuration file ODROID-C1 is changed.
The lines that need to change in /usr/src/sys/arch/evbarm/conf/ODROID-C1 are:

uncommenting/enabling: 
options COMPAT_50
options COMPAT_60
options COMPAT_70

because it seems that the enabled options MODULAR in std.amlogic require one ore several of these COMPAT options.

Furthermore removing or commenting:
#makeoptions    COPY_SYMTAB=1

And adding/enabling:
options    SYMTAB_SPACE=820000


----------------------------------
Thanks
>How-To-Repeat:
try any official 7.0, 7.1 or HEAD  armv7.img 
>Fix:
full description includes fix

>Audit-Trail:
From: Sevan Janiyan <venture37@geeklan.co.uk>
To: "gnats-bugs@netbsd.org" <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: port-evbarm/52124: Odroid C1 & Odroid C1+ installation bugs & fix
Date: Sat, 1 Apr 2017 12:02:37 +0100

 Hello,
 Just to clarify, the image you're using to get started with, is it a
 generated images posted on cdn/ftp.netbsd.org, generated image from
 build.sh release target or a manual image you've put together yourself
 (without the help of build.sh).


 Sevan

NetBSD Home
NetBSD PR Database Search

(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.