|
NetBSD Installation and Upgrading Have trouble getting NetBSD on your toaster? |
|
Thread Tools | Display Modes |
|
|||
Installing NetBSD to HD/SSD on the Banana Pi
NetBSD Installation Guide for A20 / A31 based boards
Start with an ARMv7 image from evbarm-earmv7hf/binary/gzimg/armv7.img.gz from NetBSD 7.0 Download a U-Boot build for your board Download the correct build from the linux-sunxi web site http://dl.linux-sunxi.org/nightly/u-...inline-latest/. Decompress the image via gunzip(1): Code:
# gunzip armv7.img.gz Code:
# dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1k seek=8 conv=notrunc Code:
# dd if=armv7.img of=/dev/rsd0d bs=1m Code:
# dd if=armv7.img of=/dev/mmcblk0 bs=1M; sync Code:
setenv kernel_addr 82000000 setenv kernel netbsd-BPI.ub setenv bootargs "root=ld0a console=fb" fatload mmc 0:1 ${kernel_addr} ${kernel} bootm ${kernel_addr} Code:
# mkubootimage -A arm -n armv7 -T script boot.cmd boot.scr Copy the boot.scr to the MS-DOS partition of the SD card. On first boot NetBSD will resize itself to fill your SD card and then automatically reboot. The second boot will boot into the OS but will take longer than usual due to SSH key generation. You can log in as root, there is no default password. Transferring the root partition from SD card to a SATA drive First, check your drive is detected: Code:
# dmesg | grep wd0 Code:
# disklabel -i -I wd0 partition>a Code:
partition>b Filesystem type [unused]: swap Start offset: a # Start partition b at the end of partition a Partition size: $ # `$` means use the rest of the available space on the drive Code:
# newfs -O2 /dev/rwd0a # mount -o log /dev/wd0a /mnt # pax -X -rwpe / /mnt Edit /mnt/etc/fstab and substitute `ld0a` for `wd0a` and `ld0b` for `wd0b` then run: Code:
# halt The NetBSD 7.0 evbarm kernels are hard-coded to mount the root fs from the SD card (ld0a) so the final step is to replace the kernel image on the DOS boot partition of the SD card with one that has been patched to mount wd0a as the root fs, update the boot.scr file to use the patched kernel and change the `root=ld0a` boot arg to `root=wd0a`. A pre-built, wd0-modified kernel can be downloaded from here: https://www.netbsd.org/~tnn/bpi-wd0a/netbsd.ub Last edited by danboid; 15th February 2016 at 12:40 AM. Reason: Fully revised, working SATA install guide |
|
|||
Hi IdOp
The BPi doesn't have a BIOS and installboot is unlikely to be of any use to me because the BPi, like many SBC ARM devices, uses the u-boot bootloader. u-boot is installed to the MBR of my SD card and it successfully boots the rootfs from the SD card but not the HD. Thanks for your suggestions |
|
||||
Thanks for the further information. As you can see I wasn't kidding about lack of familiarity with BPi.
It seems to me then there are two issues. The first is getting u-boot to attempt to boot off the HD. This I know nothing about. Second, though, if you can resolve the first issue, is that I think you'll still need to have the primary bootloader installed on the hard disk. It is placed at the start of the NetBSD partition. Without it present, I doubt you can boot NetBSD. Hopefully you'll get some replies from others more familiar with this particular setup. Last edited by IdOp; 13th February 2016 at 07:27 PM. |
|
|||
Hi IdOp!
Ah right! Seems I misunderstood your first reply then. I'm only familar with Linux where we only have one bootloader (GRUB or lilo on x86, u-boot on ARM) so I presumed that installboot would be analagous to GRUB in that it would be the bootloader I'd be using to boot NetBSD on x86/x64. However, after your latest response I now get the impression that if I was dual-booting NetBSD with Linux on x86 I would need to have both GRUB and the installboot primary bootloader installed, installboot living exclusively on the NetBSD partition whilst GRUB (or u-boot in this case) would be on the MBR. As I said in my first post, I avoided using disklabel / fdisk to prepare my drive by using sysinst instead, although I expect that is just a script that depends upon disklabel/fdisk. However, only the partitioning aspect of it works for me on BPi so I have to quit out of it after its done that. I would've expected sysinst to run installboot on my HD too but maybe it only does that after downloading and installing the packages? I'll have a look at the installboot manpage now and see if it makes sense. I may have to do the whole patitioning and formatting procedure manually instead of cheating by using sysinst. |
|
|||
|
|
|||
Yet another stumbling bock!
I have tried the installboot command you recommended but I get the error: installboot: Invalid machine `evbarm' from uname() So I need to also specify a machine type for installboot to use but none of its machine options are (32 bit) ARM platforms so I don't know which one might work the best, if any work at all? On top of that, there is no /usr/mdec/bootxx_ffsv2 file. /usr/mdec contains a bootimx23 and a bootmini2440 file so I could try one of those instead. I know it is possible to get NetBSD installed on the BPi HD as someone in #netbsd has done it but he was unwilling to tell me exactly how he achieved it. Someone else on the port-arm list has had success with this too. I've asked him for details yesterday but I'm still waiting for a response. |
|
||||
Quote:
Quote:
Quote:
From your following post it sounds like you are heading in the right direction on this process of discovery. |
|
|||
I did it!
It only took a full week of my spare time! I'm going to help the NetBSD team update the official docs but in the mean time I'll briefly cover the working process here and maybe I'll update the OP soon. To answer our previous question, no, installboot isn't required on the BPi. What IS requred is a kernel that has been patched to boot off wd0a instead of ld0a. A suitably patched kernel for 7.0 can be downloaded here: https://www.netbsd.org/~tnn/bpi-wd0a/netbsd.ub There is no need to install rsync to copy the root fs to HD, pax can be used for this. After mounting the HD under /mnt you'd run: pax -X -rwpe / /mnt BUILDING A CUSTOM KERNEL $ cvs -z9 -d anoncvs@anoncvs.NetBSD.org:/cvsroot co -r netbsd-7 src $ cd src $ vi sys/arch/evbarm/conf/BPI # change the line: # config netbsd root on ? type ? # to: # config netbsd root on wd0a type ffs $ ./build.sh -m evbarm -a earmv7hf -j 4 -u -U tools $ ./build.sh -m evbarm -a earmv7hf -j 4 -u -U kernel=BPI Kernel will be located in: src/sys/arch/evbarm/compile/obj/BPI/netbsd.ub This kernel needs to be copied to the FAT partition of your SD card and fstab and boot.scr must be adjusted to boot off wd0a instead of ld0a. Last edited by danboid; 14th February 2016 at 11:02 PM. |
|
||||
Excellent! It's always great to hear success stories.
Quote:
Quote:
|
|
|||
I have updated the OP with a complete, working NetBSD installation guide for Allwinner devices like the BPi that has been extended to cover the full process of transferring the root fs from SD card to a SATA drive in detail.
The origiinal guide that this was based on is https://wiki.netbsd.org/ports/evbarm...nner/#index1h2 I'm going to submit a PR to hopefully get that official guide updated to cover these extra steps. Last edited by danboid; 14th February 2016 at 11:18 PM. |
Tags |
banana pi, banana pi netbsd, banana pi sata hard disk ssd install |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble installing NetBSD | sjakke | NetBSD Installation and Upgrading | 14 | 30th August 2011 07:28 PM |
Installing KDE | EverydayDiesel | FreeBSD Installation and Upgrading | 7 | 27th August 2010 04:27 AM |
installing X11 | hirohitosan | FreeBSD Installation and Upgrading | 3 | 25th June 2008 09:37 AM |
Installing another HD | Johnny2Bad | FreeBSD Installation and Upgrading | 4 | 20th May 2008 05:38 PM |