Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on ARM
  • Search

Banana Pi M2-Ultra with Gentoo - u-boot misunderstood

Gentoo on all things ARM. Both 32 bit and 64 bit.
Tell about your hardware and CHOST.
Problems with crossdev targeting ARM hardware go here too.
Post Reply
  • Print view
Advanced search
12 posts • Page 1 of 1
Author
Message
DeIM
Guru
Guru
User avatar
Posts: 465
Joined: Tue Apr 11, 2006 7:03 pm

Banana Pi M2-Ultra with Gentoo - u-boot misunderstood

  • Quote

Post by DeIM » Sat Feb 18, 2017 7:19 pm

Hi, I've managed to run Gentoo on mentioned SBC.

I'm following this document:
https://drive.google.com/file/d/0B_YnvH ... VFVjg/view
With many inspiration from here:
https://wiki.gentoo.org/wiki/Banana_Pi_the_Gentoo_Way

My steps so far:
1) toolchain

Code: Select all

crossdev -S -P -v EXTRA_ECONF="-march=armv7-a -mfpu=neon-vfpv4 -ffast-math" -t armv7a-hardfloat-linux-gnueabi
emerge -av u-boot-tools
2) bpi-tools + kernel

Code: Select all

$ mkdir bananapiM2U
cd bananapiM2U/
mkdir tools
cd tools/
git clone https://github.com/BPI-SINOVOIP/bpi-tools.git
sudo cp bpi-* /usr/bin/

Code: Select all

git clone https://github.com/BPI-SINOVOIP/BPI-M2U-bsp.git
cd BPI-M2U-bsp/
3) upgrade bpi-tools

4) build all

Code: Select all

./configure BPI_M2U_1080P
nano -w Makefile
CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi-
./build.sh
1
5) prepare SD card

Code: Select all

fdisk /dev/sdx
-150MB FAT32
-rest Linux
sudo mkfs.vfat -n BPI-BOOT -F 32 /dev/sdx1
sudo mkfs.ext4 -L BPI-ROOT /dev/sdx2
6)

Code: Select all

sudo bpi-bootsel BPI_M2U_1080P.img.gz /dev/sdx
output:

Code: Select all

Warning: Try to write  to BOOTDISK /dev/sdx
umount device: /dev/sdx

##########################
# Burning the bootloader #
##########################

sudo gunzip -c BPI_M2U_1080P.img.gz | dd of=/dev/sdx bs=1024 seek=8
102392+0 records read
102392+0 records wrote
104849408 bytes (105 MB, 100 MiB) copy, 28,2654 s, 3,7 MB/s
OK!! You can remove the BOOTDISK /dev/sdx now!!
And there is the misunderstood - When I remove SD card and push it back I can't mount sdx1 - there is no filesystem.
Am I doing something wrong? Could someone show me the right way?

Thanks in advance
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56080
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Feb 18, 2017 8:48 pm

DeIM,

As it stands, thats horribly hackish and I can see why it may not work.

You use fdisk to make partitions and filesystems on the partitions.
Then you dd something into the boot partition by skipping the first 8k of whatever is there.

Code: Select all

sudo gunzip -c BPI_M2U_1080P.img.gz | dd of=/dev/sdx bs=1024 seek=8 
That 8k shouid contain your partition table (it does, you made it) but if your partition table and the one in the image need not be aligned, you won't be able to find the tilesystem to mount.

Decompress BPI_M2U_1080P.img.gz then loop mount the resulting file. Th should be a filesystem in a file.
Copy the entire content to the mounted /dev/sdx1 (SDCard partiton 1.)
Now the partition table alignments don't matter as you are working with files, not raw disk blocks.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
Roman_Gruber
Advocate
Advocate
Posts: 3854
Joined: Tue Oct 03, 2006 8:43 am
Location: Austro Bavaria

  • Quote

Post by Roman_Gruber » Sat Feb 18, 2017 10:53 pm

This will clear all the data in the first part of the sdcard to ensure no old data causes any problems.
root #dd if=/dev/zero of=/dev/sdX bs=1k count=1023 seek=1
A perfect example why a wiki needs QA. And this guy really did not understand how it works.

Not needed in the first place regardless what is done later.

When you "initalize" "correctly" a "block device" there should be no need for that!
Top
erm67
l33t
l33t
User avatar
Posts: 653
Joined: Tue Nov 01, 2005 5:31 pm
Location: EU
Contact:
Contact erm67
Website

  • Quote

Post by erm67 » Sun Feb 19, 2017 7:51 am

Nice board, even if it is not really related to the original bananaPI .....

Did you tested the SATA port? Apparently is speed limited ....

Also automatic irqbalancing is not working also on allwinner SoC, but you can manually assign IRQs to different CPUs, it makes a difference...
Ok boomer
True ignorance is not the absence of knowledge, but the refusal to acquire it.
Ab esse ad posse valet, a posse ad esse non valet consequentia

My fediverse account: @erm67@erm67.dynu.net
Top
DeIM
Guru
Guru
User avatar
Posts: 465
Joined: Tue Apr 11, 2006 7:03 pm

  • Quote

Post by DeIM » Sun Feb 19, 2017 11:07 am

NeddySeagoon wrote:Decompress BPI_M2U_1080P.img.gz then loop mount the resulting file. Th should be a filesystem in a file.
Copy the entire content to the mounted /dev/sdx1 (SDCard partiton 1.)
Now the partition table alignments don't matter as you are working with files, not raw disk blocks.
There may be the source of problem:

Code: Select all

file *.img
BPI_M2U_1080P.img: data

sudo fdisk -l *.img
Disk BPI_M2U_1080P.img: 100 MiB, 104849408 bytes, 204784 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

sudo mount -o ro,loop BPI_M2U_1080P.img /mnt/dvd/
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
This output is the same for built image and for official from github:
https://github.com/BPI-SINOVOIP/BPI-fil ... 80P.img.gz
Top
DeIM
Guru
Guru
User avatar
Posts: 465
Joined: Tue Apr 11, 2006 7:03 pm

  • Quote

Post by DeIM » Sun Feb 19, 2017 5:27 pm

It seems to be my fault :oops:
First partition didn't start at 204800 which is the end of first 100MB for uboot.

Thank everyone who replied.
Top
DeIM
Guru
Guru
User avatar
Posts: 465
Joined: Tue Apr 11, 2006 7:03 pm

  • Quote

Post by DeIM » Sun Feb 19, 2017 6:45 pm

OK, it's booting now.
There is dmesg from first boot:
http://pastebin.com/pQzai9sd

This is my first BPI, so anybody with tips is welcome :D
Looking forward to test SATA and SD speeds...
Top
erm67
l33t
l33t
User avatar
Posts: 653
Joined: Tue Nov 01, 2005 5:31 pm
Location: EU
Contact:
Contact erm67
Website

  • Quote

Post by erm67 » Sun Feb 19, 2017 7:09 pm

I am curious about performance, you know for my next board ......

According to sunxi wiki read speed of the A40 should be capped at ~200 MB/s and write speed ~45MB/s, irqbalancing helps to squeeze a few of MB/s more

I use this script, adapt it to your /proc/interrupts, the sata driver on your board should be called ahci

Code: Select all

#!/bin/sh
for i in $(gawk -F":" '/emmc/ {print $1}' </proc/interrupts); do echo 2 >/proc/irq/$i/smp_affinity; done
for i in $(gawk -F":" '/dwc_otg/ {print $1}' </proc/interrupts); do echo 4 >/proc/irq/$i/smp_affinity; done
for i in $(gawk -F":" '/eth0/ {print $1}' </proc/interrupts); do echo 8 >/proc/irq/$i/smp_affinity; done
Ok boomer
True ignorance is not the absence of knowledge, but the refusal to acquire it.
Ab esse ad posse valet, a posse ad esse non valet consequentia

My fediverse account: @erm67@erm67.dynu.net
Top
DeIM
Guru
Guru
User avatar
Posts: 465
Joined: Tue Apr 11, 2006 7:03 pm

  • Quote

Post by DeIM » Mon Feb 20, 2017 7:49 pm

Is it possible to have F2FS on SD as rootfs? I didn't find much information about it only that u-boot doesn't support it, but if I have built it in kernel?
Top
R0b0t1
Apprentice
Apprentice
Posts: 264
Joined: Thu Jun 05, 2008 9:26 pm

  • Quote

Post by R0b0t1 » Mon Feb 20, 2017 8:54 pm

Yes. U-boot likely doesn't support loading a kernel from F2FS, you could chain a kernel which has F2FS from a VFAT or ext2/4 /boot.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56080
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Mon Feb 20, 2017 9:01 pm

Something needs to load U-Boot too.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
DeIM
Guru
Guru
User avatar
Posts: 465
Joined: Tue Apr 11, 2006 7:03 pm

  • Quote

Post by DeIM » Sun Oct 08, 2017 9:50 am

Hi, I'm back with this device. I need to get it as stable as possible - problem seems to be with USB.

Significant problem is, when I connect two USB disks to powered hub - it very soon makes error, disconnects and it's far from stability.
I thaught it's problem of specific drive so I leave one that seem stable on powered hub and it seemd to run well, but it makes errors also but with lower interval.
When I connect cable from USB hub (same power, same disks) to computer, disks works well.

Is there a way how to determine the source of problems? I have tried different cables also. Problems seem with BPI only.

typical kernel messages:

Code: Select all

Oct  7 12:06:00 bpi1 kernel: hub 1-1:1.0: cannot reset port 4 (err = -110)
Oct  7 12:06:05 bpi1 kernel: hub 1-1:1.0: Cannot enable port 4.  Maybe the USB cable is bad?
Oct  7 12:06:06 bpi1 kernel: hub 1-1:1.0: cannot disable port 4 (err = -110)
Oct  7 12:06:25 bpi1 kernel: sd 1:0:0:0: Device offlined - not ready after error recovery
Oct  7 12:06:25 bpi1 kernel: sd 1:0:0:0: [sdb] Unhandled error code
Oct  7 12:06:25 bpi1 kernel: sd 1:0:0:0: [sdb]  
Oct  7 12:06:25 bpi1 kernel: Result: hostbyte=0x05 driverbyte=0x00
Oct  7 12:06:25 bpi1 kernel: sd 1:0:0:0: [sdb] CDB: 
Oct  7 12:06:25 bpi1 kernel: cdb[0]=0x2a: 2a 00 29 fb fc 80 00 00 f0 00
Oct  7 12:06:25 bpi1 kernel: end_request: I/O error, dev sdb, sector 704380032
Oct  7 12:06:25 bpi1 kernel: Buffer I/O error on device sdb1, logical block 88047248
Oct  7 12:06:25 bpi1 kernel: EXT4-fs warning (device sdb1): ext4_end_bio:286: I/O error writing to inode 91228057 (offset 359202816 size 126976 starting block 88047534)
Oct  7 12:06:25 bpi1 kernel: sd 1:0:0:0: rejecting I/O to offline device
Oct  7 12:06:25 bpi1 kernel: sd 1:0:0:0: [sdb] killing request

Code: Select all

# uname -a
Linux bpi1 3.10.107-BPI-M2U-Kernel #1 SMP Sun Sep 3 21:51:03 CEST 2017 armv7l ARMv7 Processor rev 5 (v7l) sun8iw11p1 GNU/Linux
hdparm:
sda is old 64GiB SATA disk kingston in SATA port
sdb is USB - powered-hub - USB3 ADATA 1TB disk

Code: Select all

# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   574 MB in  2.00 seconds = 286.76 MB/sec
 Timing buffered disk reads: 242 MB in  3.02 seconds =  80.13 MB/sec

# hdparm -tT /dev/sdb

/dev/sdb:
 Timing cached reads:   554 MB in  2.00 seconds = 276.72 MB/sec
 Timing buffered disk reads:  82 MB in  3.03 seconds =  27.09 MB/sec

Code: Select all

# cat /etc/local.d/irq_balance.start 
#!/bin/sh
for i in $(awk -F":" '/ahci/ {print $1}' < /proc/interrupts); do echo 2 > /proc/irq/$i/smp_affinity; done
for i in $(awk -F":" '/ehci/ {print $1}' < /proc/interrupts); do echo 4 > /proc/irq/$i/smp_affinity; done
for i in $(awk -F":" '/gmac/ {print $1}' < /proc/interrupts); do echo 8 > /proc/irq/$i/smp_affinity; done
echo "IRQ SATA Balanced"

Code: Select all

# cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
 29:     808092     229030     191923     525777       GIC  arch_timer
 30:          0          0          0          0       GIC  arch_timer
 32:          0          0          0          0       GIC  axp22_irq_chip
 33:        283          0          0          0       GIC  uart0
 37:          0          0          0          0       GIC  RemoteIR_RX
 39:       6418          0          0          0       GIC  twi0
 40:          0          0          0          0       GIC  twi1
 41:          0          0          0          0       GIC  twi2
 42:          0          0          0          0       GIC  spi0
 54:    1573684          0          0          0       GIC  sunxi_timer
 56:          0          0          0          0       GIC  rtc
 59:          0          0          0          0       GIC  1c02000.dma-controller
 60:          1          0          0          0       GIC  PIN_GRP
 63:          0          0          0          0       GIC  sunxikbd
 64:      66681          0          0          0       GIC  sunxi-mmc
 65:         25          0          0          0       GIC  sunxi-mmc
 66:        454          0          0          0       GIC  sunxi-mmc
 74:          0          0          0          0       GIC  csi0
 83:    3765639          0          0          0       GIC  dispaly
 85:          0          0          0          0       GIC  cedar_dev
 88:       2210       1977          0          0       GIC  sunxi-ahci
 96:          0          0          0          0       GIC  ohci_hcd:usb3
 97:          0          0          0          0       GIC  ohci_hcd:usb4
 98:          0          0          0          0       GIC  mdfs
108:      28220          0     755028          0       GIC  ehci_hcd:usb1
110:          0          0          0          0       GIC  ehci_hcd:usb2
117:        277          0          0    6520688       GIC  gmac0
121:          6          0          0          0       GIC  twi4
174:          1          0          0          0         -  jack-det
IPI0:          0          0          0          0  CPU wakeup interrupts
IPI1:          0     697484     201634     189187  Timer broadcast interrupts
IPI2:     263439     167860     140500     287001  Rescheduling interrupts
IPI3:        222        223        103        181  Function call interrupts
IPI4:          3          5          2          0  Single function call interrupts
IPI5:          0          0          0          0  CPU stop interrupts
IPI6:          0          0          0          0  completion interrupts
IPI7:          0          0          0          0  CPU backtrace
Err:          0

Code: Select all

# cat /sys/block/sda/queue/scheduler 
noop deadline [cfq] 
# cat /sys/block/sdb/queue/scheduler 
noop deadline [cfq]
Top
Post Reply
  • Print view

12 posts • Page 1 of 1

Return to “Gentoo on ARM”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic