nedoPC.org

Electronics hobbyists community established in 2002
Atom Feed | View unanswered posts | View active topics It is currently 28 Mar 2024 01:32



Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3  Next
Да, Линух рулит! 
Author Message
Fanat

Joined: 23 Feb 2018 22:20
Posts: 89
Reply with quote
Уважаемые спецы по Линуху!

Как использовать физическую память по заданному адресу / объёму как рамдиск? Интересует для микрокомпьютера

Разработчик советовал драйвер phram, но родная прошивка скомпилена без поддержки модулей ядра и сам драйвер 2004 года использует древние заголовочные файлы под х86, последнее упоминание phram я нашёл в 2015 под ядро 2.6, а микрокомп на арме и ядро у него 3.1

З.Ы. Попытался русскую локаль поставить - потребление памяти дошло до 67%, далее - килл процесс. Иксы столько памяти не жрали, если честно. Почему русские буквы при установке столько памяти жрать должны - для меня загадка.


Attachments:
phram.c [6.32 KiB]
Downloaded 281 times


Last edited by Электромонтёр on 08 Oct 2020 06:07, edited 1 time in total.

04 Oct 2020 10:54
Profile WWW
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22409
Location: Silicon Valley
Reply with quote
Линух на мелкоконтроллерах это совсем другое - надо к авторам железяки обращаться

_________________
:dj: https://mastodon.social/@Shaos


04 Oct 2020 18:15
Profile WWW
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22409
Location: Silicon Valley
Reply with quote
Shaos wrote:
Линух на мелкоконтроллерах это совсем другое - надо к авторам железяки обращаться

Вот например как в физическую память по адресу можно лазить в Petalinux для Zynq (ARM+FPGA):

 peek.c
Code:
/*
* peek utility - for those who remember the good old days!
*
*
* Copyright (C) 2013 - 2016  Xilinx, Inc.  All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in this
* Software without prior written authorization from Xilinx.
*
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>

void usage(char *prog)
{
   printf("usage: %s ADDR\n",prog);
   printf("\n");
   printf("ADDR may be specified as hex values\n");
}


int main(int argc, char *argv[])
{
   int fd;
   void *ptr;
   unsigned addr, page_addr, page_offset;
   unsigned page_size=sysconf(_SC_PAGESIZE);

   if(argc!=2) {
      usage(argv[0]);
      exit(-1);
   }

   fd=open("/dev/mem",O_RDONLY);
   if(fd<1) {
      perror(argv[0]);
      exit(-1);
   }

   addr=strtoul(argv[1],NULL,0);
   page_addr=(addr & ~(page_size-1));
   page_offset=addr-page_addr;

   ptr=mmap(NULL,page_size,PROT_READ,MAP_SHARED,fd,(addr & ~(page_size-1)));
   if((int)ptr==-1) {
      perror(argv[0]);
      exit(-1);
   }

   printf("0x%08x\n",*((unsigned *)(ptr+page_offset)));
   return 0;
}


 poke.c
Code:
/*
* poke utility - for those who remember the good old days!
*

* Copyright (C) 2013 - 2016  Xilinx, Inc.  All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in this
* Software without prior written authorization from Xilinx.
*
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>

void usage(char *prog)
{
   printf("usage: %s ADDR VAL\n",prog);
   printf("\n");
   printf("ADDR and VAL may be specified as hex values\n");
}

int main(int argc, char *argv[])
{
   int fd;
   void *ptr;
   unsigned val;
   unsigned addr, page_addr, page_offset;
   unsigned page_size=sysconf(_SC_PAGESIZE);

   fd=open("/dev/mem",O_RDWR);
   if(fd<1) {
      perror(argv[0]);
      exit(-1);
   }

   if(argc!=3) {
      usage(argv[0]);
      exit(-1);
   }

   addr=strtoul(argv[1],NULL,0);
   val=strtoul(argv[2],NULL,0);

   page_addr=(addr & ~(page_size-1));
   page_offset=addr-page_addr;

   ptr=mmap(NULL,page_size,PROT_READ|PROT_WRITE,MAP_SHARED,fd,(addr & ~(page_size-1)));
   if((int)ptr==-1) {
      perror(argv[0]);
      exit(-1);
   }

   *((unsigned *)(ptr+page_offset))=val;
   return 0;
}

т.е. всё делается через устройство доступа к памяти /dev/mem

_________________
:dj: https://mastodon.social/@Shaos


06 Oct 2020 21:38
Profile WWW
Supreme God
User avatar

Joined: 21 Oct 2009 08:08
Posts: 7777
Location: Россия
Reply with quote
Quote:
В числе известных операционных систем на базе GNU/Linux можно отметить Ubuntu, Debian, Mint, RHEL (CentOS), openSUSE и российский дистрибутив Astra Linux. Несмотря внушительный список дистрибутивов, сам Linux, по статистике StatCounter за июнь 2020 г., занимал не более 1,69% глобального рынка настольных ОС77,68% удерживала Windows, а 17,6-процентная доля принадлежала Apple macOS.
(с) https://www.cnews.ru/news/top/2020-07-06_osnovatel_linux_otoshel_ot

_________________
iLavr


29 Oct 2020 15:12
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22409
Location: Silicon Valley
Reply with quote
Lavr wrote:
Quote:
В числе известных операционных систем на базе GNU/Linux можно отметить Ubuntu, Debian, Mint, RHEL (CentOS), openSUSE и российский дистрибутив Astra Linux. Несмотря внушительный список дистрибутивов, сам Linux, по статистике StatCounter за июнь 2020 г., занимал не более 1,69% глобального рынка настольных ОС77,68% удерживала Windows, а 17,6-процентная доля принадлежала Apple macOS.
(с) https://www.cnews.ru/news/top/2020-07-06_osnovatel_linux_otoshel_ot

Зато он держит 100% топовых серверных систем и бегает на 85% телефонов :mrgreen:
Quote:
In 2019, 100% of the world’s supercomputers run on Linux.
Out of the top 25 websites in the world, only 2 aren’t using Linux.
96.3% of the world’s top 1 million servers run on Linux.
90% of all cloud infrastructure operates on Linux and practically all the best cloud hosts use it.
...
85% of all smartphones are based on Linux.
https://hostingtribunal.com/blog/linux-statistics/

P.S. А вот статистика с гуглоаналитики посещений (уникальных юзеров) nedoPC.org за 2020 год:
Code:
1. Windows  14,908(63.49%)
2. Android   4,901(20.87%)
3. Linux     1,689(7.19%)
4. iOS         898(3.82%)
5. Macintosh   790(3.36%)
7. Chrome OS    15(0.06%)
8. FreeBSD      11(0.05%)
9. Windows Phone 8(0.03%)
10.SymbianOS     5(0.02%)
11.Tizen*        5(0.02%)
12.BlackBerry    3(0.01%)
13.Nokia         3(0.01%)
14.Nintendo WiiU 2(0.01%)
15.OpenBSD       1(0.00%)
16.OS/2          1(0.00%)
17.UNIX          1(0.00%)
* Tizen is a Linux-based mobile operating system backed by the Linux Foundation but developed and used primarily by Samsung Electronics.

P.P.S. Винда далее делится так:
Code:
1. Windows 10       6,697(45.00%)
2. Windows 7        5,393(36.24%)
3. Windows XP       1,568(10.54%)
4. Windows 8.1        668(4.49%)
5. Windows 98         432(2.90%)
6. Windows 8           62(0.42%)
7. Windows Vista       39(0.26%)
8. Windows Server 2003 19(0.13%)
9. Windows (not set)    1(0.01%)
10.Windows CE           1(0.01%)
11.Windows ME           1(0.01%)
т.е. посещения с десктопного линукса примерно сравнимы с посещениями с WinXP :lol:

_________________
:dj: https://mastodon.social/@Shaos


29 Oct 2020 16:12
Profile WWW
Supreme God
User avatar

Joined: 21 Oct 2009 08:08
Posts: 7777
Location: Россия
Reply with quote
Shaos wrote:
Code:
...
3. Windows XP       1,568(10.54%)
4. Windows 8.1        668(4.49%)
5. Windows 98         432(2.90%)
6. Windows 8           62(0.42%)
7. Windows Vista       39(0.26%)
8. Windows Server 2003 19(0.13%)
9. Windows (not set)    1(0.01%)
10.Windows CE           1(0.01%)
11.Windows ME           1(0.01%)
т.е. посещения с десктопного линукса примерно сравнимы с посещениями с WinXP :lol:

Статистика - великая вещь! Надо только верно толковать, что она значит... :wink:
Поскольку с Венды 98 сюда захаживаю только я, то выходит, что с Линуха заходят трое или, возможно, даже двое,
если учесть, что ты заходишь часто...
Следовательно, большинство посещает этот форум с Венды-10... :mrgreen:

_________________
iLavr


29 Oct 2020 17:21
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22409
Location: Silicon Valley
Reply with quote
Lavr wrote:
Поскольку с Венды 98 сюда захаживаю только я...

ненадо недооценивать любовь людей к старине :)
и потом это Users, а не Hits и даже не Sessions, т.е. уникальные пользователи, определяемые куками ;)
Quote:
How users are identified for user metrics

The Users and Active Users metrics show how many users engaged with your site or app.

In order for Google Analytics to determine which traffic belongs to which user, a unique identifier associated with each user is sent with each hit. This identifier can be a single, first-party cookie named _ga that stores a Google Analytics client ID, or you can use the User-ID feature in conjunction with the client ID to more accurately identify users across all the devices they use to access your site or app. For more information on identifiers, read about cookies and user identification in our developer documentation.
https://support.google.com/analytics/answer/2992042?hl=en

P.S. Хотя если ты ходишь с включённым анонимайзером и/или чистишь куки после каждого захода, то тогда таки да - она будет считать только тебя ;)

_________________
:dj: https://mastodon.social/@Shaos


29 Oct 2020 18:21
Profile WWW
Supreme God
User avatar

Joined: 21 Oct 2009 08:08
Posts: 7777
Location: Россия
Reply with quote
Shaos wrote:
Lavr wrote:
Поскольку с Венды 98 сюда захаживаю только я...
ненадо недооценивать любовь людей к старине :)

Да ни в коем случае! Респект и уважуха любителям рЭтро-(как писал один ушлый корифан)-ОС! :kruto:
Поскольку ты все ай-пи видишь, намекни мне как-нибуть в личку - у кого тут ещё Венда-98...

P.S. У меня Опера 9-64 автоматом чистит куки при выключении.

_________________
iLavr


29 Oct 2020 18:37
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22409
Location: Silicon Valley
Reply with quote
Lavr wrote:
У меня Опера 9-64 автоматом чистит куки при выключении.

По опере за тот же период у меня расклад такой:
Code:
1. Opera 9.64         431(19.27%)
2. Opera 36.0.2130.80 129(5.77%)
3. Opera 68.0.3618.125 97(4.34%)
4. Opera 68.0.3618.173 78(3.49%)
5. Opera 70.0.3728.189 68(3.04%)
6. Opera 65.0.3467.78  64(2.86%)
7. Opera 70.0.3728.106 60(2.68%)
8. Opera 67.0.3575.137 53(2.37%)
9. Opera 67.0.3575.115 50(2.24%)
10.Opera 69.0.3686.95  48(2.15%)
так что похоже, что с 98й виндой это таки только ты :roll:

Attachment:
Screenshot from 2020-10-29 18-52-23.png
Screenshot from 2020-10-29 18-52-23.png [ 22.42 KiB | Viewed 5162 times ]

(ну может 432-431=1 раз кто-то ещё зашёл с винды 98 другим браузером)

P.S. Я куки чищу только когда браузер закрываю, а закрываю я его когда сервер ребутается, что случается раз в месяца 3-4 так что по линуксу - реальные юзеры :wink:

_________________
:dj: https://mastodon.social/@Shaos


29 Oct 2020 18:57
Profile WWW
Supreme God
User avatar

Joined: 21 Oct 2009 08:08
Posts: 7777
Location: Россия
Reply with quote
Shaos wrote:
так что похоже, что с 98й виндой это таки только ты :roll:
(ну может 432-431=1 раз кто-то ещё зашёл с винды 98 другим браузером)

Возможно, это тоже я - "зашёл с винды 98 другим браузером", ибо, как и положено Венде-98,
у неё есть штатный ИЕ-5. :lol:
Attachment:
IE5.gif
IE5.gif [ 104.54 KiB | Viewed 5159 times ]

Я его включаю очень редко - проверить: глюк Оперы или провайдер косячит, что редко, но случается.

_________________
iLavr


29 Oct 2020 19:36
Profile
Fanat

Joined: 23 Feb 2018 22:20
Posts: 89
Reply with quote
Подскажите, как подмонтировать ntfs на чтение/запись раздел НЕ используя модули ядра?


05 Nov 2020 07:54
Profile WWW
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22409
Location: Silicon Valley
Reply with quote
давным-давно есть юзерспейс драйвер (через FUSE), насколько я помню - он даже по умолчанию включён в дебияне

Code:
ntfs-3g 2016.2.22AR.1 integrated FUSE 28 - Third Generation NTFS Driver
                Configuration type 7, XATTRS are on, POSIX ACLS are on

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2016 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage:    ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

News, support and information:  http://tuxera.com

_________________
:dj: https://mastodon.social/@Shaos


05 Nov 2020 11:03
Profile WWW
Fanat

Joined: 23 Feb 2018 22:20
Posts: 89
Reply with quote
ntfs-3g через fuse не годится, оно требует поддержки модулей ядра.


05 Nov 2020 14:36
Profile WWW
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22409
Location: Silicon Valley
Reply with quote
Электромонтёр wrote:
ntfs-3g через fuse не годится, оно требует поддержки модулей ядра.

ну fuse вроде в ядре по умолчанию, нет?

_________________
:dj: https://mastodon.social/@Shaos


05 Nov 2020 16:17
Profile WWW
Fanat

Joined: 23 Feb 2018 22:20
Posts: 89
Reply with quote
fuse у меня не работает. Производителем заявлено отсутствие поддержки модулей ядра в образе. при попытке запустить ntfs-3g, modprobe fuse ругается нецензурными словами. Дособрать и скомпилить поддержку ядра никак. Только пересборка прошивки.


05 Nov 2020 22:10
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 44 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.