chradev Posted April 16, 2016 Author Share Posted April 16, 2016 I will test them a.s.a.p. Link to comment Share on other sites More sharing options...
chradev Posted April 16, 2016 Author Share Posted April 16, 2016 Hi to All, I try to make eMMC bootable incl. rootfs but encounter following problems. In case of preparing the device with command: dd if=Armbian_5.07_Lime2_Debian_jessie_4.4.6.raw of=/dev/mmcblk1 It boots successfully from eMMC. U-Boot and Kernel register eMMC as mmcblk0. There are following messages related to mmc: [ 3.521635] sunxi-mmc 1c0f000.mmc: No vqmmc regulator found [ 3.522515] sunxi-mmc 1c0f000.mmc: Got CD GPIO [ 3.562879] sunxi-mmc 1c0f000.mmc: base:0xf0d74000 irq:26 [ 3.563345] sunxi-mmc 1c11000.mmc: No vqmmc regulator found [ 3.602667] sunxi-mmc 1c11000.mmc: base:0xf0d78000 irq:27 [ 3.608676] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 8, RTO !! [ 3.612909] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.613804] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.614683] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.615566] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.646545] mmc1: MAN_BKOPS_EN bit is not set [ 3.653022] mmc1: new high speed MMC card at address 0001 [ 3.653914] mmcblk0: mmc1:0001 P1XXXX 3.60 GiB [ 3.654397] mmcblk0boot0: mmc1:0001 P1XXXX partition 1 16.0 MiB [ 3.654803] mmcblk0boot1: mmc1:0001 P1XXXX partition 2 16.0 MiB [ 3.656023] mmcblk0: p1 [ 4.049583] EXT4-fs (mmcblk0p1): mounted filesystem with writeback data mode. Opts: (null) [ 11.773025] EXT4-fs (mmcblk0p1): re-mounted. Opts: data=writeback,commit=600,errors=remount-ro Unfortunately, rootfs stays not resized: root@lime2:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 1141308 948920 116296 90% / and cannot be resized: root@lime2:~# resize2fs /dev/mmcblk0p1 resize2fs 1.42.12 (29-Aug-2014) The filesystem is already 298551 (4k) blocks long. Nothing to do! If eMMC is prepared in alternative way: fdisk /dev/mmcblk1 -> n, p, 1, default, default, w mkfs.ext4 -j /dev/mmcblk1p1 mount /dev/mmcblk1p1 /mnt tar -zxvf armbian-from-sdcard.tar.gz -C /mnt sync umount /mnt dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk1 bs=1024 seek=8 After booting the rootfs is read only and there are following messages: [ 3.507990] sunxi-mmc 1c0f000.mmc: No vqmmc regulator found [ 3.508740] sunxi-mmc 1c0f000.mmc: Got CD GPIO [ 3.541456] sunxi-mmc 1c0f000.mmc: base:0xf0d74000 irq:26 [ 3.541890] sunxi-mmc 1c11000.mmc: No vqmmc regulator found [ 3.581217] sunxi-mmc 1c11000.mmc: base:0xf0d78000 irq:27 [ 3.587225] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 8, RTO !! [ 3.591528] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.592397] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.593263] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.594122] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !! [ 3.625081] mmc1: MAN_BKOPS_EN bit is not set [ 3.631553] mmc1: new high speed MMC card at address 0001 [ 3.632423] mmcblk0: mmc1:0001 P1XXXX 3.60 GiB [ 3.632813] mmcblk0boot0: mmc1:0001 P1XXXX partition 1 16.0 MiB [ 3.633237] mmcblk0boot1: mmc1:0001 P1XXXX partition 2 16.0 MiB [ 3.634477] mmcblk0: p1 ... [ 4.028069] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null) [ 4.028143] VFS: Mounted root (ext4 filesystem) readonly on device 179:1. ... [ 6.126078] EXT4-fs (mmcblk0p1): Cannot change data mode on remount [ 6.997802] systemd-journald[149]: Received request to flush runtime journal from PID 1 Where the problems could be? Best regards Chris Link to comment Share on other sites More sharing options...
Igor Posted April 16, 2016 Share Posted April 16, 2016 Did you have a problem with self built image, made after this commit? https://github.com/igorpecovnik/lib/commit/7b99cdca18aabf4cca32446b9c168788c36e3097 If you use older, than I know why root was not resized. For second, check /etc/fstab Link to comment Share on other sites More sharing options...
chradev Posted April 16, 2016 Author Share Posted April 16, 2016 Thanks Igor, Yes, I have used the older (from a few days ago) own build and after rebuilding it the problem with resize at firstrun on eMMC is solved. Unfortunately, about second one /etc/fstab files are the same: root@lime2:~# cat /mnt/etc/fstab # UNCONFIGURED FSTAB FOR BASE SYSTEM tmpfs /tmp tmpfs nodev,nosuid,size=256M 0 0 /dev/mmcblk0p1 / ext4 defaults,noatime,nodiratime,data=writeback,commit=600,errors=remount-ro 0 0 /var/swap none swap sw 0 0 root@lime2:~# cat /etc/fstab # UNCONFIGURED FSTAB FOR BASE SYSTEM tmpfs /tmp tmpfs nodev,nosuid,size=256M 0 0 /dev/mmcblk0p1 / ext4 defaults,noatime,nodiratime,data=writeback,commit=600,errors=remount-ro 0 0 /var/swap none swap sw 0 0 but anyway it is not so important in case of having even faster way to write the image on eMMC. BTW: I see that Armbian is migrated to kernel 4.5.1 (the build pass fine for me). But what about the problem with the latest mainline U-Boot? I still use older one v.2015.10. Best regards Chris Link to comment Share on other sites More sharing options...
chradev Posted April 16, 2016 Author Share Posted April 16, 2016 Hi to All, Following the need to install and customize too many times RPI Monitor (for Lime2) I find useful to gzip in a single file all the staff have to be added or modified (in case of mainline kernel usage) afterwards. Reading all discussions, advises and own experience I succeed to reduce the procedure to a file and 5 easy steps: root@lime2:~# armbianmonitor -r // Check if RPI Monitor is working on: http://lime2-ip-address:8888/ root@lime2:~# tar -zxvf /path-to-archive/armbianmonitor.tar.gz -C / root@lime2:~# service rpimonitor restart // Check if RPI Monitor is customized on: http://lime2-ip-address:8888/ Find attached armbianmonitor.tar.gz file including a couple of goodies as well. On the other hand it is a time to offer RPI Monitor itself to be added to the main Armbian distribution because of: it is quite useful for almost all users its adding to the customization script is quite tricky to be leaved to the users its customization is board dependent and could be leaved to the users because the support is not finished yet Best regardsChris armbianmonitor.tar.gz 1 Link to comment Share on other sites More sharing options...
chradev Posted April 17, 2016 Author Share Posted April 17, 2016 Hi to All, I need the messages to be printed on a serial console while booting vanilla kernel (4.5.1) in Armbian (5.07) so I change in boot.cmd: setenv bootargs "console=tty1 ... to setenv bootargs "console=/dev/ttyS0,115200 ... Unfortunately, no boot messages on serial console afterwards. I have read in the forums a few posts with the same problem but without solution. Can somebody help me to solve the problem? Best regards Chris Link to comment Share on other sites More sharing options...
tkaiser Posted April 17, 2016 Share Posted April 17, 2016 setenv bootargs "console=/dev/ttyS0,115200 ... Unfortunately, no boot messages on serial console afterwards. Hmm... what about following the documentation: https://github.com/igorpecovnik/lib/blob/master/documentation/user-faq.md#how-to-troubleshoot Or in other words: Why do you feel the need to add '/dev/' here to kernel's cmdline? Link to comment Share on other sites More sharing options...
chradev Posted April 17, 2016 Author Share Posted April 17, 2016 Hi Igor, Did you have a problem with self built image, made after this commit? https://github.com/igorpecovnik/lib/commit/7b99cdca18aabf4cca32446b9c168788c36e3097 See https://github.com/igorpecovnik/lib/issues/258 Link to comment Share on other sites More sharing options...
chradev Posted April 17, 2016 Author Share Posted April 17, 2016 Hi tkaiser, Hmm... what about following the documentation: https://github.com/igorpecovnik/lib/blob/master/documentation/user-faq.md#how-to-troubleshoot Or in other words: Why do you feel the need to add '/dev/' here to kernel's cmdline? I have tested both with and without '/dev'. With '/dev' is simple last one I tested and put in the post. I have also look on kernel configuration but did not see something wrong. I have also search on the forum and see other guy having the same problem (without '/dev'). Even make last minute test as per pointed documentation: setenv bootargs "init=/bin/bash root=/dev/mmcblk0p1 rootwait console=ttyS0,115200 ... but get an error in the very beginning: Uncompressing Linux... done, booting the kernel. /bin/bash: sunxi_no_mali_mem_reserve: No such file or directory [ 4.311114] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 and the board reboots after printing the stack. And finally successed after removing 'init=/bin/bash' but leaving the order: setenv bootargs "root=/dev/mmcblk0p1 rootwait console=ttyS0,115200 ... Next change again the order as tested before: setenv bootargs "console=ttyS0,115200 root=/dev/mmcblk0p1 rootwait ... and for my surprise it works again! Probably there was something wrong when tested it before. Thanks traiser for the help and sorry for the "noise". Best regards Chris Link to comment Share on other sites More sharing options...
tkaiser Posted April 18, 2016 Share Posted April 18, 2016 Thanks traiser for the help and sorry for the "noise". You're welcome. BTW: I also find it sometimes a bit anoying to edit boot.cmd and call mkimage just to switch between display and serial console for verbose output. I think we should try to address that in a future version of Armbian in a more user friendly way (maybe further misusing the armbianmonitor script). And I would also believe we should overthink our u-boot handling. There was an interesting discussion about board vs. distro specific stuff and how to handle that from within u-boot last week in linux-sunxi chat: http://irclog.whitequark.org/linux-sunxi/2016-04-13#16132252; Link to comment Share on other sites More sharing options...
chradev Posted April 18, 2016 Author Share Posted April 18, 2016 Hi tkaise, I will read pointed chat in a while. You're welcome. BTW: I also find it sometimes a bit anoying to edit boot.cmd and call mkimage just to switch between display and serial console for verbose output. I think we should try to address that in a future version of Armbian in a more user friendly way (maybe further misusing the armbianmonitor script). And I would also believe we should overthink our u-boot handling. There was an interesting discussion about board vs. distro specific stuff and how to handle that from within u-boot last week in linux-sunxi chat: http://irclog.whitequark.org/linux-sunxi/2016-04-13#16132252; Definitely, especially after my "dark" night tonight. After happiness of last problem solution and almost reached my dreamed staff I "succeeded" to "brick" my board. The "two SD/MMC cards problem" has suddenly overtaken me. May be it is phenomenon like "console messages" just "solved". After a day with no problem booting from eMMC (without SD card inserted) and from SD/MMC if present in some reason the kernel decided to change its behavior. While U-Boot swaps SD/MMC enumeration depending of SD card presence and sending always 'root=/dev/mmcblk0p1' in command line to the kernel it begin enumerating eMMC as mmcblk0 only. It makes impossible to boot from SD card and my "fast" try was to "clean" eMMC from u-boot but the kernel continue to try to boot from eMMC and get "panic-ed". Unfortunately, the chosen by me way was also "dirty" and my board become "bricked". Probably for "un-bricking" I have to build image with 'root=/dev/mmcblk1p1' in command line to the kernel but answering the question "why" has to be answered first. Any ideas? About "overthink our u-boot handling" my opinion is that boot behavior has to be deterministic instead of "smart". One of the goals in my customization is to have "read only" and "never changing" staff on eMMC and SD, USB or SSD R/W one that can be updated. At user action (button pressed while resetting or powering on the board) the boot from eMMC will give an option to restore functionality to "factory defaults". That is why I cannot understand the reasons of swapping SD/MMC devises in U-Boot instead of deterministic way to boot using priorities. In my opinion it is better to boot from eMMC in lack of other boot-able device and from SD card, USB or SATA if present. U-Boot will be loaded by BROM using his priority which will try boot in fixed order described in its boot script. Booting from eMMC if user button is pressed will be used if other "none-eject-able" device (like SATA) fails or user decides to restore to "factory defaults". My inspections is to have deterministic boot and firmware update behavior suitable for none maintainable "black box" device (like SOHO routers). Best regards Chris Link to comment Share on other sites More sharing options...
tkaiser Posted April 18, 2016 Share Posted April 18, 2016 Probably for "un-bricking" I have to build image with 'root=/dev/mmcblk1p1' in command line to the kernel but answering the question "why" has to be answered first. Any ideas? Maybe just the simple reason that your SD card got corrupted? One of the nice features of Allwinner based boards is that they never can be bricked since they always listen for FEL boot attempts (when no SD card is present and on boards that feature NAND/eMMC when FEL/u-boot button is pressed) and in case a SD card is present always prefer this over onboard eMMC or NAND. So I would simply suspect that not the kernel changed his mind (close to impossible) but that for whatever reasons the board wasn't able to boot from SD card and then used eMMC as the normal fallback. After you wiped out also eMMC it's obviously not possible to boot any more since both boot sources are already corrupted. Your ideas to get consistent enumeration obviously can't work too since the device you boot from is mmcblk0 by design and the next ones mmcblk1, mmcblk2 and so on. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 18, 2016 Share Posted April 18, 2016 After a day with no problem booting from eMMC (without SD card inserted) and from SD/MMC if present in some reason the kernel decided to change its behavior. While U-Boot swaps SD/MMC enumeration depending of SD card presence and sending always 'root=/dev/mmcblk0p1' in command line to the kernel it begin enumerating eMMC as mmcblk0 only. It makes impossible to boot from SD card and my "fast" try was to "clean" eMMC from u-boot but the kernel continue to try to boot from eMMC and get "panic-ed". Kernel changing SD/MMC cards enumeration on boards with 2 SD slots or with SD+eMMC combination is a known problem. You can read through this issue for example. Unfortunately there is no "perfect" solution AFAIK. Root by partition UUID will need workarounds due to FS resize procedure at first boot. Root by filesystem UUID requires initrd, "bare" kernel has no means of getting FS UUID. Kernel hacks (like in sunxi legacy kernel)? Hard to test and maintain, so not a good idea. It may be possible to affect SD/MMC devices enumerations with DT aliases, I'll try to find more info and perform some tests. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 18, 2016 Share Posted April 18, 2016 Aliases for SD/MMC were not implemented unfortunately https://groups.google.com/forum/#!topic/fa.linux.kernel/sSi9mllOrAc Edit: @chradev You can try appying this or better this based on comments in groups.google.com thread: diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 0aecd5c..837089a 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -322,8 +322,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) /* scanning will be enabled when we're ready */ host->rescan_disable = 1; idr_preload(GFP_KERNEL); + err = of_alias_get_id(dev->of_node, "mmc"); spin_lock(&mmc_host_lock); - err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); + if (err >= 0) + err = idr_alloc(&mmc_host_idr, host, err, err+1, GFP_NOWAIT); + if (err < 0) + err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); if (err >= 0) host->index = err; spin_unlock(&mmc_host_lock); and experimenting with aliases in DT. Link to comment Share on other sites More sharing options...
chradev Posted April 18, 2016 Author Share Posted April 18, 2016 The SD card is definitely not corrupted. U-Boot on eMMC is cleaned. I have re-write SD card before try to boot and u-boot at least if loaded as expected from it. When u-boot try to load the kernel it tries to do from mmc0 (from u-boot point of view): U-Boot SPL 2015.10-armbian (Apr 17 2016 - 22:34:29)DRAM: 1024 MiBCPU: 912000000Hz, AXI/AHB/APB: 3/2/2U-Boot 2015.10-armbian (Apr 17 2016 - 22:34:29 +0300) Allwinner TechnologyCPU: Allwinner A20 (SUN7I)I2C: readyDRAM: 1 GiBMMC: SUNXI SD/MMC: 0 (SD), SUNXI SD/MMC: 1*** Warning - bad CRC, using default environmentIn: serialOut: serialErr: serialSCSI: SUNXI SCSI INITTarget spinup took 0 ms.AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA modeflags: ncq stag pm led clo only pmp pio slum part ccc apstNet: eth0: ethernet@01c50000starting USB...USB0: USB EHCI 1.00USB1: USB OHCI 1.0USB2: USB EHCI 1.00USB3: USB OHCI 1.0scanning bus 0 for devices... 1 USB Device(s) foundscanning bus 2 for devices... 1 USB Device(s) foundHit any key to stop autoboot: 0switch to partitions #0, OKmmc0 is current deviceScanning mmc 0:1...Found U-Boot script /boot/boot.scr2433 bytes read in 302 ms (7.8 KiB/s)## Executing script at 431000000 bytes read in 261 ms (0 Bytes/s)0 bytes read in 201 ms (0 Bytes/s)30017 bytes read in 1135 ms (25.4 KiB/s)6019696 bytes read in 576 ms (10 MiB/s)Kernel image @ 0x46000000 [ 0x000000 - 0x5bda70 ]## Flattened Device Tree blob at 49000000Booting using the fdt blob at 0x49000000Using Device Tree in place at 49000000, end 4900a540Starting kernel ...Uncompressing Linux... done, booting the kernel.[ 0.000000] Booting Linux on physical CPU 0x0[ 0.000000] Linux version 4.5.1-sunxi (root@chr-vm-yocto) (gcc version 4.8.2 (Ubuntu/Linaro 4.8.2-16ubuntu4) ) #2 SMP Sun Apr 17 22:36:43 EEST 2016[ 0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c5387d[ 0.000000] CPU: div instructions available: patching division code[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache[ 0.000000] Machine model: Olimex A20-OLinuXino-LIME2[ 0.000000] cma: Reserved 16 MiB at 0x7f000000[ 0.000000] Memory policy: Data cache writealloc[ 0.000000] psci: probing for conduit method from DT.[ 0.000000] psci: Using PSCI v0.1 Function IDs from DT[ 0.000000] PERCPU: Embedded 13 pages/cpu @ef6c3000 s23168 r8192 d21888 u53248[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260416[ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p1 rootwait rootfstype=ext4 cgroup_enable=memory swapaccount=1 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=7[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)[ 0.000000] Memory: 1008872K/1048576K available (9236K kernel code, 664K rwdata, 2164K rodata, 636K init, 308K bss, 23320K reserved, 16384K cma-reserved, 245760K highmem)[ 0.000000] Virtual kernel memory layout:[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)[ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)[ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)[ 0.000000] .text : 0xc0008000 - 0xc0b2a640 (11402 kB)[ 0.000000] .init : 0xc0b2b000 - 0xc0bca000 ( 636 kB)[ 0.000000] .data : 0xc0bca000 - 0xc0c702a4 ( 665 kB)[ 0.000000] .bss : 0xc0c73000 - 0xc0cc0378 ( 309 kB)[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1[ 0.000000] Hierarchical RCU implementation.[ 0.000000] Build-time adjustment of leaf fanout to 32.[ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2[ 0.000000] NR_IRQS:16 nr_irqs:16 16[ 0.000000] Architected cp15 timer(s) running at 24.00MHz (phys).[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns[ 0.000007] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns[ 0.000020] Switching to timer-based delay loop, resolution 41ns[ 0.000516] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns[ 0.000766] clocksource: hstimer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 12741736309 ns[ 0.000980] Console: colour dummy device 80x30[ 0.001016] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)[ 0.001032] pid_max: default: 32768 minimum: 301[ 0.001199] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)[ 0.001215] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)[ 0.002159] CPU: Testing write buffer coherency: ok[ 0.002223] ftrace: allocating 29015 entries in 86 pages[ 0.052285] /cpus/cpu@0 missing clock-frequency property[ 0.052322] /cpus/cpu@1 missing clock-frequency property[ 0.052336] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000[ 0.052427] Setting up static identity map for 0x400082c0 - 0x40008318[ 0.054718] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001[ 0.054826] Brought up 2 CPUs[ 0.054850] SMP: Total of 2 processors activated (96.00 BogoMIPS).[ 0.054857] CPU: All CPU(s) started in HYP mode.[ 0.054862] CPU: Virtualization extensions available.[ 0.055749] devtmpfs: initialized[ 0.065080] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4[ 0.065527] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns[ 0.066444] xor: measuring software checksum speed[ 0.161970] arm4regs : 1227.600 MB/sec[ 0.262035] 8regs : 766.000 MB/sec[ 0.362111] 32regs : 744.800 MB/sec[ 0.462189] neon : 1141.200 MB/sec[ 0.462198] xor: using function: arm4regs (1227.600 MB/sec)[ 0.462354] pinctrl core: initialized pinctrl subsystem[ 0.463752] NET: Registered protocol family 16[ 0.465236] DMA: preallocated 256 KiB pool for atomic coherent allocations[ 0.492273] cpuidle: using governor ladder[ 0.522303] cpuidle: using governor menu[ 0.530174] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.[ 0.530190] hw-breakpoint: maximum watchpoint size is 8 bytes.[ 0.702594] raid6: int32x1 gen() 136 MB/s[ 0.872816] raid6: int32x1 xor() 110 MB/s[ 1.043060] raid6: int32x2 gen() 184 MB/s[ 1.213026] raid6: int32x2 xor() 120 MB/s[ 1.383090] raid6: int32x4 gen() 189 MB/s[ 1.553189] raid6: int32x4 xor() 121 MB/s[ 1.723416] raid6: int32x8 gen() 175 MB/s[ 1.893405] raid6: int32x8 xor() 113 MB/s[ 2.063541] raid6: neonx1 gen() 437 MB/s[ 2.233622] raid6: neonx1 xor() 324 MB/s[ 2.403717] raid6: neonx2 gen() 577 MB/s[ 2.573842] raid6: neonx2 xor() 423 MB/s[ 2.743981] raid6: neonx4 gen() 705 MB/s[ 2.914087] raid6: neonx4 xor() 477 MB/s[ 3.084199] raid6: neonx8 gen() 645 MB/s[ 3.254319] raid6: neonx8 xor() 445 MB/s[ 3.254327] raid6: using algorithm neonx4 gen() 705 MB/s[ 3.254334] raid6: .... xor() 477 MB/s, rmw enabled[ 3.254341] raid6: using intx1 recovery algorithm[ 3.254713] reg-fixed-voltage ahci-5v: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/ahci_pwr_pin@1, deferring probe[ 3.254771] reg-fixed-voltage usb0-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb0_vbus_pin@0, deferring probe[ 3.254808] reg-fixed-voltage usb1-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb1_vbus_pin@0, deferring probe[ 3.254843] reg-fixed-voltage usb2-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb2_vbus_pin@0, deferring probe[ 3.257043] SCSI subsystem initialized[ 3.257728] usbcore: registered new interface driver usbfs[ 3.257806] usbcore: registered new interface driver hub[ 3.257888] usbcore: registered new device driver usb[ 3.258209] media: Linux media interface: v0.10[ 3.258272] Linux video capture interface: v2.00[ 3.258379] pps_core: LinuxPPS API ver. 1 registered[ 3.258387] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti[ 3.258418] PTP clock support registered[ 3.260202] clocksource: Switched to clocksource arch_sys_counter[ 3.328798] NET: Registered protocol family 2[ 3.329612] TCP established hash table entries: 8192 (order: 3, 32768 bytes)[ 3.329717] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)[ 3.329844] TCP: Hash tables configured (established 8192 bind 8192)[ 3.329944] UDP hash table entries: 512 (order: 2, 16384 bytes)[ 3.330005] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)[ 3.330433] NET: Registered protocol family 1[ 3.330977] RPC: Registered named UNIX socket transport module.[ 3.330993] RPC: Registered udp transport module.[ 3.331000] RPC: Registered tcp transport module.[ 3.331006] RPC: Registered tcp NFSv4.1 backchannel transport module.[ 3.332010] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available[ 3.333331] futex hash table entries: 512 (order: 3, 32768 bytes)[ 3.334113] Initialise system trusted keyring[ 3.344856] zbud: loaded[ 3.348236] NFS: Registering the id_resolver key type[ 3.348314] Key type id_resolver registered[ 3.348324] Key type id_legacy registered[ 3.348364] nfs4filelayout_init: NFSv4 File Layout Driver Registering...[ 3.348378] Installing knfsd (copyright © 1996 okir@monad.swb.de).[ 3.350087] JFS: nTxBlock = 8009, nTxLock = 64078[ 3.359871] SGI XFS with ACLs, security attributes, realtime, no debug enabled[ 3.368602] bounce: pool size: 64 pages[ 3.368959] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)[ 3.369182] io scheduler noop registered[ 3.369202] io scheduler deadline registered[ 3.369273] io scheduler cfq registered (default)[ 3.369779] sun4i-usb-phy 1c13400.phy: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb0_id_detect_pin@0, deferring probe[ 3.372754] sun7i-a20-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver[ 3.446604] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled[ 3.450025] console [ttyS0] disabled[ 3.470277] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 42, base_baud = 1500000) is a U6_16550A[ 4.301634] console [ttyS0] enabled[ 4.310672] brd: module loaded[ 4.322344] loop: module loaded[ 4.327535] sun7i-dwmac 1c50000.ethernet: no regulator found[ 4.333331] sun7i-dwmac 1c50000.ethernet: no reset control found[ 4.339337] Ring mode enabled[ 4.342407] No HW DMA feature register supported[ 4.346932] Normal descriptors[ 4.350264] TX Checksum insertion supported[ 4.355279] sun7i-dwmac 1c50000.ethernet eth0: No MDIO subnode found[ 4.365306] libphy: stmmac: probed[ 4.368720] eth0: PHY ID 001cc912 at 1 IRQ POLL (stmmac-0:01) active[ 4.375424] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver[ 4.381977] ehci-platform: EHCI generic platform driver[ 4.387630] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver[ 4.393864] ohci-platform: OHCI generic platform driver[ 4.399511] usbcore: registered new interface driver usb-storage[ 4.407022] sunxi-rtc 1c20d00.rtc: rtc core: registered rtc-sunxi as rtc0[ 4.413849] sunxi-rtc 1c20d00.rtc: RTC enabled[ 4.418398] i2c /dev entries driver[ 4.423041] axp20x 0-0034: AXP20x variant AXP209 found[ 4.441920] input: axp20x-pek as /devices/platform/soc@01c00000/1c2ac00.i2c/i2c-0/0-0034/axp20x-pek/input/input0[ 4.460405] axp20x 0-0034: Backup (RTC) battery charging is disabled[ 4.466970] axp20x 0-0034: AXP20X driver loaded[ 4.474001] sunxi-wdt 1c20c90.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)[ 4.483334] sunxi-mmc 1c0f000.mmc: Got CD GPIO[ 4.520466] sunxi-mmc 1c0f000.mmc: base:0xf0d78000 irq:26[ 4.557447] mmc0: host does not support reading read-only switch, assuming write-enable[ 4.560233] sunxi-mmc 1c11000.mmc: base:0xf0d7c000 irq:27[ 4.561168] ledtrig-cpu: registered to indicate activity on CPUs[ 4.561278] hidraw: raw HID events driver © Jiri Kosina[ 4.561484] usbcore: registered new interface driver usbhid[ 4.561487] usbhid: USB HID core driver[ 4.562669] Initializing XFRM netlink socket[ 4.563892] NET: Registered protocol family 10[ 4.565185] NET: Registered protocol family 17[ 4.565223] NET: Registered protocol family 15[ 4.565281] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.[ 4.565415] 8021q: 802.1Q VLAN Support v1.8[ 4.565493] Key type dns_resolver registered[ 4.566160] Registering SWP/SWPB emulation handler[ 4.568503] registered taskstats version 1[ 4.568524] Loading compiled-in X.509 certificates[ 4.568651] zswap: loaded using pool lzo/zbud[ 4.573213] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 8, RTO !![ 4.573960] Btrfs loaded[ 4.575580] Key type encrypted registered[ 4.581089] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !![ 4.581924] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !![ 4.582749] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !![ 4.583573] sunxi-mmc 1c11000.mmc: smc 1 err, cmd 55, RTO !![ 4.640264] ahci-sunxi 1c18000.sata: controller can't do PMP, turning off CAP_PMP[ 4.640310] ahci-sunxi 1c18000.sata: SSS flag set, parallel bus scan disabled[ 4.640339] ahci-sunxi 1c18000.sata: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode[ 4.640350] ahci-sunxi 1c18000.sata: flags: ncq sntf stag pm led clo only pio slum part ccc[ 4.641606] scsi host0: ahci-sunxi[ 4.642029] ata1: SATA max UDMA/133 mmio [mem 0x01c18000-0x01c18fff] port 0x100 irq 32[ 4.642492] ehci-platform 1c14000.usb: EHCI Host Controller[ 4.642529] ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1[ 4.642806] ehci-platform 1c14000.usb: irq 29, io mem 0x01c14000[ 4.655949] mmc1: MAN_BKOPS_EN bit is not set[ 4.660235] ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00[ 4.660549] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002[ 4.660557] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1[ 4.660562] usb usb1: Product: EHCI Host Controller[ 4.660568] usb usb1: Manufacturer: Linux 4.5.1-sunxi ehci_hcd[ 4.660573] usb usb1: SerialNumber: 1c14000.usb[ 4.661437] hub 1-0:1.0: USB hub found[ 4.661540] hub 1-0:1.0: 1 port detected[ 4.662972] ehci-platform 1c1c000.usb: EHCI Host Controller[ 4.663008] ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 2[ 4.663262] ehci-platform 1c1c000.usb: irq 33, io mem 0x01c1c000[ 4.663374] mmc1: new high speed MMC card at address 0001[ 4.664279] mmcblk0: mmc1:0001 P1XXXX 3.60 GiB[ 4.664700] mmcblk0boot0: mmc1:0001 P1XXXX partition 1 16.0 MiB[ 4.665094] mmcblk0boot1: mmc1:0001 P1XXXX partition 2 16.0 MiB[ 4.666373] mmcblk0: p1[ 4.680215] ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00[ 4.680531] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002[ 4.680540] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1[ 4.680546] usb usb2: Product: EHCI Host Controller[ 4.680551] usb usb2: Manufacturer: Linux 4.5.1-sunxi ehci_hcd[ 4.680556] usb usb2: SerialNumber: 1c1c000.usb[ 4.681383] hub 2-0:1.0: USB hub found[ 4.681438] hub 2-0:1.0: 1 port detected[ 4.682284] ohci-platform 1c14400.usb: Generic Platform OHCI controller[ 4.682320] ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 3[ 4.682570] ohci-platform 1c14400.usb: irq 30, io mem 0x01c14400[ 4.744461] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001[ 4.744468] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1[ 4.744474] usb usb3: Product: Generic Platform OHCI controller[ 4.744479] usb usb3: Manufacturer: Linux 4.5.1-sunxi ohci_hcd[ 4.744485] usb usb3: SerialNumber: 1c14400.usb[ 4.745304] hub 3-0:1.0: USB hub found[ 4.745354] hub 3-0:1.0: 1 port detected[ 4.746204] ohci-platform 1c1c400.usb: Generic Platform OHCI controller[ 4.746253] ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 4[ 4.746506] ohci-platform 1c1c400.usb: irq 34, io mem 0x01c1c400[ 4.804433] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001[ 4.804441] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1[ 4.804447] usb usb4: Product: Generic Platform OHCI controller[ 4.804452] usb usb4: Manufacturer: Linux 4.5.1-sunxi ohci_hcd[ 4.804457] usb usb4: SerialNumber: 1c1c400.usb[ 4.805295] hub 4-0:1.0: USB hub found[ 4.805353] hub 4-0:1.0: 1 port detected[ 4.806298] usb_phy_generic.0.auto supply vcc not found, using dummy regulator[ 4.806884] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver[ 4.806897] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 5[ 4.807200] usb usb5: New USB device found, idVendor=1d6b, idProduct=0002[ 4.807207] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1[ 4.807212] usb usb5: Product: MUSB HDRC host driver[ 4.807218] usb usb5: Manufacturer: Linux 4.5.1-sunxi musb-hcd[ 4.807223] usb usb5: SerialNumber: musb-hdrc.1.auto[ 4.808035] hub 5-0:1.0: USB hub found[ 4.808093] hub 5-0:1.0: 1 port detected[ 4.961628] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)[ 4.961829] ata1.00: ATA-9: SPCC Solid State Disk A20, SVN137a, max UDMA/133[ 4.961836] ata1.00: 117231408 sectors, multi 16: LBA48 NCQ (depth 31/32)[ 4.962091] ata1.00: configured for UDMA/133[ 4.962919] scsi 0:0:0:0: Direct-Access ATA SPCC Solid State 37a PQ: 0 ANSI: 5[ 5.089549] mmc0: new high speed SDHC card at address 0007[ 5.095906] mmcblk1: mmc0:0007 SD04G 3.71 GiB[ 5.102074] mmcblk1: p1[ 5.117096] vcc3v0: disabling[ 5.120096] vcc5v0: disabling[ 5.123184] usb0-vbus: disabling[ 5.151266] sd 0:0:0:0: [sda] 117231408 512-byte logical blocks: (60.0 GB/55.9 GiB)[ 5.151507] sd 0:0:0:0: Attached scsi generic sg0 type 0[ 5.164801] sd 0:0:0:0: [sda] Write Protect is off[ 5.169750] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA[ 5.180517] sda: sda1 sda2[ 5.185149] sd 0:0:0:0: [sda] Attached SCSI disk[ 5.194542] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)[ 5.202759] VFS: Mounted root (ext4 filesystem) readonly on device 179:1.[ 5.210382] devtmpfs: error mounting -2[ 5.214951] Freeing unused kernel memory: 636K (c0b2b000 - c0bca000)[ 5.221424] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.[ 5.234541] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.5.1-sunxi #2[ 5.240886] Hardware name: Allwinner sun7i (A20) Family[ 5.246136] [] (unwind_backtrace) from [] (show_stack+0x20/0x24)[ 5.253873] [] (show_stack) from [] (dump_stack+0x98/0xac)[ 5.261098] [] (dump_stack) from [] (panic+0xf4/0x258)[ 5.267977] [] (panic) from [] (__irq_alloc_descs+0x0/0x1ec)[ 5.275369] CPU1: stopping[ 5.278081] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.5.1-sunxi #2[ 5.284425] Hardware name: Allwinner sun7i (A20) Family[ 5.289653] [] (unwind_backtrace) from [] (show_stack+0x20/0x24)[ 5.297392] [] (show_stack) from [] (dump_stack+0x98/0xac)[ 5.304612] [] (dump_stack) from [] (handle_IPI+0x1bc/0x2c8)[ 5.312005] [] (handle_IPI) from [] (gic_handle_irq+0x94/0x98)[ 5.319569] [] (gic_handle_irq) from [] (__irq_svc+0x54/0x70)[ 5.327041] Exception stack(0xef145f48 to 0xef145f90)[ 5.332091] 5f40: 00000001 00000000 ef145fa8 c0024000 ef144000 c0c6b614[ 5.340260] 5f60: c0bcc49c 00000000 00000000 c0bcc500 c0bc85b0 ef145fa4 ef145fa8 ef145f98[ 5.348426] 5f80: c00108b4 c00108b8 60000013 ffffffff[ 5.353479] [] (__irq_svc) from [] (arch_cpu_idle+0x48/0x4c)[ 5.360874] [] (arch_cpu_idle) from [] (default_idle_call+0x30/0x3c)[ 5.368960] [] (default_idle_call) from [] (cpu_startup_entry+0x21c/0x348)[ 5.377566] [] (cpu_startup_entry) from [] (secondary_start_kernel+0x150/0x15c)[ 5.386604] [] (secondary_start_kernel) from [<400095cc>] (0x400095cc)[ 5.394000] Rebooting in 10 seconds..I Link to comment Share on other sites More sharing options...
chradev Posted April 18, 2016 Author Share Posted April 18, 2016 Hi Zador, Aliases for SD/MMC were not implemented unfortunately https://groups.google.com/forum/#!topic/fa.linux.kernel/sSi9mllOrAc Edit: @chradev You can try appying this or better this based on comments in groups.google.com thread: diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 0aecd5c..837089a 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -322,8 +322,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) /* scanning will be enabled when we're ready */ host->rescan_disable = 1; idr_preload(GFP_KERNEL); + err = of_alias_get_id(dev->of_node, "mmc"); spin_lock(&mmc_host_lock); - err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); + if (err >= 0) + err = idr_alloc(&mmc_host_idr, host, err, err+1, GFP_NOWAIT); + if (err < 0) + err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); if (err >= 0) host->index = err; spin_unlock(&mmc_host_lock); and experimenting with aliases in DT. No, I did not make any changes to u-boot and kernel (except once to support eMMC) because everything has worked perfectly until tonight by unknown reason. Last change I make was to test prepared by Igor patches for vanilla kernel and mainline u-boot to support eMMC (the same as offered and used by me). Reverting back to my patches did not make sense. I have u-boot and rootfs on both eMMC and SD card. It boots from eMMC if SD card is not inserted and from SD card if present. And that was for a day or so with many image builds/boots. EDIT: BTW I try to boot from second lime2-eMMC board but with virgin eMMC - result is the same. Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 Hi Zador, Aliases for SD/MMC were not implemented unfortunately https://groups.google.com/forum/#!topic/fa.linux.kernel/sSi9mllOrAc Edit: @chradev You can try appying this or better this based on comments in groups.google.com thread: diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 0aecd5c..837089a 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -322,8 +322,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) /* scanning will be enabled when we're ready */ host->rescan_disable = 1; idr_preload(GFP_KERNEL); + err = of_alias_get_id(dev->of_node, "mmc"); spin_lock(&mmc_host_lock); - err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); + if (err >= 0) + err = idr_alloc(&mmc_host_idr, host, err, err+1, GFP_NOWAIT); + if (err < 0) + err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); if (err >= 0) host->index = err; spin_unlock(&mmc_host_lock); and experimenting with aliases in DT. Following your advise I patch the kernel as follow: diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 0aecd5c..837089a 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -322,8 +322,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) /* scanning will be enabled when we're ready */ host->rescan_disable = 1; idr_preload(GFP_KERNEL); + err = of_alias_get_id(dev->of_node, "mmc"); spin_lock(&mmc_host_lock); - err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); + if (err >= 0) + err = idr_alloc(&mmc_host_idr, host, err, err+1, GFP_NOWAIT); + if (err < 0) + err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); if (err >= 0) host->index = err; spin_unlock(&mmc_host_lock); diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts index d5c796c..4bc6ce7 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts @@ -54,6 +54,8 @@ aliases { serial0 = &uart0; + mmc1 = "mmc@01c11000"; + mmc0 = "mmc@01c0f000"; }; chosen { The good news is that it works [ 4.795430] mmc1: new high speed MMC card at address 0001 [ 4.796351] mmcblk0: mmc1:0001 P1XXXX 3.60 GiB [ 4.796763] mmcblk0boot0: mmc1:0001 P1XXXX partition 1 16.0 MiB [ 4.797145] mmcblk0boot1: mmc1:0001 P1XXXX partition 2 16.0 MiB [ 4.805206] mmcblk0: p1 ... [ 5.090549] mmc0: new high speed SDHC card at address 0002 [ 5.096878] mmcblk1: mmc0:0002 00000 3.70 GiB [ 5.102951] mmcblk1: p1 ... [ 5.204156] EXT4-fs (mmcblk1p1): mounted filesystem with writeback data mode. Opts: (null) [ 5.212566] VFS: Mounted root (ext4 filesystem) readonly on device 179:25. [ 5.224087] devtmpfs: mounted but it is not a solution (not complete at least) of the problem. It only make MMC devices with fixed names. Linux command line 'root=/mmcblk0p1' has to be changed to 'root=/mmcblk1p1' by U-Boot after recognizing actual boot device Resize script has to be changed as well. Other staff may also be affected afterwards. Unfortunately, the situation is even more complicated adding that: U-Boot can be on SD card, eMMC or both and device names can also be swapped The rootfs can be on eMMC, SDC, USB HDD/Flash, SATA HDD/SSD or other recognized by U-Boot device The rootfs can be on any partition of the device Any way this path is probably the only possible leaving to Armbian user to change only boot priority in boot script (changed seriously). On the other hand boot environment could be alternative (better ?) place for searching and setting rootfs device Any thoughts? Best regards Chris Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 The good news is that it works [ 4.795430] mmc1: new high speed MMC card at address 0001 [ 4.796351] mmcblk0: mmc1:0001 P1XXXX 3.60 GiB [ 4.796763] mmcblk0boot0: mmc1:0001 P1XXXX partition 1 16.0 MiB [ 4.797145] mmcblk0boot1: mmc1:0001 P1XXXX partition 2 16.0 MiB [ 4.805206] mmcblk0: p1 ... [ 5.090549] mmc0: new high speed SDHC card at address 0002 [ 5.096878] mmcblk1: mmc0:0002 00000 3.70 GiB [ 5.102951] mmcblk1: p1 ... [ 5.204156] EXT4-fs (mmcblk1p1): mounted filesystem with writeback data mode. Opts: (null) [ 5.212566] VFS: Mounted root (ext4 filesystem) readonly on device 179:25. [ 5.224087] devtmpfs: mounted Not really sure it is because of aliasing or swapping. I have never made SD card as mmcblk0 with changing of aliases. I cannot understand how it worked a few days and why it is stopped at given moment. As 'working' I mean that the kernel automatically register under mmcblk0 eMMC (swap is needed) or SD card depending its presence (no swap). The only big difference meanwhile is migration from kernel 4.4.6 to 4.5.1 but it had definitely worked in the beginning after migration. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 19, 2016 Share Posted April 19, 2016 Linux command line 'root=/mmcblk0p1' has to be changed to 'root=/mmcblk1p1' by U-Boot after recognizing actual boot device If you cloned SD contents to eMMC with "dd", it will be hard to implement. Otherwise if u-boot correctly identifies "mmc 0" as boot device, it should be possible to implement with "root by partition UUID" /* * Convert a name into device number. We accept the following variants: ... * 6) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the * unique id of a partition if the partition table provides it. * The UUID may be either an EFI/GPT UUID, or refer to an MSDOS * partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero- * filled hex representation of the 32-bit "NT disk signature", and PP * is a zero-filled hex representation of the 1-based partition number. * 7) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in relation to * a partition with a known unique id. ... */ So boot script for a single partition image would look like this: # get partition UUID of partition 1 of mmc 0 device # and store it in "partuuid" variable part uuid mmc 0:1 partuuid # pass it to the kernel setenv bootargs "console=ttyS0,115200 root=PARTUUID=${partuuid} rootfstype=ext4 rootwait ..." # all other things go as usual ext4load mmc 0 0x49000000 /dtb/${fdtfile} ext4load mmc 0 0x46000000 zImage env set fdt_high ffffffff bootz 0x46000000 - 0x49000000 Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 Thanks Zador, Looking on the boot script code it should work even at partition UUID change, shouldn't it? After reading the posts about this method I was left with the impression that it be a problem. Best regards Chris Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 19, 2016 Share Posted April 19, 2016 If you cloned SD to eMMC with "dd", then partition UUIDs will be cloned too (AFAIK) - that is my main concern. If you partition your eMMC manually and use rsync to clone rootfs (or once nand-sata-install script is extended to handle eMMC installation), this should work fine. Previous posts probably were mentioning hardcoding partition UUID in boot script, which won't work well with FS resizing procedure - but getting UUIDs dynamically in u-boot should work even with FS resizing (once it is fixed). Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 I test situation with kernel 4.4.6 and find as described before. If SD card is mounted kernel assign it mmcblk0 and the system boots and resizes partition as expected. Later on I write the image to eMMC with 'dd' and it boots and resizes as well. There is some difference between kernel 4.4.6 and 4.5.1. Any way is proposed solution to use partition UUID works it will be more reliable regarding later kernel changes. Really U-Boot 2016.10 correctly identifies "mmc 0" as boot device for now. I will try with 2016.01 and 2016.05-rc1 as reported to boot Armbian on Lime2 boards. And is everything is ok probably this will be the right solution. Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 Hi Zador, If you cloned SD to eMMC with "dd", then partition UUIDs will be cloned too (AFAIK) - that is my main concern. If you partition your eMMC manually and use rsync to clone rootfs (or once nand-sata-install script is extended to handle eMMC installation), this should work fine. Previous posts probably were mentioning hardcoding partition UUID in boot script, which won't work well with FS resizing procedure - but getting UUIDs dynamically in u-boot should work even with FS resizing (once it is fixed). I test your proposal to retrieve and use 'root=PARTUUID=${partuuid}' in u-boot. Unfortunately, if both SD card and eMMC is cloned by 'dd' from the same image they are completely identical and kernel mount fist device it parses. I try to find tool for changing it after cloning but without success. Partition UUID can be changed easily by: tune2fs /dev/sde5 -U 'uuidgen' I am not sure that the only way to get different PARTUUID is to format disk and then clone partition only. In such a case lower sectors (incl. u-boot) should be updated separately (like nand-sata-install script style). Unfortunately, this will take much more time as well. Is there a way to change only PARTUUID? Best regards Chris Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 19, 2016 Share Posted April 19, 2016 tune2fs /dev/sde5 -U 'uuidgen' This changes filesystem UUID, not partition UUID. -U UUID Set the universally unique identifier (UUID) of the filesystem to UUID. The format of the UUID is a series of hex digits sepa†rated by hyphens, like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may also be one of the following: According to quick Google search, PARTUUID can be changed with gdisk: https://unix.stackexchange.com/questions/154171/changing-hfsplus-uuid-from-partedmagic Edit: The only difference is Armbian uses MBR instead of GPT, but I believe it still should work. For working with MBR partition tables fdisk should be used instead of gdisk. Don't see an option to change PARTUUID in fdisk unfortunately, will search for a solution that doesn't require recreating partition table later. Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 While experimenting with 'gdisk' I succeed to change PARTUUID (probably 'gdisk -f /dev/mmcblk1' regardless of printed error). root@egpr:~# blkid /dev/mmcblk0p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="eef59632-57ca-495e-b78d-110be70feba3" /dev/mmcblk1p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTUUID="00093953-01" /dev/sda1: UUID="87baa5f6-3ce0-42c3-849b-0ec7a77755ef" TYPE="ext4" PARTUUID="01c14ee2-01" /dev/sda2: UUID="acf3dece-0426-44b1-bba7-cbcb3bdfcb42" TYPE="ext4" PARTUUID="01c14ee2-02" /dev/mmcblk0: PTUUID="d7f3e31b-62c0-4ec5-b54c-62a5911bb702" PTTYPE="gpt" /dev/mmcblk1: PTUUID="00093953" PTTYPE="dos" Changed is /dev/mmcblk0p1 (SD card). After rebooting u-boot prints: U-Boot 2015.10-armbian (Apr 19 2016 - 15:04:27 +0300) Allwinner Technology CPU: Allwinner A20 (SUN7I) I2C: ready DRAM: 1 GiB MMC: SUNXI SD/MMC: 1 (SD), SUNXI SD/MMC: 0 (eMMC) instead of (when PARTUUID are identical): U-Boot 2015.10-armbian (Apr 19 2016 - 15:04:27 +0300) Allwinner Technology CPU: Allwinner A20 (SUN7I) I2C: ready DRAM: 1 GiB MMC: SUNXI SD/MMC: 0 (SD), SUNXI SD/MMC: 1 and load kernel and assign root to eMMC (which it take as 0). root@egpr:~# blkid /dev/mmcblk0p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="eef59632-57ca-495e-b78d-110be70feba3" /dev/mmcblk1p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTUUID="00093953-01" /dev/sda1: UUID="87baa5f6-3ce0-42c3-849b-0ec7a77755ef" TYPE="ext4" PARTUUID="01c14ee2-01" /dev/sda2: UUID="acf3dece-0426-44b1-bba7-cbcb3bdfcb42" TYPE="ext4" PARTUUID="01c14ee2-02" /dev/mmcblk0: PTUUID="d7f3e31b-62c0-4ec5-b54c-62a5911bb702" PTTYPE="gpt" /dev/mmcblk1: PTUUID="00093953" PTTYPE="dos" root@egpr:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 55.9G 0 disk ├─sda1 8:1 0 50G 0 part /media/sda1 └─sda2 8:2 0 5.9G 0 part /media/sda2 mmcblk1boot0 179:16 0 16M 1 disk mmcblk1boot1 179:24 0 16M 1 disk mmcblk0 179:0 0 3.7G 0 disk └─mmcblk0p1 179:1 0 1.2G 0 part mmcblk1 179:8 0 3.6G 0 disk └─mmcblk1p1 179:9 0 3.4G 0 part / Interesting is that u-boot swap SD card / eMMC order only if PARTUUID are identical (which is most probably bug or side effect). Unfortunately, kernel does not swap SD card / eMMC order in case of duplicated PARTUUID and the result is inability to boot from SD card again. BTW: at change from tests with kernel 4.4.6 to 4.5.1 I get again dreamed behavior (to boot from SD when inserted instead of eMMC). Unfortunately, this behavior is probably not reliable as observed before. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 19, 2016 Share Posted April 19, 2016 OK, "change disk identifier" in fdisk expert menu is the right option. Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 OK, "change disk identifier" in fdisk expert menu is the right option. Probably will give the same result as I have just described. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted April 19, 2016 Share Posted April 19, 2016 Since you used gdisk instead of fdisk, your partition table got changed from MBR to GPT. And looking at GPT documentation, it probably erased SPL and u-boot on your SD card, which caused boot from eMMC and change in SD/eMMC numbers. SPL starts at 8KB, and GPT can be up to 16KB in size (with 512 bytes logical block size) Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 Thanks Zador, you are right! Meanwile I change eMMC disk identifier (has to be 4 bytes hex value prefixed with 0x) and re-write SD card so both PTTYPE are "dos" but PTUUID are different: root@egpr:/media/sda1# blkid /dev/mmcblk0p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTUUID="00093953-01" /dev/mmcblk1p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTUUID="f9f9e8e8-01" /dev/sda1: UUID="87baa5f6-3ce0-42c3-849b-0ec7a77755ef" TYPE="ext4" PARTUUID="01c14ee2-01" /dev/sda2: UUID="acf3dece-0426-44b1-bba7-cbcb3bdfcb42" TYPE="ext4" PARTUUID="01c14ee2-02" /dev/mmcblk0: PTUUID="00093953" PTTYPE="dos" /dev/mmcblk1: PTUUID="f9f9e8e8" PTTYPE="dos" and finally a step to the success. U-Boot identifies SD card as a first: CPU: Allwinner A20 (SUN7I) I2C: ready DRAM: 1 GiB MMC: SUNXI SD/MMC: 0 (SD), SUNXI SD/MMC: 1 and kernel boots successfully from SD card, starts resize script and reboots. Unfortunately, eMMC is registered as mmvblk0 so resize script try to work on eMMC instead of SD card. After reboot SD card was not resized but the system boots from it reliably: /dev/mmcblk0p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTUUID="00093953-01" /dev/mmcblk1p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTUUID="f9f9e8e8-01" /dev/sda1: UUID="87baa5f6-3ce0-42c3-849b-0ec7a77755ef" TYPE="ext4" PARTUUID="01c14ee2-01" /dev/sda2: UUID="acf3dece-0426-44b1-bba7-cbcb3bdfcb42" TYPE="ext4" PARTUUID="01c14ee2-02" /dev/mmcblk0: PTUUID="00093953" PTTYPE="dos" /dev/mmcblk1: PTUUID="f9f9e8e8" PTTYPE="dos" root@egpr:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 55.9G 0 disk ├─sda1 8:1 0 50G 0 part /media/sda1 └─sda2 8:2 0 5.9G 0 part /media/sda2 mmcblk1boot0 179:16 0 16M 1 disk mmcblk1boot1 179:24 0 16M 1 disk mmcblk0 179:0 0 3.7G 0 disk └─mmcblk0p1 179:1 0 1.2G 0 part / mmcblk1 179:8 0 3.6G 0 disk └─mmcblk1p1 179:9 0 3.4G 0 part Note that at second boot SD card is registered as mmcblk0 in opposite to the first boot. Booting witout SD card is also fine: U-Boot 2015.10-armbian (Apr 19 2016 - 15:04:27 +0300) Allwinner Technology CPU: Allwinner A20 (SUN7I) I2C: ready DRAM: 1 GiB MMC: SUNXI SD/MMC: 1, SUNXI SD/MMC: 0 (eMMC) ... root@egpr:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 55.9G 0 disk ├─sda1 8:1 0 50G 0 part /media/sda1 └─sda2 8:2 0 5.9G 0 part /media/sda2 mmcblk0boot0 179:8 0 16M 1 disk mmcblk0boot1 179:16 0 16M 1 disk mmcblk0 179:0 0 3.6G 0 disk └─mmcblk0p1 179:1 0 3.4G 0 part / root@egpr:~# blkid /dev/mmcblk0p1: UUID="c7800036-5848-49e7-a462-ef56868c77bd" TYPE="ext4" PARTUUID="f9f9e8e8-01" /dev/sda1: UUID="87baa5f6-3ce0-42c3-849b-0ec7a77755ef" TYPE="ext4" PARTUUID="01c14ee2-01" /dev/sda2: UUID="acf3dece-0426-44b1-bba7-cbcb3bdfcb42" TYPE="ext4" PARTUUID="01c14ee2-02" /dev/mmcblk0: PTUUID="f9f9e8e8" PTTYPE="dos" Now resize script has to be changed to resize partition mounted on the root. Link to comment Share on other sites More sharing options...
chradev Posted April 19, 2016 Author Share Posted April 19, 2016 I try to make following change in do_expand_rootfs() function of firstrun script: from: DEVICE="/dev/"$(lsblk -idn -o NAME | grep -w mmcblk0) to: DEVICE=$(mount|grep ' / '|cut -d' ' -f 1 | cut -dp -f1) expecting the script to resize the first partition of SD card where the system is booted from. At first boot SD card is registered as mmcblk1 and 'mount|grep ' / '|cut -d' ' -f 1 | cut -dp -f1' command prints /dev/mmcblk1 as expected. Unfortunately, by some reason partition did not get resized. Any ideas where is the problem? EDIT: It was typo! Resize is working fine even firstrun script does not require reboot. It works meaningless how devices are registered in the kernel. Boot and resize is working fine on eMMC as well. Fortunately or not, at the last boot the order of registered devices in kernel was changed again. Any way now sending PARTUUID from u-boot to kernel works reliably. The only important thing is u-boot to recognize right boot device so following must be met: disk partition table for both SD card and eMMC must have PTTYPE="dos" PTUUID="XXXXXXXX" must be unique for both SD card and eMMC both SD card and eMMC must have SPL with U-Boot installed To avoid duplication of SD card and eMMC PARTUUID if 'dd' is used to write SD card eMMC can be prepared by: fdisk -> new partition; mkfs.extX; rsync 'dd'; fdisk -> x -> i (change the disk identifier) -> 0x1234cdef -> r -> w extended nand-sata-install script to support eMMC In case of cloning eMMC and SD card from the same image maybe partition UUID has to be changed as well: tune2fs /dev/mmcblkXp1 -U 'uuidgen' where uuidgen command is a part of uuid-runtime package in Debian and Ubuntu distributions. Next steps: extending of nand-sata-install script to support eMMC (I do not plan to work on it personally) extend boot.scr to boot from other USB HDD/Flash and SATA HDD/SSD devices extend boot.scr to boot from eMMC as fail over option on user button press Link to comment Share on other sites More sharing options...
Recommended Posts