DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Installation and Upgrading

OpenBSD Installation and Upgrading Installing and upgrading OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 22nd July 2015
rarebird rarebird is offline
Port Guard
 
Join Date: Jun 2015
Posts: 15
Default Writing armv7 image to a microSD card

I bought a Cubieboard 2 and want to run OpenBSD on it.

I have a 2 GB microSD card that I plugged in my desktop machine:
Code:
umass0 at uhub1 port 3 configuration 1 interface 0 "SanDisk MobileMate Micro" rev 2.00/94.07 addr 3
umass0: using SCSI over Bulk-Only
scsibus2 at umass0: 2 targets, initiator 0
sd3 at scsibus2 targ 1 lun 0: <Generic, STORAGE DEVICE, 9407> SCSI0 0/direct removable serial.0781b7b1000000027658
sd3: 1914MB, 512 bytes/sector, 3920896 sectors
Code:
dd if=miniroot-cubie-57.fs of=/dev/rsd3c
Hangs for a long time and finally spits out
Code:
dd: /dev/rsd3c: Input/output error
1+0 records in
0+0 records out
0 bytes transferred in 0.000 secs (0 bytes/sec)
Sometimes it manages to write a few records at very few bytes/sec but always fails to complete.

Code:
fdisk /dev/sd3
disklabel /dev/sd3
Also hang for a long time before failing

Before I tried writing the image I successfully mounted the MSDOS partition that was on the card before and opened a few files.

What may be the problem? If there is a problem with my card, what brand and model do you suggest getting that will work nicely with OpenBSD?

Last edited by rarebird; 22nd July 2015 at 09:53 PM.
Reply With Quote
  #2   (View Single Post)  
Old 23rd July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,935
Default

  1. The use of /dev/rsd3c is correct. That's the raw device (unbuffered), and the "c" partition is the full drive.
  2. It will not matter what data is on the device, the dd command should write the bites in the .fs image file, 512 bytes at a time, starting at sector number 0, without reading anything.
  3. If you can read the MS-DOS partition from the factory formatted SD card after attempting this, then no sectors are being written to the device. If the dd(1) command were successful even with the first sector, the MS-DOS partition would cease to exist. It's defined in sector 0, the MBR.
Does the SD card have a write-protect tab set to "read only"?



Last edited by jggimi; 23rd July 2015 at 12:24 AM. Reason: image added
Reply With Quote
  #3   (View Single Post)  
Old 23rd July 2015
rarebird rarebird is offline
Port Guard
 
Join Date: Jun 2015
Posts: 15
Default

Thank you for your input.

2. I mentioned reading from the existing filesystem just to assert that the device appeared to be working but it fails when I try writing to it.

3. I managed to write a few sectors with dd so the MBR is gone but it only ever wrote 5-6 sectors.

No, the card does not have any tabs. I will now go and buy myself a decent SD card and card reader and try it out. I hope it works!
Reply With Quote
  #4   (View Single Post)  
Old 23rd July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,935
Default

I took a look at the cubie filesystem image. It includes a replacement MBR and a FAT filesystem, so a successful write operation to media on sd3 may be confirmed with:
  • # fdisk sd3
  • # disklabel sd3
  • # mount /dev/sd3i /mnt
  • $ ls /mnt
  • # umount /mnt
Reply With Quote
  #5   (View Single Post)  
Old 23rd July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,935
Default

Here's my inspection of the 5.7-release image file. I used vnconfig(8) to address the image file as a logical disk drive.
Code:
# vnconfig vnd0 miniroot-cubie-57.fs
# fdisk vnd0
Disk: vnd0    geometry: 368/1/100 [36864 Sectors]
Offset: 0    Signature: 0xAA55
        Starting         Ending        LBA Info:
 #: id        C    H   S -         C     H   S [       start:         size ]
-------------------------------------------------------------------------------
*0: 0C       62    0  38 -       321     0  30 [    6237:        25893 ] Win95 FAT32L
 1: 00        0    0   0 -         0     0   0 [       0:        0 ] unused
 2: 00        0    0   0 -         0     0   0 [       0:        0 ] unused
 3: A6        0    0  65 -       321     0  30 [      64:        32066 ] OpenBSD
# disklabel vnd0
# /dev/rvnd0c:
type: vnd
disk: vnd device
label: fictitious
duid: 0000000000000000
flags:
bytes/sector: 512
sectors/track: 100
tracks/cylinder: 1
sectors/cylinder: 100
cylinders: 368
total sectors: 36864
boundstart: 64
boundend: 32130
drivedata: 0

16 partitions:
#         size        offset    fstype [fsize bsize  cpg]
  c:        36864             0    unused
  i:        25893          6237     MSDOS
# mount /dev/vnd0i /mnt
# ls /mnt
bsd.umg     uenv.tx  uenv.txt
# umount /mnt
# vnconfig -u vnd0
#
Reply With Quote
  #6   (View Single Post)  
Old 23rd July 2015
shep shep is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,049
Default

Code:
dd if=miniroot-cubie-57.fs of=/dev/rsd3c
Per the FAQ
you can speed up the write by
Quote:
bs=1m sets a block size of one megabyte (1024K), which typically greatly increases the creation speed. Size is not critical.
Code:
dd if=miniroot-cubie-57.fs of=/dev/rsd3c bs=1m
Reply With Quote
  #7   (View Single Post)  
Old 23rd July 2015
rarebird rarebird is offline
Port Guard
 
Join Date: Jun 2015
Posts: 15
Default

Thank you so much! I was not aware of vnd(4) and vnconfig(8) until your post and I always thought how cool it would be if I could easily inspect what was inside the .fs images. You learn while you live!

I have indeed bought a new SD card and voila:
Code:
# dd if=miniroot-cubie-57.fs of=/dev/rsd3c
36864+0 records in
36864+0 records out
18874368 bytes transferred in 122.610 secs (153938 bytes/sec)
Code:
# mount /dev/sd3i /mnt/flashdrive0
# ls /mnt/flashdrive0
total 7
-rwxr-xr-x  1 root  wheel   6.8M Mar 11 08:13 bsd.umg*
-rwxr-xr-x  1 root  wheel    19B Mar 11 08:13 uenv.tx*
-rwxr-xr-x  1 root  wheel    96B Mar 11 08:13 uenv.txt*
Now I'll try to boot my new toy and hope it all goes well.
Reply With Quote
  #8   (View Single Post)  
Old 23rd July 2015
rarebird rarebird is offline
Port Guard
 
Join Date: Jun 2015
Posts: 15
Default

Quote:
Originally Posted by shep View Post
Code:
dd if=miniroot-cubie-57.fs of=/dev/rsd3c
Per the FAQ
you can speed up the write by


Code:
dd if=miniroot-cubie-57.fs of=/dev/rsd3c bs=1m
It does speed things up a little.
Code:
# dd if=miniroot-cubie-57.fs of=/dev/rsd3c bs=1m 
18+0 records in
18+0 records out
18874368 bytes transferred in 4.625 secs (4080805 bytes/sec)
as opposed to:

Code:
# dd if=miniroot-cubie-57.fs of=/dev/rsd3c
36864+0 records in
36864+0 records out
18874368 bytes transferred in 122.610 secs (153938 bytes/sec)
Reply With Quote
  #9   (View Single Post)  
Old 27th July 2015
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: Bronvaux, France
Posts: 253
Default

So, did you succeed in booting the Cubieboard ?
__________________
The secret of wisdom is not wisdom itself, it's the road that leads us there.
Reply With Quote
Old 28th July 2015
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,101
Default

Quote:
Originally Posted by LeFrettchen View Post
So, did you succeed in booting the Cubieboard ?
+1
Reply With Quote
Old 4th August 2015
rarebird rarebird is offline
Port Guard
 
Join Date: Jun 2015
Posts: 15
Default

I tried one time and failed after which I went on vacation and didn't look further into it. I'll be trying again tomorrow morning and will post my progress here.
Reply With Quote
Old 5th August 2015
rarebird rarebird is offline
Port Guard
 
Join Date: Jun 2015
Posts: 15
Default

As promised, I tried booting the snapshot version of OpenBSD on Cubieboard 2 and failed again.

After writing the miniroot-cubie-58.fs filesystem to an SD card I plug it into the board, start it up and the following message repeats itself over and over on a serial port:
Code:
U-Boot SPL 2015.07 (Jul 23 2015 - 19:37:50)
DRAM:Timeout initialising DRAM

resetting ...

U-Boot SPL 2015.07 (Jul 23 2015 - 19:37:50)
DRAM:Timeout initialising DRAM

resetting ...

.
.
.
I search for this error message and find a suggestion that powering the board via USB may provide too weak power so some devices can't run correctly. It is suggested to use the external power supply, I don't have one but I did extend my USB cable which may cause some problems.
After removing the extra cable the above problem goes away but still OpenBSD does not boot:

Code:
HELLO! BOOT0 is starting!
boot0 version : 3.0.0
dram size =1024
sum=0x01be1e3a
src_sum=0x01be1e3a
Ready to disable icache.
Jump to secend Boot.
[      0.134]

U-Boot 2011.09-rc1-00003-ge89ab14-dirty (Jan 03 2014 - 12:57:33) Allwinner Technology 

[      0.143]version: 1.1.0
[      0.146]pmbus:   ready
[      0.251]PMU: AXP209
[      0.255]PMU: AXP20x found
[      0.257]PMU: bat ratio = 100
[      0.261]after set, dcdc2 =1400mv
[      0.264]PMU: dcdc2 1400
[      0.267]PMU: pll1 912 Mhz
boot_clock = 912
dcdc2_vol = 1400
[      0.275]after set, dcdc2 =1400mv
dcdc3_vol = 1250
ldo2_vol = 3000
ldo3_vol = 2800
ldo4_vol = 2800
power_start = 0
storage_type = -1
usb_recovery = 1
find power_sply to end
fel key old mode
run key detect
no key found
no key input
dram_para_set start
dram_para_set end
[      0.311]DRAM:  1 GiB
relocation Offset is: 35b23000
donn't initialize ther user_gpio (main_key:boot_init_gpio)
DRV_DISP_Init: opened
[      0.525]boot_disp.output_type=4
[      0.529]boot_disp.output_mode=4
[      0.532]boot_disp.auto_hpd=1
workmode = 0
[      1.836]NAND: NAND_UbootInit
NB1 : enter NAND_LogicInit
nand : get id_number_ctl from script, 3
not burn nand partition table!
NB1 : nand_info_init fail
[      5.450]nand init fail
set to recovery
try sprite_led_gpio config
sprite_led_gpio start
sunxi sprite begin
screen_width = 800
screen_height = 480
bar x1: 200 y1: 200
bar x2: 600 y2: 280
read mbr failed
sprite update error: no data part found
read mbr failed
sprite update error: read image start error
sprite update error: current card sprite failed
now hold the machine
fail to find part named env
Using default environment

In:    serial
Out:   serial
Err:   serial
--------fastboot partitions--------
mbr not exist
base bootcmd=run setargs_nand boot_normal
bootcmd set setargs_nand
key 0
recovery key high 6, low 4
cant find fstbt value
no misc partition is found
to be run cmd=run setargs_nand boot_normal
the part isn't exist
WORK_MODE_BOOT
WORK_MODE_BOOT
[      5.544]Hit any key to stop autoboot:  0 
cant find part named boot
sunxi_flash - sunxi_flash sub-system

Usage:
sunxi_flash read command parmeters : 
parmeters 0 : addr to load(hex only)
parmeters 1 : the name of the part to be load
[parmeters 2] : the number of bytes to be load(hex only)
if [parmeters 2] not exist, the number of bytes to be load is the size of the part indecated on partemeter 1
boota: bad boot image magic, maybe not a boot.img?
sunxi#
I don't know what to make of this. It seems to me that the image on SD card is bad.

INSTALL.armv7 document says that miniroot-cubie-58.fs filesystem is for Cubieboard 1 while I have Cubieboard 2 so I suspect that I am using the wrong image. But where/how do I obtain Cubieboard 2 miniroot filesystem?

armv7 page says that Cubieboard 2 is supported. I remember reading that the only difference between Cubie 1 and 2 is the CPU, i.e. A10 to A20 and the two are highly compatible so I guessed that Cubieboard 1 image should work.

I appreciate any suggestions and pointers.
Reply With Quote
Old 5th August 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,935
Default

Quote:
Originally Posted by rarebird View Post
...any suggestions and pointers.
The developers and users who follow the arm@ mailing list may have some.
Reply With Quote
Old 5th August 2015
rarebird rarebird is offline
Port Guard
 
Join Date: Jun 2015
Posts: 15
Default

I have been playing around all day trying to boot OpenBSD from SD card but have had no success at all. I tried using several different versions of u-boot and it made no difference.
Eventually I decided to try booting it from the network so I grabbed the latest u-boot and put it on the SD card, set up DHCP and TFTP servers but my hopes were crushed immediately because it seems that some u-boot commands crash the board, i.e. the board restarts.

For example:
Code:
sun7i# setenv serverip 192.168.1.7
undefined instruction
pc : [<ffff0024>]          lr : [<4a011a30>]
sp : 7fb65be0  ip : 00000000     fp : 7fb66648
r10: 0000000c  r9 : 7fb65f0c     r8 : 00000004
r7 : 00000003  r6 : 00000000     r5 : 7fb66610  r4 : 00000019
r3 : e3a00001  r2 : 00000001     r1 : 00000020  r0 : 00000000
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

U-Boot SPL 2014.04-10733-gea1ac32 (Feb 22 2015 - 16:48:01)
Board: Cubieboard2
DRAM: 1024 MiB
CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
spl: not an uImage at 1600


U-Boot 2014.04-10733-gea1ac32 (Feb 22 2015 - 16:48:01) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Board: Cubieboard2
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dwmac.1c50000
Hit any key to stop autoboot:  0 
sun7i#
Same happens for some other commands and I am completely oblivious as to why this happens.
Reply With Quote
Old 16th August 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,935
Default

Just for fun, I have installed OpenBSD/armv7 in a Qemu virtual machine. The only ARM hardware I have are smartphones that can't run OpenBSD, so this will give me some familiarity with it.

A few months ago, there was a long thread in the arm@ mailing list regarding port building under Qemu being faster than on actual hardware. (While that might be true, the developers would prefer to find and debug problems on the real hardware.) The thread ended with snapshots containing kernels for virtual hardware: the ARM Versatile Express for Cortex-A15 emulation (qemu-system-arm -M vexpress-a15).

It's a long thread. A working qemu-system-arm example is shown near the end. I used it to install from bsd.rd.VEXPRESS15.umg: http://marc.info/?t=143223172200002&r=1&w=2

Now that I have it up and running, I can see that it installed two MBR partitions -- a FAT partition and an OpenBSD MBR partition. The FAT partition, if I mount it, contains two files: the u-boot kernel images, bsd.umg and bsdrd.umg. The kernels themselves (without the u-boot wrappers) are also stored in the "a" disklabel partition.

Last edited by jggimi; 16th August 2015 at 02:29 AM. Reason: clarity
Reply With Quote
Old 16th August 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,935
Default

I've built one port, shells/tcsh. The ports tree was NFS mounted (from the host amd64 system), with local disk for /usr/ports/pobj. Elapsed time was 78 times longer than a native build of the same port on the host.
Code:
native amd64: 10.880u 5.320s 0:16.10 100.6% 0+0k 953+1996io 2153pf+0w
emulated armv7: 896.940u 287.380s 20:51.95 94.5% 0+0k 1575+8206io 2169pf+0w

1. u = time spent in user mode, in seconds
2. s = time spent in kernel mode, in seconds
3. nn:nn.nn = elapsed time in minutes:seconds.hundreths
4. cpu percentage (u+s/elapsed)
5. k = average shared text space+unshared data/stack space
6. io = number of input+output operations
7. pf+w = major page faults+context switches
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
Video card instead of sound card ripe OpenBSD General 12 2nd May 2013 04:02 PM
wd0a: device timeout writing fsbn ... of .....-....... daemonfowl OpenBSD Installation and Upgrading 8 7th April 2012 09:50 PM
Writing a guitar tuner/metronome claytonl OpenBSD Packages and Ports 4 21st August 2011 11:29 PM
c++: writing to the *this pointer? robbak Programming 2 23rd October 2009 06:12 PM
Writing Papers in FreeBSD kagayaki General software and network 4 14th July 2008 11:31 PM


All times are GMT. The time now is 08:07 AM.


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