DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD Installation and Upgrading

NetBSD Installation and Upgrading Have trouble getting NetBSD on your toaster?

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th April 2017
milestone milestone is offline
New User
 
Join Date: Apr 2017
Posts: 6
Default sysupgrade fails on evbarm7hf (rasperry pi 2)

Hello everyone

I tried to upgrade NetBSD from 7.0.1 to 7.0.2 but it fails.
Code:
sysupgrade kernel
sysupgrade: I: Skipping kernel installation (KERNEL not set)
At first the kernel was not recognized but I set it manual to RPI2

Next try:
No error message, everything seems to be fine but:
Code:
uname -a
NetBSD berlin 7.0.1 NetBSD 7.0.1 (RPI2.201605221355Z) evbarm
Later I tried to upgrade from 7.0.1 to 7.1 but I got the same result. I still stay with 7.0.1 but don't know what I did wrong or where I could try to look.


Update:
Several months later, I tried it again with the same result.

Before I did a complete new installation with NetBSD 8.99.2 (RPI2)

Code:
sysupgrade auto ftp://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/201711241510Z/evbarm-earmv7hf
Code:
uname -a
NetBSD armv7 8.99.2 NetBSD 8.99.2 (RPI2) #0: Tue Sep 12 07:19:36 UTC 2017  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI2 evbarm
Any ideas?

Last edited by milestone; 25th November 2017 at 02:36 PM. Reason: Update
Reply With Quote
  #2   (View Single Post)  
Old 26th January 2018
milestone milestone is offline
New User
 
Join Date: Apr 2017
Posts: 6
Default

today I tried sysupgrade 8.99.8 -> 8.99.12

same result. No errors and after all I stay with 8.99.8
Code:
$ name -r
8.99.8
Code:
$ ls -l *bsd
-rw-r--r--  1 root  wheel  8054460 Jan 25 22:21 netbsd
-rw-r--r--  1 root  wheel  7983564 Dec 29 12:22 onetbsd

Code:
$ cd /kern ; ls -l
total 31
-r--r--r--  1 root  wheel     11 Jan 26 07:59 boottime
-r--r--r--  1 root  wheel    318 Jan 26 08:11 copyright
-rw-r--r--  1 root  wheel      6 Jan 26 08:11 hostname
-r--r--r--  1 root  wheel      4 Jan 26 08:11 hz
-r--r--r--  1 root  wheel     14 Jan 26 08:11 loadavg
-r--r--r--  1 root  wheel  16368 Jan 26 08:11 msgbuf
-r--r--r--  1 root  wheel      5 Jan 26 08:11 pagesize
-r--r--r--  1 root  wheel      7 Jan 26 08:11 physmem
br--r--r--  1 root  wheel  92, 0 Jan 26 08:11 rootdev
cr--r--r--  1 root  wheel  92, 0 Jan 26 08:11 rrootdev
-r--r--r--  1 root  wheel     18 Jan 26 08:11 time
-r--r--r--  1 root  wheel    122 Jan 26 08:11 version
Maybe just a bug in the version file?
Reply With Quote
  #3   (View Single Post)  
Old 9th February 2018
milestone milestone is offline
New User
 
Join Date: Apr 2017
Posts: 6
Default

On the netbsd wiki it is mentioned how to upgrade the kernel [1]

Quote:
Updating the kernel
  • Build a new kernel, e.g. using build.sh. It will tell you where the ELF version of the kernel is, e.g.
    ...
    Kernels built from RPI2:
    /Users/feyrer/work/NetBSD/cvs/src-current/obj.evbarm-Darwin-XXX/sys/arch/evbarm/compile/RPI2/netbsd
    ...
  • Besides the "netbsd" kernel in ELF format, there is also a "netbsd.bin" kernel that is in a format that the Raspberry can boot.
  • Depending on your hardware version, copy this either to /boot/kernel.img (First generation Pi, Pi Zero hardware) or to /boot/kernel7.img (Pi 2, Pi 3 hardware)
  • reboot

So I guess, that I have to copy the kernel into the directory /boot
Quote:
#ls -l *.IMG
-rwxr-xr-x 1 root wheel 7348948 Dec 3 21:03 KERNEL7.IMG
But which file do I need? None of the files are created with sysupgrade?
Or do I have to build the kernel by myself on the RPI and it is not possible with sysupgrade?

[1] http://wiki.netbsd.org/ports/evbarm/..._pi/#index10h2

Last edited by milestone; 9th February 2018 at 03:30 PM. Reason: additional information
Reply With Quote
  #4   (View Single Post)  
Old 8th June 2019
milestone milestone is offline
New User
 
Join Date: Apr 2017
Posts: 6
Default

Still the same problem when I try to upgrade from 8.0 to 8.1

Changed the Kernel manual to RPI2
Quote:
/usr/pkg/etc/sysupgrade.conf
KERNEL=RPI2
Then I started the upgrade process:
No problems at all

But ...
Quote:
uname -a
NetBSD armv7 8.0 NetBSD 8.0 (RPI2) #0: Tue Jul 17 14:59:51 UTC 2018 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI2 evbarm
Reply With Quote
  #5   (View Single Post)  
Old 8th June 2019
milestone milestone is offline
New User
 
Join Date: Apr 2017
Posts: 6
Default

The date of the files look ok except the /boot directory
So I think the boot process is maybe different than on other systems?

Code:
-bash-5.0$ ls -lT
total 29554
drwxr-xr-x   2 root  wheel      512 May 31 10:43:59 2019 altroot
drwxr-xr-x   2 root  wheel     1024 May 31 10:43:59 2019 bin
drwxr-xr-x   1 root  wheel    16384 Dec 31 23:00:00 1979 boot
drwxr-xr-x   9 root  wheel    28160 May 31 10:43:59 2019 dev
-rw-------   1 root  wheel   671468 Jan  1 19:28:38 2019 dhcpcd.core
drwxr-xr-x  29 root  wheel     2048 Jun  8 14:39:03 2019 etc
drwxr-xr-x   3 root  wheel      512 Oct 27 12:48:52 2018 home
dr-xr-xr-x   2 root  wheel      512 Jun  8 14:41:43 2019 kern
drwxr-xr-x   4 root  wheel     2048 May 31 10:43:59 2019 lib
drwxr-xr-x   3 root  wheel      512 May 31 10:43:59 2019 libdata
drwxr-xr-x   5 root  wheel      512 May 31 10:43:59 2019 libexec
drwxr-xr-x   2 root  wheel      512 May 31 10:43:59 2019 mnt
-rw-r--r--   1 root  wheel  7052052 Jun  8 11:59:38 2019 netbsd
-rw-r--r--   1 root  wheel  7052052 Jun  7 21:40:50 2019 onetbsd
dr-xr-xr-x   1 root  wheel      512 Jun  8 14:41:43 2019 proc
drwxr-xr-x   2 root  wheel     3072 May 31 10:43:59 2019 rescue
drwxr-xr-x   5 root  wheel      512 May 31 10:43:59 2019 root
drwxr-xr-x   2 root  wheel     3072 May 31 10:43:59 2019 sbin
drwxr-xr-x   3 root  wheel      512 May 31 10:43:59 2019 stand
drwxrwxrwt   2 root  wheel      512 Jun  8 14:38:20 2019 tmp
drwxr-xr-x  15 root  wheel      512 May 31 10:43:59 2019 usr
drwxr-xr-x  26 root  wheel      512 May 31 10:43:59 2019 var
-bash-5.0$ uname -a
NetBSD armv7 8.0 NetBSD 8.0 (RPI2) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI2 evbarm
Reply With Quote
  #6   (View Single Post)  
Old 30th June 2019
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Fdisk Soldier
 
Join Date: Oct 2017
Location: Rome
Posts: 61
Wink a couple of solutions for you...

Quote:
Originally Posted by milestone View Post
The date of the files look ok except the /boot directory
So I think the boot process is maybe different than on other systems?
Yes it, and that's where the problem lays : while sysupgrade is doing exactly what it's supposed to do (it's a arch-agnostic shtk script), you are definitely not booting the new kernel. The boot process of most ARM SoCs specifically designed for Linux, involves loading to SDRAM a self-extracting compressed zImage of the kernel, from a FAT{16,32} partition, at 0x82000000, see the arm/booting section of Linux docs. ARM SoCs are not compatible with IBM BIOS and AFAICT cannot make use of boot.cfg(5): that's why your updated kernel at /netbsd is not being loaded.

Referring in particular to Raspberry Pi*, all files needed to boot -as well as all the .dtb firmware- are expected to be found on the first (FAT32) partition of a MBR disk: the third stage bootloader, start.elf, reads config.txt and cmdline.txt and loads to SDRAM a armv7hl PI2 kernel zImage, by default called kernel7.img: any custom name needs to be specified in config.txt, see official docs on Rpi Boot Options.

Now, if you hypothetically renamed a standard netbsd kernel ELF as'kernel7.img' and put it on /boot , that would naturally fail booting as start.elf expects a zImage. While standard kernel build tools (nbmake-evbarm, build.sh) are not capable of creating zImages, gzboot was specifically created as a workaround for the issue: it produces a self-extracting, zImage-like kernel img out of a gzipped kernel raw bin.

The procedure for creating a self-extracting .img should be as easy as:
Code:
 $ cd /usr/src/sys/arch/evbarm/stand/gzboot && make
 $ export GZBOOT="/path/to/gzboot-bin" KERNEL=netbsd-RPI2.bin.gz    
 $ ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-8.1/evbarm-earmv7hf/binary/kernel/${KERNEL} 
 $ cat  $GZBOOT $KERNEL > netbsd.img
In this way the gzboot binary code and the gzipped kernel binary image are
concatenated into a single .img file: the gzboot code will look for the gzipped data just after itself and decompress the kernel image at the specified memory address.

Hereby, providing userland sets have been updated to the same version, all you'd have to do left would be uploading the netbsd.img to the Rpi2' /boot partition and edit the config.txt so as to point it to the right image and make it load at 0x200000
Code:
kernel=netbsd.img
kernel_address=0x200000
enable_uart=1
Personally, as I can't put up with sources occupying space on my little SD, and I don't plan on keeping track of Rpi official firmware updates, I am used to:
  1. upgrading my RPi3's userland to the latest daily arm64 snapshot with sysupgrade
  2. fetching the latest ARMv8 GENERIC64 image by j.McNeill from invisible.ca/arm (lots of ARM bootable images here, with UEFI support)
  3. burning it somewhere, then rsyncing everything but my custom config.txt (overclocking, VGA monitor) from its /boot partition to my Rpi3's /boot dir
  4. reboot: voilà uname will return the expected kernel version

Hope this helps,
Cheers!

EDIT: it seems NetBSD now uses a specific script to tag the kernel bin as a Rpi self-extracting .img, rpi-mkknlimg.sh

Indeed:
Code:
$  file /netbsd
/netbsd: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, for NetBSD 8.99.48, with debug_info, not stripped
$ file /boot/netbsd.img
/boot/netbsd.img: Raspberry PI kernel image
__________________
Be the change you want to see in the World

Last edited by Sensucht94; 30th June 2019 at 10:16 PM.
Reply With Quote
  #7   (View Single Post)  
Old 3 Weeks Ago
milestone milestone is offline
New User
 
Join Date: Apr 2017
Posts: 6
Default

Thanks for you detailed answer!!
I will give it a try :-)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH from WAN fails, LAN works OK. Why? pttymuth OpenBSD General 12 24th July 2013 07:26 PM
X forwarding fails Graaf_van_Vlaanderen OpenBSD General 7 10th January 2010 12:57 AM
Bootonly CD Fails rtwingfield FreeBSD Installation and Upgrading 1 29th December 2008 01:25 AM
Startx fails disappearedng FreeBSD General 11 19th July 2008 09:32 AM
PC-BSD 1.5.1 fails to install archp2008 FreeBSD Installation and Upgrading 27 1st July 2008 11:47 PM


All times are GMT. The time now is 03:32 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick