October 22, 2019, 11:03:10 am

News:

Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/


Cubietruck NAS

Started by uwe, December 18, 2013, 03:58:26 pm

Previous topic - Next topic

uwe

December 18, 2013, 03:58:26 pm Last Edit: December 19, 2013, 04:07:30 am by uwe
Hi!

I use my cubietruck as a NAS (with netatalk) and the performance this fine little peace of hardware is really good! I had installed Lubuntu Server.
After some tests I wanted to connect my large hard disks and tried to mount them. But this does not work! I use btrfs and this kernel module is missing. :-(

Ok. I installed in a VirtualBox Ubuntu Server (same version: 13.10) an got with git the 3.4.61 kernel sources. I made a cross compile and build the modules the way it is described in this forum and on the site "Compiling Latest Kernel For Cubietruck Cubieboard3". So far so good.  ;)

But I can not load the btrfs.ko module, because the file "Module.symvers" is missing.
(dmesg -> btrfs: disagrees about version of symbol module_layout). And "modprobe -f btrfs" also fails.
Why is nowhere the matching kernel sources of the running lubuntu server kernel - including this file! - for download?
Without this I can not build additional modules for the running kernel.

The only chance is now to replace the whole kernel and the modules afterwards on the sd-card?

After all I'm thinking about the kernel version I'm using. Version 3.4.61 is, respective btrfs, a really old version.

But I don't dare to get a newer kernel version and try to cross-compile. There are many posts in this forum with crashing cubietrucks running self-compiled kernel and kernel not compiled with an old gcc version.

This all look like a long winding road to nowhere for me.  :'(

At least one reliable source for the running kernel, including a matching "Module.symvers", would be great!

Is any other "ready to go" image out there with btrfs support?

Best regards
uwe

fairlane


uwe

December 18, 2013, 06:14:17 pm #2 Last Edit: December 18, 2013, 06:21:35 pm by uwe
Hello fairlane!

Thank you, good hint! I used find to search on my cubietruck nand and inside my git-kernel-source for a file named "vmlinux.o" to extract with modprobe a "Module.symvers". But ... this file its nowhere included.

Only when I compile myself a kernel this file is created ... but at the same time the "Module.symvers" is also created. No advantage at all.  ;)

I really want to use btrfs for my nas. The internal checksums are perfect for long time data storage.

Short arms, no cookies. I don't know what to do now.  :-\

Best regards
uwe

rose28357

December 19, 2013, 02:42:47 am #3 Last Edit: December 19, 2013, 04:20:47 pm by rose28357
There is a Upstream task in sunxi to bring Allwinner SoC support to the standard kernel.

Eventualy they have a btfs solution which can be backported.

Actual they are working on contributions to kernel 3.13.


uwe

December 19, 2013, 03:50:17 pm #4 Last Edit: December 23, 2013, 07:48:59 pm by uwe
Hi!

I compiled now successfully a new 3.4.61+ kernel and replaced the old one on my sdcard running lubuntu-server.   ;D

And now I have btrfs:

$ uname -a
Linux cubietruck 3.4.61+ #3 SMP PREEMPT Wed Dec 18 18:07:49 CET 2013 armv7l armv7l armv7l GNU/Linux

$ lsmod
Module                  Size  Used by
btrfs                 655873  0
mali                  113735  0
ump                    57063  1 mali
lcd                     3786  0
sunxi_gmac             31489  0
pwm_sunxi               9290  0
$


Now I know how to compile a cubietruck kernel and get the system up and running ... so I only need to wait for the official support in v3.13.


This is the way to go for a new kernel:

1.) Install "ubuntu-13.10-server-i386.iso" in a VirtualBox. Create a user "linaro". Do the next steps inside this vbox system with the linaro-user login!

2.) Install software for cross-compile
sudo apt-get install git build-essential gcc-arm-linux-gnueabi libncurses5-dev u-boot-tools qemu-user-static debootstrap binfmt-support libusb-1.0-0-dev pkg-config gcc-arm-linux-gnueabihf

3.) git clone:
git clone http://github.com/cubieboard/linux-sunxi.git
git clone http://github.com/cubieboard/cubie_configs
git clone http://github.com/cubieboard/u-boot-sunxi.git -b cubie/sunxi
git clone http://github.com/cubieboard/sunxi-tools.git
git clone http://github.com/cubieboard/sunxi-boards.git


4.) Get Kernel Configuration from running cubietruck in "/proc/config.gz". Use this in your "linux-sunix"-Kernel source. (See at this point also my other posting with my finaly used .config.)

5.) cross-compile your kernel in the virtual system:
cd linux-sunxi
git checkout -b cubie-3.4 cubie/sunxi-3.4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig      # -->change and save new config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install


6.) The new kernel and the new modules:
-> arch/arm/boot/uImage
-> output/lib/modules/3.4.XXX/
The uImage file needs to be started by u-boot, and the modules directory needs to be copied to the /lib/modules on the target rootfs.

7.) Prepare a sd-card with your system:
http://docs.cubieboard.org/tutorials/ct1/installation/install_lubuntu_desktop_server_to_sd_card

8.) Mount the first and second partition with a sd-card reader and replace your uImage and the modules

9.) Boot your new system with the new self-made kernel!!!  8)

fairlane

Hi,

nice work and i must not search a step-by-step kernel making howto.  :)

br,
fairlane

uwe

December 19, 2013, 05:52:36 pm #6 Last Edit: December 23, 2013, 07:37:40 pm by uwe
Hi!

System is running stable. BTRFS is also stable.

I use two 3TB USB disks:

[   12.514326] scsi 1:0:0:0: Direct-Access     Toshiba  External USB 3.0 0201 PQ: 0 ANSI: 6
[   12.538106] sd 1:0:0:0: [sda] Very big device. Trying to use READ CAPACITY(16).
[   12.567624] sd 1:0:0:0: [sda] 732566645 4096-byte logical blocks: (3.00 TB/2.72 TiB)
[   12.572258] sd 1:0:0:0: [sda] Write Protect is off
[   12.576334] sd 1:0:0:0: [sda] Mode Sense: 2b 00 00 00
[   12.585121] sd 1:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   12.595865] sd 1:0:0:0: [sda] 732566645 4096-byte logical blocks: (3.00 TB/2.72 TiB)
[   12.633512]  sda: sda1
[   12.648782] sd 1:0:0:0: [sda] 732566645 4096-byte logical blocks: (3.00 TB/2.72 TiB)
[   12.656650] sd 1:0:0:0: [sda] Attached SCSI disk


I also installed netatalk with apt-get and my Mac can now use a bonjour announced share.
Transfer rate: write ~25-30MB/s, read ~15-25MB/s.

I don't use stuff like snapshots with btrfs. So this early btrfs kernel version is stable enough. I checked several times the checksums of the transferred files. Everything ok until now.
Edit: On the btrfs wiki website they say it is "stable,recommended" in this v3.4 kernel. Not so fast, but stable. Ok.

So ... let's wait for the kernel v3.13  ;)

Best regards
uwe

dandreoletti

Quote from: uwe on December 18, 2013, 03:58:26 pm
Hi!

I use my cubietruck as a NAS (with netatalk) and the performance this fine little peace of hardware is really good! I had installed Lubuntu Server.
After some tests I wanted to connect my large hard disks and tried to mount them. But this does not work! I use btrfs and this kernel module is missing. :-(

Ok. I installed in a VirtualBox Ubuntu Server (same version: 13.10) an got with git the 3.4.61 kernel sources. I made a cross compile and build the modules the way it is described in this forum and on the site "Compiling Latest Kernel For Cubietruck Cubieboard3". So far so good.  ;)

But I can not load the btrfs.ko module, because the file "Module.symvers" is missing.
(dmesg -> btrfs: disagrees about version of symbol module_layout). And "modprobe -f btrfs" also fails.
Why is nowhere the matching kernel sources of the running lubuntu server kernel - including this file! - for download?
Without this I can not build additional modules for the running kernel.

The only chance is now to replace the whole kernel and the modules afterwards on the sd-card?

After all I'm thinking about the kernel version I'm using. Version 3.4.61 is, respective btrfs, a really old version.

But I don't dare to get a newer kernel version and try to cross-compile. There are many posts in this forum with crashing cubietrucks running self-compiled kernel and kernel not compiled with an old gcc version.

This all look like a long winding road to nowhere for me.  :'(

At least one reliable source for the running kernel, including a matching "Module.symvers", would be great!

Is any other "ready to go" image out there with btrfs support?

Best regards
uwe


Maybe we and others can join effort in getting the cubietruck working as NAS. I was planning on using ZFS instead of BTFRS but I welcome the idea of having several possibilities.

I have already started a project on github (announced here: http://www.cubieforums.com/index.php/topic,1236.0.html) which can build an image for SD card from scratch (custom kernel support, early custom rootfs support) - The build is fully automated and can be reused by anyone. It lacks support for many drivers for now - gmac, etc ...

I am sure, there is a lot of people willing to get cubietruck working as NAS and joining efforts would help get this project completed or get a larger feature set out of the door faster :)

If you (uwe) or others are interested, then we should discuss it.

PS: I did not mean to hijack your post. Have a good day :)

uwe

December 19, 2013, 09:11:26 pm #8 Last Edit: December 23, 2013, 07:37:59 pm by uwe
Hi!

Quote from: dandreoletti on December 19, 2013, 07:37:32 pm
I have already started a project on github (announced here: http://www.cubieforums.com/index.php/topic,1236.0.html) which can build an image for SD card from scratch (custom kernel support, early custom rootfs support) - The build is fully automated and can be reused by anyone. It lacks support for many drivers for now - gmac, etc ...


Wow! I looked at your build-kernel-bootloader.sh file. Nice work.
I tooked the short cut, using the lubuntu image and just replaced the kernel. Your script is a lot better for building a system from scratch.  8)

I had a quick look in your todo file ...
A good way to set the mac address is a hook for dhcp:

# cat /etc/dhclient/dhclient-enter-hooks.d/setmac
/sbin/ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx



Interesting! You also use "CROSS_COMPILE=arm-linux-gnueabi.
I had no success with this, got compile errors. I used CROSS_COMPILE=arm-linux-gnueabihf and the build was fine.


What is the overall status of these scripts? They look complete, you also use the sunxi-linux git sources ... but you listed several points with "Not working".

Tell me more.  ;)

Best regards
Uwe

dandreoletti

December 19, 2013, 11:42:21 pm #9 Last Edit: December 19, 2013, 11:49:54 pm by dandreoletti
Quote from: uwe on December 19, 2013, 09:11:26 pm
Wow! I looked at your build-kernel-bootloader.sh file. Nice work.
I tooked the short cut, using the lubuntu image and just replaced the kernel. Your script is a lot better for building a system from scratch.  8)


Thanks :)

Quote from: uwe on December 19, 2013, 09:11:26 pm
I had a quick look in your todo file ...
A good way to set the mac address is a hook for dhcp:
Quote
# cat /etc/dhclient/dhclient-enter-hooks.d/setmac
/sbin/ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx



I used /etc/network/intefaces (see https://github.com/davidandreoletti/cubietruck/blob/master/custom/rootfs/etc/network/interfaces) to change the mac yet could not verify it works as I cannot get eth0 up :( You are welcome to send a pull request  ;)

Quote from: uwe on December 19, 2013, 09:11:26 pm
Interesting! You also use "CROSS_COMPILE=arm-linux-gnueabi.
I had no success with this, got compile errors. I used CROSS_COMPILE=arm-linux-gnueabihf and the build was fine.


I had success with  "arm-linux-gnueabi". I did not try "arm-linux-gnueabihf" yet because I could not find the right ubuntu packages - I should try one day.

Quote from: uwe on December 19, 2013, 09:11:26 pm
What is the overall status of these scripts? They look complete, you also use the sunxi-linux git sources ... but you listed several points with "Not working".


The status is pretty accurate:
- Most of the work has been on automating the SD image generation.  This is fairly complete to me. I do have to refactor it a bit to separate the different tasks but it can wait for now.
- Defaults:
    - Linux-sunxi as kernel (from patwood's repo).
    - sunxi's u-boot
    - automated sdimage creation (2 partitions: FAT (boot) and Ext4 (rootfs))
- I only scratched the surface when it comes to:
  - getting drivers to work  (gmac, etc...)
  - customizing the rootfs (eg: DHCP for eth0, SSH server, etc...).

That's where I was hoping you and others could provide some valuable help as you already got it working  :)

Quote from: uwe on December 19, 2013, 09:11:26 pm
Tell me more.  ;)


I know there are a lot of people trying to get different things working on the cubietruck (cedar, wifi, ethernet, etc). You (uwe) and others (eg: patwood) have shown the way. Maybe with more people on board, we can get a relatively stable image with the following advantages:
- ease image creation
- speedup testing support for different drivers, kernels, rootfs
- speedup rootfs tuning (eg: mac address, etc)

You look responsive to this project, would you (uwe and others) like to help with this ? I would greatly appreciate :)

patwood

Quote from: uwe on December 19, 2013, 09:11:26 pm
Interesting! You also use "CROSS_COMPILE=arm-linux-gnueabi.
I had no success with this, got compile errors. I used CROSS_COMPILE=arm-linux-gnueabihf and the build was fine.


Best regards
Uwe


Just curious -- what version of the arm gcc did you install on your 13.10 distro?  You can do arm-linux-gnueabihf-gcc -v to find out if you just used the default.  I ask because people have had problems getting a working kernel with the 4.7.x version in the past; if it's working now, that's good news.

uwe

December 20, 2013, 04:08:20 am #11 Last Edit: December 23, 2013, 07:38:21 pm by uwe
Quote from: patwood on December 20, 2013, 01:45:21 am
Just curious -- what version of the arm gcc did you install on your 13.10 distro?  You can do arm-linux-gnueabihf-gcc -v to find out if you just used the default.  I ask because people have had problems getting a working kernel with the 4.7.x version in the past; if it's working now, that's good news.


It is "gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu7)"
Installed with the regular apt-get install command.

My kernel is stable, it is doing a scrub on one disk since yesterday evening with some load:

$ uptime
09:00:46 up 10:29,  4 users,  load average: 4.51, 4.32, 3.74

$ cat /proc/loadavg
4.39 4.29 3.73 4/136 4804

$ sudo btrfs scrub status /dev/sdb1
scrub status for xxxxxxxxxxxxxxxx
scrub started at Thu Dec 19 23:54:53 2013 and finished after 54378 seconds
total bytes scrubbed: 1.42TB with 0 errors


15 hours hard work. No error shows up in dmesg or "/var/log/syslog".  ;D

Best regards
Uwe

uwe

December 20, 2013, 08:55:45 pm #12 Last Edit: December 23, 2013, 07:38:35 pm by uwe
There is a Problem with wifi.  :'(

When I do "modprobe bcmdhd" I get this:

ec 21 01:40:06 cubietruck kernel: [  778.984453] sunxi_gpio driver init ver 1.3
Dec 21 01:40:06 cubietruck kernel: [  778.991746] gpiochip_add: registered GPIOs 1 to 2 on device: A1X_GPIO
Dec 21 01:40:09 cubietruck kernel: [  782.097816] bcmdhd: got gpio2, mapped to irqno170
Dec 21 01:40:09 cubietruck kernel: [  782.106278] dhd_customer_gpio_wlan_ctrl: call customer specific GPIO to turn on WL_REG_ON
Dec 21 01:40:09 cubietruck kernel: [  782.227604] sdio wifi power state: on
Dec 21 01:40:09 cubietruck kernel: [  782.235600] [mmc-msg] sdc3 set ios: clk 0Hz bm PP pm UP vdd 3.3V width 1 timing LEGACY(SDR12) dt B
Dec 21 01:40:09 cubietruck kernel: [  782.238112] [mmc-msg] sdc3 power on
Dec 21 01:40:09 cubietruck kernel: [  782.261394] [mmc-msg] sdc3 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B
Dec 21 01:40:09 cubietruck kernel: [  782.266308] [mmc-msg] sdc3 set round clock 400000, src 24000000
Dec 21 01:40:10 cubietruck kernel: [  782.338719] [mmc-err] smc 3 err, cmd 52,  RTO
Dec 21 01:40:10 cubietruck kernel: [  782.347482] [mmc-err] smc 3 err, cmd 52,  RTO
Dec 21 01:40:10 cubietruck kernel: [  782.360361] [mmc-msg] sdc3 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B
Dec 21 01:40:10 cubietruck kernel: [  782.364367] =========== WLAN placed in POWER ON ========
Dec 21 01:40:10 cubietruck kernel: [  782.381342] [mmc-msg] sdc3 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B
Dec 21 01:40:10 cubietruck kernel: [  782.387581] [mmc-err] smc 3 err, cmd 8,  RTO
Dec 21 01:40:10 cubietruck kernel: [  782.400689] [mmc-msg] sdc3 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B
Dec 21 01:40:10 cubietruck kernel: [  782.415088] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
Dec 21 01:40:10 cubietruck kernel: [  782.421611] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
Dec 21 01:40:10 cubietruck kernel: [  782.428238] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
Dec 21 01:40:10 cubietruck kernel: [  782.435488] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
Dec 21 01:40:10 cubietruck kernel: [  782.463358] [mmc-msg] sdc3 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing SD-HS(SDR25) dt B
Dec 21 01:40:10 cubietruck kernel: [  782.472585] [mmc-msg] sdc3 set ios: clk 50000000Hz bm PP pm ON vdd 3.3V width 1 timing SD-HS(SDR25) dt B
Dec 21 01:40:10 cubietruck kernel: [  782.477829] [mmc-msg] sdc3 set round clock 42857143, src 600000000
Dec 21 01:40:10 cubietruck kernel: [  782.544008] [mmc-msg] sdc3 set ios: clk 50000000Hz bm PP pm ON vdd 3.3V width 4 timing SD-HS(SDR25) dt B
Dec 21 01:40:10 cubietruck kernel: [  782.552138] mmc1: new high speed SDIO card at address 0001
Dec 21 01:40:11 cubietruck kernel: [  783.364637] ANDROID-ERROR) wl_android_wifictrl_func_add: platform_driver_register timeout
Dec 21 01:40:11 cubietruck kernel: [  783.387122] dhd_customer_gpio_wlan_ctrl: call customer specific GPIO to turn off WL_REG_ON
Dec 21 01:40:11 cubietruck kernel: [  783.500468] sdio wifi power state: off
Dec 21 01:40:11 cubietruck kernel: [  783.504584] =========== WLAN placed in POWER OFF ========


And no "wlan0" interface shows up.

I don't get it. Any hints or suggestions?

neo9

Moin Uwe,
is that all logging yout get? Usually there should be more stuff get logged regarding wifi in syslog or dmesg.

Could you add "bcmdhd" to your /etc/modules ,reboot and post the output of "dmesg". Maybe to pastebin, as the output will be rather long?
Or #modprobe bcmdhd and scan dmesg for new lines.
I guess we need more to debug. :)

Do you have the proper firmware for the chip? It should probably be at /lib/firmware/ap6210/fw_bcm40181a2.bin
But search your system for "bcm40181" or "ap6210". It could be in other places.

I built my kernel from https://github.com/cubieboard2/linux-sunxi branch "sunxi-3.4-ct-v101"
noticed you built from https://github.com/cubieboard/linux-sunxi/
My wifi works. Maybe there is something missing in the git repo you are building from?

Could you post content of the "[wifi_para]" section of your script.bin?

grüsse aus Hamburg
Cubietruck / Patwood 3.4.75-sun7i+ #55 / Debian Jessie

uwe

December 21, 2013, 05:10:18 am #14 Last Edit: December 23, 2013, 07:39:41 pm by uwe
Moin Moin neo9!  :)

Quote from: neo9 on December 20, 2013, 10:04:32 pm
is that all logging yout get?
Or #modprobe bcmdhd and scan dmesg for new lines.


Yes, that's all. That's the way I got this lines.

Quote from: neo9 on December 20, 2013, 10:04:32 pm
I guess we need more to debug. :)


Thank you for your help. I really appreciate that.

Quote from: neo9 on December 20, 2013, 10:04:32 pm
Do you have the proper firmware for the chip? It should probably be at /lib/firmware/ap6210/fw_bcm40181a2.bin
But search your system for "bcm40181" or "ap6210". It could be in other places.


It the same place specified in my Kernel config:

[size=8pt]linaro@cubietruck:~$ ls -al /lib/firmware/ap6210/
total 684
drwxrwxr-x 2 root root   4096 Nov  2 08:00 .
drwxrwxr-x 9 root root   4096 Nov  2 08:00 ..
-rwxrwxr-x 1 root root  26621 Nov  2 08:00 bcm20710a1.hcd
-rwxrwxr-x 1 root root     17 Nov  2 08:00 bd_addr.txt
-rwxrwxr-x 1 root root 219557 Nov  2 08:00 fw_bcm40181a2.bin
-rwxrwxr-x 1 root root 206163 Nov  2 08:00 fw_bcm40181a2_apsta.bin
-rwxrwxr-x 1 root root 219557 Nov  2 08:00 fw_bcm40181a2_p2p.bin
-rwxrwxr-x 1 root root   1178 Nov  2 08:00 nvram_ap6210.txt
-rwxrwxr-x 1 root root   1178 Nov  2 08:00 nvram_apxxxx.txt[/size]



[size=8pt]CONFIG_BCMDHD=m
CONFIG_BCMDHD_FW_PATH="/lib/firmware/ap6210/fw_bcmxxxx.bin"
CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/ap6210/nvram_apxxxx.txt"
CONFIG_BCMDHD_OOB=y
# CONFIG_BCMDHD_SDIO_IRQ is not set[/size]


Quote from: neo9 on December 20, 2013, 10:04:32 pm
I built my kernel from https://github.com/cubieboard2/linux-sunxi branch "sunxi-3.4-ct-v101"
noticed you built from https://github.com/cubieboard/linux-sunxi/
My wifi works. Maybe there is something missing in the git repo you are building from?


Thats a good point! I have to check this.

Quote from: neo9 on December 20, 2013, 10:04:32 pm
Could you post content of the "[wifi_para]" section of your script.bin?


Here it is, fresh converted with bin2fex:

[wifi_para]
wifi_used = 1
wifi_sdc_id = 3
wifi_usbc_id = 2
wifi_usbc_type = 1
wifi_mod_sel = 7
wifi_power = ""
ap6xxx_wl_regon = port:PH09<1><default><default><0>
ap6xxx_bt_regon = port:PH18<1><default><default><0>
ap6xxx_bt_wake = port:PH24<1><default><default><0>
ap6xxx_bt_host_wake = port:PH25<0><default><default><0>
ap6xxx_lpo = port:PI12<4><1><default><1>

[usb_wifi_para]
usb_wifi_used = 0
usb_wifi_usbc_num = 2


Best regards,
Uwe


Quote from: neo9 on December 20, 2013, 10:04:32 pm
grüsse aus Hamburg


grüsse aus der nähe von Frankfurt  ;D