View previous topic :: View next topic |
Author |
Message |
DeIM Guru
Joined: 11 Apr 2006 Posts: 442
|
Posted: Sat Feb 18, 2017 7:19 pm Post subject: Banana Pi M2-Ultra with Gentoo - u-boot misunderstood |
|
|
Hi, I've managed to run Gentoo on mentioned SBC.
I'm following this document:
https://drive.google.com/file/d/0B_YnvHgh2rwjenBWVE1fTDVFVjg/view
With many inspiration from here:
https://wiki.gentoo.org/wiki/Banana_Pi_the_Gentoo_Way
My steps so far:
1) toolchain
Code: | 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: | $ mkdir bananapiM2U
cd bananapiM2U/
mkdir tools
cd tools/
git clone https://github.com/BPI-SINOVOIP/bpi-tools.git
sudo cp bpi-* /usr/bin/ |
Code: | git clone https://github.com/BPI-SINOVOIP/BPI-M2U-bsp.git
cd BPI-M2U-bsp/ |
3) upgrade bpi-tools
4) build all
Code: | ./configure BPI_M2U_1080P
nano -w Makefile
CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi-
./build.sh
1 |
5) prepare SD card
Code: | 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: | sudo bpi-bootsel BPI_M2U_1080P.img.gz /dev/sdx |
output:
Code: | 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 |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54578 Location: 56N 3W
|
Posted: Sat Feb 18, 2017 8:48 pm Post subject: |
|
|
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: | 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. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Sat Feb 18, 2017 10:53 pm Post subject: |
|
|
Quote: | 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! |
|
Back to top |
|
|
erm67 l33t
Joined: 01 Nov 2005 Posts: 653 Location: EU
|
Posted: Sun Feb 19, 2017 7:51 am Post subject: |
|
|
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 |
|
Back to top |
|
|
DeIM Guru
Joined: 11 Apr 2006 Posts: 442
|
Posted: Sun Feb 19, 2017 11:07 am Post subject: |
|
|
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: | 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-files/blob/master/SD/100MB/BPI_M2U_1080P.img.gz |
|
Back to top |
|
|
DeIM Guru
Joined: 11 Apr 2006 Posts: 442
|
Posted: Sun Feb 19, 2017 5:27 pm Post subject: |
|
|
It seems to be my fault
First partition didn't start at 204800 which is the end of first 100MB for uboot.
Thank everyone who replied. |
|
Back to top |
|
|
DeIM Guru
Joined: 11 Apr 2006 Posts: 442
|
Posted: Sun Feb 19, 2017 6:45 pm Post subject: |
|
|
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
Looking forward to test SATA and SD speeds... |
|
Back to top |
|
|
erm67 l33t
Joined: 01 Nov 2005 Posts: 653 Location: EU
|
Posted: Sun Feb 19, 2017 7:09 pm Post subject: |
|
|
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: | #!/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 |
|
Back to top |
|
|
DeIM Guru
Joined: 11 Apr 2006 Posts: 442
|
Posted: Mon Feb 20, 2017 7:49 pm Post subject: |
|
|
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? |
|
Back to top |
|
|
R0b0t1 Apprentice
Joined: 05 Jun 2008 Posts: 264
|
Posted: Mon Feb 20, 2017 8:54 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54578 Location: 56N 3W
|
Posted: Mon Feb 20, 2017 9:01 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
DeIM Guru
Joined: 11 Apr 2006 Posts: 442
|
Posted: Sun Oct 08, 2017 9:50 am Post subject: |
|
|
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: | 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: | # 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: | # 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: | # 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: | # 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: | # cat /sys/block/sda/queue/scheduler
noop deadline [cfq]
# cat /sys/block/sdb/queue/scheduler
noop deadline [cfq] |
|
|
Back to top |
|
|
|