Страница 1 из 6

Raspberry Pi: hard realtime Linux/Xenomai

Добавлено: 13 июн 2018, 20:05
Olej
Загрузка образа с SD-карточки, откуда образ этот .img брать, и что с ним делать - описано здесь.
В итоге там приключения закончились на том, что удалось загрузить на Raspberry Pi 2 специально подготовленную hard realtime OS, и подключиться к ней по SSH (сколько угодно сессий):

Код: Выделить всё

olej@nvidia ~ $ ssh root@192.168.1.108
The authenticity of host '192.168.1.108 (192.168.1.108)' can't be established.
ECDSA key fingerprint is SHA256:ybkJ5eB+oqonPKk23OyqvtH+1zfv9A+TNtNpiCw4BJQ.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.108' (ECDSA) to the list of known hosts.
root@192.168.1.108's password: 

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jun 13 16:25:35 2018

model: Raspberry Pi 2 Model B Rev 1.1
compatible: brcm,bcm2709
My IP address is 192.168.1.108 

Xenomai/cobalt v3.0.5
root@raspberrypi:~ # uname -a
Linux raspberrypi 4.1.21-v7+ #4 SMP Sat Jul 15 06:39:14 CEST 2017 armv7l GNU/Linux
Дальше:
- необъятный простор для экспериментирования...
- выполнение тестов и сравнений
- написание собственных realtime приложений, модулей-драйверов в модели RTDM (realtime drivers model), использования realtime Ethernet сети RTnet ...
Необъятное поле деятельности! :-D

Re: Rapsberry Pi: hard realtime Linux/Xenomai

Добавлено: 13 июн 2018, 20:42
Olej
Olej писал(а):Загрузка образа с SD-карточки, откуда образ этот .img брать, и что с ним делать - описано здесь.
Необъятное поле деятельности! :-D
Первейшим делом - растянуть файловую систему /root из размера .img файла - до полного размера SD-карточки:

Код: Выделить всё

root@raspberrypi:~ # df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        1679704 1492812     99544  94% /
devtmpfs          473664       0    473664   0% /dev
tmpfs             473896       0    473896   0% /dev/shm
tmpfs             473896   12428    461468   3% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             473896       0    473896   0% /sys/fs/cgroup
/dev/mmcblk0p1     64456   27640     36816  43% /boot

Код: Выделить всё

root@raspberrypi:~ # raspi-config --expand-rootfs

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Disk /dev/mmcblk0: 7.5 GiB, 7994343424 bytes, 15613952 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
Disklabel type: dos
Disk identifier: 0xa2d55a34

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk0p1        8192  137215  129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      137216 3618815 3481600  1.7G 83 Linux


Command (m for help): Partition number (1,2, default 2): 
Partition 2 has been deleted.

Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (2048-15613951, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (137216-15613951, default 15613951): 
Created a new partition 2 of type 'Linux' and of size 7.4 GiB.

Command (m for help): Disk /dev/mmcblk0: 7.5 GiB, 7994343424 bytes, 15613952 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
Disklabel type: dos
Disk identifier: 0xa2d55a34

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        8192   137215   129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      137216 15613951 15476736  7.4G 83 Linux


Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

Please reboot
Ну и ... как просит :-)

Re: Rapsberry Pi: hard realtime Linux/Xenomai

Добавлено: 13 июн 2018, 20:45
Olej
Olej писал(а):Ну и ... как просит :-)

Код: Выделить всё

root@raspberrypi:~ # parted 
GNU Parted 3.2
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free                                                       
Model: SD SD16G (sd/mmc)
Disk /dev/mmcblk0: 7994MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
        32.3kB  4194kB  4162kB           Free Space
 1      4194kB  70.3MB  66.1MB  primary  fat16        lba
 2      70.3MB  7994MB  7924MB  primary  ext4

(parted) ^C                                                        

Код: Выделить всё

root@raspberrypi:~ # df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7584328 1496044   5823844  21% /
devtmpfs          473664       0    473664   0% /dev
tmpfs             473896       0    473896   0% /dev/shm
tmpfs             473896   12364    461532   3% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             473896       0    473896   0% /sys/fs/cgroup
/dev/mmcblk0p1     64456   27640     36816  43% /boot
Ну вот: вместо 94% занятого - только 21% !

Re: Rapsberry Pi: hard realtime Linux/Xenomai

Добавлено: 13 июн 2018, 20:46
Olej
Так оно будет попроще ;-) :

Код: Выделить всё

root@raspberrypi:~ # apt-get install mc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  mc-data
Suggested packages:
  arj catdvi texlive-binaries dbview djvulibre-bin genisoimage gv imagemagick links w3m lynx odt2txt poppler-utils python-boto python-tz xpdf
  pdf-viewer zip
The following NEW packages will be installed:
  mc mc-data
0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded.
Need to get 1,659 kB of archives.
After this operation, 6,762 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main mc-data all 3:4.8.13-3 [1,212 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main mc armhf 3:4.8.13-3 [447 kB]
Fetched 1,659 kB in 1s (953 kB/s)
Selecting previously unselected package mc-data.
(Reading database ... 66003 files and directories currently installed.)
Preparing to unpack .../mc-data_3%3a4.8.13-3_all.deb ...
Unpacking mc-data (3:4.8.13-3) ...
Selecting previously unselected package mc.
Preparing to unpack .../mc_3%3a4.8.13-3_armhf.deb ...
Unpacking mc (3:4.8.13-3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for mime-support (3.58) ...
Setting up mc-data (3:4.8.13-3) ...
Setting up mc (3:4.8.13-3) ...

Re: Raspberry Pi: hard realtime Linux/Xenomai

Добавлено: 14 июн 2018, 13:45
Olej
Olej писал(а):Загрузка образа с SD-карточки, откуда образ этот .img брать, и что с ним делать - описано здесь.
Там же описано, что на одних SD-картах RPi грузится, а на других - нет.
Здесь вот есть родное описание RPi SD cards, в нём приведена таблица ... 100 или около того разных SD карт - тестирование.
Некоторые из них непригодны для загрузки RPi.
И дело здесь не в классе SD карты: пригодня некоторые класса 2 и непригодны класса 10.
Это сплошной цирк!

Re: Raspberry Pi: hard realtime Linux/Xenomai

Добавлено: 14 июн 2018, 14:12
Olej
Olej писал(а):
Olej писал(а):Загрузка образа с SD-карточки, откуда образ этот .img брать, и что с ним делать - описано здесь.
Там же описано, что на одних SD-картах RPi грузится, а на других - нет.
Это оттуда:
Olej писал(а):]
Накатал этот образ на SD-карту и пробовал его поднять на Rapsberry Pi 2.
Не могу загрузить.
Причём на точно том же оборудовании какой-то там Raspbian (не я писал SD) грузится "на ура".
Или темнят голландцы что-то ... или нужно ещё как-то пробовать ... может с SD-карточкой что-то не так?
Теперь накатал этот же образ на ту же карту 4Gb (noname & noclass), в 3-й раз! (2 предыдущих кончались обломом), и RPi 2 - грузится!
Вот свежая загрузка (ещё ФС под размер карты не расширил!) и её подключение по SSH (DHCP):

Код: Выделить всё

root@raspberrypi:~ # df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        1679704 1439328    153028  91% /
devtmpfs          473664       0    473664   0% /dev
tmpfs             473896       0    473896   0% /dev/shm
tmpfs             473896   12408    461488   3% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             473896       0    473896   0% /sys/fs/cgroup
/dev/mmcblk0p1     64456   27640     36816  43% /boot

root@raspberrypi:~ # uname -a
Linux raspberrypi 4.1.21-v7+ #4 SMP Sat Jul 15 06:39:14 CEST 2017 armv7l GNU/Linux
Образ: Raspberry Pi image for the Pi zero,1,2,3 with Xenomai 3.0.5 on Raspbian linux 4.1.y Debian 8 jessie

Re: Raspberry Pi: hard realtime Linux/Xenomai

Добавлено: 14 июн 2018, 14:35
Olej
Olej писал(а): Вот свежая загрузка (ещё ФС под размер карты не расширил!) и её подключение по SSH (DHCP):
...
Образ: Raspberry Pi image for the Pi zero,1,2,3 with Xenomai 3.0.5 on Raspbian linux 4.1.y Debian 8 jessie
Специально сразу посмотрел:

Код: Выделить всё

root@raspberrypi:~ # ls -l /dev/rtdm/
total 0
crw------- 1 root root 245, 0 Jun 14 11:18 autotune
crw------- 1 root root 252, 0 Jun 14 11:18 memdev-private
crw------- 1 root root 252, 1 Jun 14 11:18 memdev-shared
crw------- 1 root root 251, 0 Jun 14 11:18 memdev-sys
drwxr-xr-x 2 root root   1100 Jun 14 11:18 pinctrl-bcm2835
crw------- 1 root root 243, 0 Jun 14 11:18 switchtest
crw------- 1 root root 244, 0 Jun 14 11:18 timerbench

root@raspberrypi:~ # ls -l /dev/rtdm/pinctrl-bcm2835
total 0
crw------- 1 root root 239,  0 Jun 14 11:18 gpio0
crw------- 1 root root 239,  1 Jun 14 11:18 gpio1
crw------- 1 root root 239, 10 Jun 14 11:18 gpio10
crw------- 1 root root 239, 11 Jun 14 11:18 gpio11
crw------- 1 root root 239, 12 Jun 14 11:18 gpio12
crw------- 1 root root 239, 13 Jun 14 11:18 gpio13
crw------- 1 root root 239, 14 Jun 14 11:18 gpio14
crw------- 1 root root 239, 15 Jun 14 11:18 gpio15
crw------- 1 root root 239, 16 Jun 14 11:18 gpio16
crw------- 1 root root 239, 17 Jun 14 11:18 gpio17
crw------- 1 root root 239, 18 Jun 14 11:18 gpio18
crw------- 1 root root 239, 19 Jun 14 11:18 gpio19
crw------- 1 root root 239,  2 Jun 14 11:18 gpio2
crw------- 1 root root 239, 20 Jun 14 11:18 gpio20
crw------- 1 root root 239, 21 Jun 14 11:18 gpio21
crw------- 1 root root 239, 22 Jun 14 11:18 gpio22
crw------- 1 root root 239, 23 Jun 14 11:18 gpio23
crw------- 1 root root 239, 24 Jun 14 11:18 gpio24
crw------- 1 root root 239, 25 Jun 14 11:18 gpio25
crw------- 1 root root 239, 26 Jun 14 11:18 gpio26
crw------- 1 root root 239, 27 Jun 14 11:18 gpio27
crw------- 1 root root 239, 28 Jun 14 11:18 gpio28
crw------- 1 root root 239, 29 Jun 14 11:18 gpio29
crw------- 1 root root 239,  3 Jun 14 11:18 gpio3
crw------- 1 root root 239, 30 Jun 14 11:18 gpio30
crw------- 1 root root 239, 31 Jun 14 11:18 gpio31
crw------- 1 root root 239, 32 Jun 14 11:18 gpio32
crw------- 1 root root 239, 33 Jun 14 11:18 gpio33
crw------- 1 root root 239, 34 Jun 14 11:18 gpio34
crw------- 1 root root 239, 35 Jun 14 11:18 gpio35
crw------- 1 root root 239, 36 Jun 14 11:18 gpio36
crw------- 1 root root 239, 37 Jun 14 11:18 gpio37
crw------- 1 root root 239, 38 Jun 14 11:18 gpio38
crw------- 1 root root 239, 39 Jun 14 11:18 gpio39
crw------- 1 root root 239,  4 Jun 14 11:18 gpio4
crw------- 1 root root 239, 40 Jun 14 11:18 gpio40
crw------- 1 root root 239, 41 Jun 14 11:18 gpio41
crw------- 1 root root 239, 42 Jun 14 11:18 gpio42
crw------- 1 root root 239, 43 Jun 14 11:18 gpio43
crw------- 1 root root 239, 44 Jun 14 11:18 gpio44
crw------- 1 root root 239, 45 Jun 14 11:18 gpio45
crw------- 1 root root 239, 46 Jun 14 11:18 gpio46
crw------- 1 root root 239, 47 Jun 14 11:18 gpio47
crw------- 1 root root 239, 48 Jun 14 11:18 gpio48
crw------- 1 root root 239, 49 Jun 14 11:18 gpio49
crw------- 1 root root 239,  5 Jun 14 11:18 gpio5
crw------- 1 root root 239, 50 Jun 14 11:18 gpio50
crw------- 1 root root 239, 51 Jun 14 11:18 gpio51
crw------- 1 root root 239, 52 Jun 14 11:18 gpio52
crw------- 1 root root 239,  6 Jun 14 11:18 gpio6
crw------- 1 root root 239,  7 Jun 14 11:18 gpio7
crw------- 1 root root 239,  8 Jun 14 11:18 gpio8
crw------- 1 root root 239,  9 Jun 14 11:18 gpio9
Это уже говорит что hard realtime Xenomai установлен.
Но и то (предполагаю! :-? ), что realtime драйвер (дополнительный, RTDM модели) для GPIO этой модели - установлен!

Re: Raspberry Pi: hard realtime Linux/Xenomai

Добавлено: 14 июн 2018, 14:38
Olej
Olej писал(а): Вот свежая загрузка (ещё ФС под размер карты не расширил!) и её подключение по SSH (DHCP):
Первейшее действие - расширить /root на весь фактический размер SD карточки:

Код: Выделить всё

root@raspberrypi:~/pi2 # sudo raspi-config --expand-rootfs

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Disk /dev/mmcblk0: 3.7 GiB, 3951034368 bytes, 7716864 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
Disklabel type: dos
Disk identifier: 0xa2d55a34

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk0p1        8192  137215  129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      137216 3618815 3481600  1.7G 83 Linux


Command (m for help): Partition number (1,2, default 2): 
Partition 2 has been deleted.

Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (2048-7716863, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (137216-7716863, default 7716863): 
Created a new partition 2 of type 'Linux' and of size 3.6 GiB.

Command (m for help): Disk /dev/mmcblk0: 3.7 GiB, 3951034368 bytes, 7716864 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
Disklabel type: dos
Disk identifier: 0xa2d55a34

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk0p1        8192  137215  129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      137216 7716863 7579648  3.6G 83 Linux


Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

Please reboot
Всё остальное - потом ... после перезагрузки!

Re: Raspberry Pi: hard realtime Linux/Xenomai

Добавлено: 14 июн 2018, 14:39
Olej
Olej писал(а): Всё остальное - потом ... после перезагрузки!

Код: Выделить всё

root@raspberrypi:~ # df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        3698412 1450448   2101972  41% /
devtmpfs          473664       0    473664   0% /dev
tmpfs             473896       0    473896   0% /dev/shm
tmpfs             473896    6500    467396   2% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             473896       0    473896   0% /sys/fs/cgroup
/dev/mmcblk0p1     64456   27640     36816  43% /boot

Re: Raspberry Pi: hard realtime Linux/Xenomai

Добавлено: 14 июн 2018, 14:43
Olej
I also compiled debian package to install the kernel and its headers on a standard pi image. For the pi1 these are linux-firmware-image-4.1.21-ipipe+_4.1.21-ipipe+-1_armhf.deb and linux-headers-4.1.21-ipipe+_4.1.21-ipipe+-1_armhf.deb. And for the pi2 and pi3 these are linux-firmware-image-4.1.21-v7+_4.1.21-v7+-4_armhf.deb and linux-headers-4.1.21-v7+_4.1.21-v7+-4_armhf.deb.

Код: Выделить всё

root@raspberrypi:~ # cd pi2/

root@raspberrypi:~/pi2 # ls
linux-firmware-image-4.1.21-v7+_4.1.21-v7+-4_armhf.deb  linux-headers-4.1.21-v7+_4.1.21-v7+-4_armhf.deb

root@raspberrypi:~/pi2 # dpkg -i linux-headers-4.1.21-v7+_4.1.21-v7+-4_armhf.deb 
(Reading database ... 66003 files and directories currently installed.)
Preparing to unpack linux-headers-4.1.21-v7+_4.1.21-v7+-4_armhf.deb ...
Unpacking linux-headers-4.1.21-v7+ (4.1.21-v7+-4) over (4.1.21-v7+-4) ...
Setting up linux-headers-4.1.21-v7+ (4.1.21-v7+-4) ...

root@raspberrypi:~/pi2 # dpkg -i linux-firmware-image-4.1.21-v7+_4.1.21-v7+-4_armhf.deb 
Selecting previously unselected package linux-firmware-image-4.1.21-v7+.
(Reading database ... 66003 files and directories currently installed.)
Preparing to unpack linux-firmware-image-4.1.21-v7+_4.1.21-v7+-4_armhf.deb ...
Unpacking linux-firmware-image-4.1.21-v7+ (4.1.21-v7+-4) ...
Setting up linux-firmware-image-4.1.21-v7+ (4.1.21-v7+-4) ...
Первая из этих инсталляций потребует заметного времени...

Код: Выделить всё

root@raspberrypi:~/pi2 # ls /lib/modules/
4.1.21-ipipe+  4.1.21-v7+  4.1.21-v7+__old

root@raspberrypi:~/pi2 # ls /lib/modules/4.1.21-v7+/build/include/
acpi         config  dt-bindings  Kbuild  linux     memory  pcmcia  rxrpc  sound   uapi   xenomai
asm-generic  crypto  generated    keys    math-emu  misc    ras     scsi   target  video
clocksource  drm     ipipe        kvm     media     net     rdma    soc    trace   xen