Portál AbcLinuxu, 26. dubna 2024 05:02


Dotaz: Kompilácia starších zdrojákov.

5.11.2018 18:20 kysučan | skóre: 14
Kompilácia starších zdrojákov.
Přečteno: 2345×
Odpovědět | Admin
Zdravím, mám source code(lincardemu-emulácia smartcard cez rs232) cca z roku 2003. Kompilácia na súčasných distrách (ubuntu,lubuntu) mi vyhadzuje kopec chýb(a warning). Je možné nejakým nenásilnym spôsobom tie zdr. upraviť pre dnešné systémy? Podotýkam, že nie som programátorsky vybavený.
Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

5.11.2018 19:10 MadCatX
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Odpovědět | | Sbalit | Link | Blokovat | Admin
V jakém jazyku je to napsané, v C? Pokud je to napsané slušně, neměl by být problém zdroják z roku 2003 přeložit. Chtělo by samozřejmě vědět, jaké chyby to vyhodí.
5.11.2018 19:52 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Je to napísané v C.
marian@marian-lubuntu:~/lincardemu-0.21a$ make
OSTARGET='UNIX' uname='Linux' date: 20181105
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o main.o main.c
main.c: In function ‘main’:
main.c:773:8: warning: variable ‘fname’ set but not used [-Wunused-but-set-variable]
  char *fname;
        ^
main.c:887:18: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
  strncpy(prompt, curr_CS->system,28);
                  ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/errno.h:28,
                 from debug.h:27,
                 from common.h:22,
                 from main.c:20:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
main.c:913:5: warning: format not a string literal and no format arguments [-Wformat-security]
     scrprint(msg);
     ^
main.c:928:5: warning: format not a string literal and no format arguments [-Wformat-security]
     scrprint(msg);
     ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o command.o command.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o config.o config.c
config.c: In function ‘ConfigSection’:
config.c:148:22: warning: pointer targets in passing argument 1 of ‘StrNoCaseCmp’ differ in signedness [-Wpointer-sign]
     if(!StrNoCaseCmp(LcsConfig[i].system, section)) {
                      ^
In file included from config.c:29:0:
confutil.h:67:5: note: expected ‘const char *’ but argument is of type ‘byte *’
 int StrNoCaseCmp(const char *s1, const char *s2);
     ^
config.c: In function ‘ConfigVarVal’:
config.c:208:22: warning: pointer targets in passing argument 2 of ‘SetU’ differ in signedness [-Wpointer-sign]
       if (!SetU(val, &auto_check, 4, 0, 0, 0x7fffffff)) auto_check=0;
                      ^
In file included from config.c:29:0:
confutil.h:55:5: note: expected ‘unsigned int *’ but argument is of type ‘int *’
 int SetU (char *val,unsigned  *var, unsigned sz, int base,
     ^
config.c:211:22: warning: pointer targets in passing argument 2 of ‘SetU’ differ in signedness [-Wpointer-sign]
       if (!SetU(val, &auto_save, 4, 0, 0, 0x7fffffff)) auto_save=0;
                      ^
In file included from config.c:29:0:
confutil.h:55:5: note: expected ‘unsigned int *’ but argument is of type ‘int *’
 int SetU (char *val,unsigned  *var, unsigned sz, int base,
     ^
config.c: In function ‘build_ATR’:
config.c:410:8: warning: variable ‘TS’ set but not used [-Wunused-but-set-variable]
   byte TS,T0,FI=1,DI=1,II=0,PI1=0,PI2=0, N=0;
        ^
config.c:408:9: warning: variable ‘pTA1’ set but not used [-Wunused-but-set-variable]
   byte *pTA1=NULL;
         ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o std_log.o std_log.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o emu_options.o emu_options.c
ar r lce.a command.o config.o std_log.o emu_options.o
ar: creating lce.a
ranlib lce.a
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o des.o des.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o ec.o ec.c
ec.c: In function ‘log_current_status’:
ec.c:84:15: warning: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Wpointer-sign]
     strcpy(bf,chan->name);
               ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from ec.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:102:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
 ^
ec.c: In function ‘DoEC’:
ec.c:447:30: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
    if (cur_chan) strncpy(msg,cur_chan->labelname,16);
                              ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from ec.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
ec.c:448:39: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
    else if (real_ec.chan) strncpy(msg,real_ec.chan->labelname,16);
                                       ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from ec.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
ec.c:461:20: warning: pointer targets in passing argument 2 of ‘sendbyte_n’ differ in signedness [-Wpointer-sign]
    sendbyte_n(dbg, msg, n);
                    ^
In file included from common.h:63:0,
                 from ec.h:4,
                 from ec.c:9:
serfunc.h:39:5: note: expected ‘byte *’ but argument is of type ‘char *’
 int sendbyte_n(int deb,byte *ch, int n) ;
     ^
ec.c:1129:8: warning: variable ‘key’ set but not used [-Wunused-but-set-variable]
   byte key;
        ^
ec.c:1261:23: warning: variable ‘cp’ set but not used [-Wunused-but-set-variable]
        char txt[60], *cp;
                       ^
ec.c:1408:23: warning: variable ‘cp’ set but not used [-Wunused-but-set-variable]
        char txt[60], *cp;
                       ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o conax.o conax.c
conax.c: In function ‘ChangeConaxSubsystem’:
conax.c:173:32: error: lvalue required as left operand of assignment
       if (v>=0) (int)caselected=in[0];   
                                ^
conax.c: In function ‘ParseECM’:
conax.c:702:10: warning: pointer targets in passing argument 1 of ‘strncpy’ differ in signedness [-Wpointer-sign]
  strncpy(name, buf+i+1, nanolen-1);
          ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
conax.c:702:16: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
  strncpy(name, buf+i+1, nanolen-1);
                ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
conax.c:740:14: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    if(strlen(strb) > 0)
              ^
In file included from conax.c:6:0:
/usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘byte *’
 extern size_t strlen (const char *__s)
               ^
conax.c: In function ‘build_OSD_txt’:
conax.c:855:11: warning: pointer targets in passing argument 1 of ‘strncpy’ differ in signedness [-Wpointer-sign]
   strncpy(OSD_txt+6, txt, l);
           ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
conax.c: In function ‘DoConax’:
conax.c:1322:43: warning: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness [-Wpointer-sign]
               for(i=0; i<64; i++) sprintf(decoded+i*3, "%02X ", demm[i]);
                                           ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/stdio2.h:31:1: note: expected ‘char * __restrict__’ but argument is of type ‘byte *’
 __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
 ^
conax.c:1497:16: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name = tempChannel->name;
                ^
conax.c:1565:13: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    curr_name=cur_chan->name;
             ^
conax.c:1695:15: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name=currch->name;
               ^
conax.c:1781:13: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    curr_name=nagraChannel->name;
             ^
conax.c:1883:16: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name = subc->name;
                ^
conax.c:1885:16: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name = conaxChannel->name;
                ^
conax.c:1969:14: warning: pointer targets in passing argument 1 of ‘SetUL’ differ in signedness [-Wpointer-sign]
    if (SetUL(B2_ins+3,&pin,sz-1,10))
              ^
In file included from conax.c:9:0:
confutil.h:54:5: note: expected ‘char *’ but argument is of type ‘byte *’
 int SetUL(char *val,unsigned long  *var, unsigned sz, int base);
     ^
conax.c:1974:8: warning: format not a string literal and no format arguments [-Wformat-security]
        scrprint(msg);
        ^
conax.c:908:12: warning: variable ‘dbgsend’ set but not used [-Wunused-but-set-variable]
   int dbg, dbgsend;
            ^
conax.c:903:7: warning: variable ‘tempp3’ set but not used [-Wunused-but-set-variable]
   int tempp3 = 0;
       ^
xxxx: recipe for target 'conax.o' failed
make: *** [conax.o] Error 1
zdrojaky sú http://www.streamboard.tv/oscam/ticket/369
5.11.2018 20:05 pc2005 | skóre: 38 | blog: GardenOfEdenConfiguration | liberec
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Hmm takže odpověď na to zda je ten zdroják kvalitní máme :-/.

Ve výpisu je jen jeden error, zbytek není fatální. To neznamená, že to po opravě nechcípne jinde.
conax.c:173:32: error: lvalue required as left operand of assignment
       if (v>=0) (int)caselected=in[0];   
Autor se snaží přiřadit integer číslo do proměnné typu ukazatel. Zkus v tom kódu dát před "caselected" hvězdičku. Nevím ale zda to je to co měl autor na mysli, že chce udělat.

Ostatní chyby jsou takové ty klasické "kašlu na to, funguje to", kdy se používají signed typy v unsigned použití apod.

Jsi si jistý, že neexistuje nějakej modernější soft na komunikaci? Jestli to je z roku 2003, tak to dost možná nemusí být 64bit kompatibilní.
5.11.2018 20:33 Michal Kubeček | skóre: 72 | Luštěnice
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.

Vzhledem k tomu, jak se ta proměnná používá, měl autor spíš na mysli

    if (v >= 0)
        *(int *)&caselected = in[0]

Ale vzhledem k tomu, že proměnná je static a všude se před použitím castuje na int, nevidím důvod, proč je deklarovaná jako pointer. Ono i kdyby se v různých větvích používaly různé typy, tak od toho je union, který existoval už dlouho před rokem 2003.

5.11.2018 21:46 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
if (v>=0) *(int *)&caselected = in[0];
ma byt
if (v>=0) caselected = in[0];
Podla: https://www.comhit.net/archive/index.php?t-32910.html
6.11.2018 07:06 Michal Kubeček | skóre: 72 | Luštěnice
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Technicky to sice - s warningem - projde, ale nic to nemění na skutečnosti, že proměnná, do které se vždy ukládá int a ze které se vždy čte int, má být prostě int, ne pointer.
6.11.2018 17:49 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Ako dakto slavny povedal, C ti umoznuje odstralit nohu.

Este ze obycajne je, ze sizeof (void) >= sizeof(int).
5.11.2018 21:21 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Nič modernejšie public nie je, iba ak .exe aplikácia Fausto, kde to je implementované asi z týchto zdrojákov. Pomohlo
 if (v >= 0)
        *(int *)&caselected = in[0]
potom
marian@marian-lubuntu:~/lincardemu-0.21a$ make
OSTARGET='UNIX' uname='Linux' date: 20181105
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o main.o main.c
main.c: In function ‘main’:
main.c:773:8: warning: variable ‘fname’ set but not used [-Wunused-but-set-variable]
  char *fname;
        ^
main.c:887:18: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
  strncpy(prompt, curr_CS->system,28);
                  ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/errno.h:28,
                 from debug.h:27,
                 from common.h:22,
                 from main.c:20:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
main.c:913:5: warning: format not a string literal and no format arguments [-Wformat-security]
     scrprint(msg);
     ^
main.c:928:5: warning: format not a string literal and no format arguments [-Wformat-security]
     scrprint(msg);
     ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o command.o command.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o config.o config.c
config.c: In function ‘ConfigSection’:
config.c:148:22: warning: pointer targets in passing argument 1 of ‘StrNoCaseCmp’ differ in signedness [-Wpointer-sign]
     if(!StrNoCaseCmp(LcsConfig[i].system, section)) {
                      ^
In file included from config.c:29:0:
confutil.h:67:5: note: expected ‘const char *’ but argument is of type ‘byte *’
 int StrNoCaseCmp(const char *s1, const char *s2);
     ^
config.c: In function ‘ConfigVarVal’:
config.c:208:22: warning: pointer targets in passing argument 2 of ‘SetU’ differ in signedness [-Wpointer-sign]
       if (!SetU(val, &auto_check, 4, 0, 0, 0x7fffffff)) auto_check=0;
                      ^
In file included from config.c:29:0:
confutil.h:55:5: note: expected ‘unsigned int *’ but argument is of type ‘int *’
 int SetU (char *val,unsigned  *var, unsigned sz, int base,
     ^
config.c:211:22: warning: pointer targets in passing argument 2 of ‘SetU’ differ in signedness [-Wpointer-sign]
       if (!SetU(val, &auto_save, 4, 0, 0, 0x7fffffff)) auto_save=0;
                      ^
In file included from config.c:29:0:
confutil.h:55:5: note: expected ‘unsigned int *’ but argument is of type ‘int *’
 int SetU (char *val,unsigned  *var, unsigned sz, int base,
     ^
config.c: In function ‘build_ATR’:
config.c:410:8: warning: variable ‘TS’ set but not used [-Wunused-but-set-variable]
   byte TS,T0,FI=1,DI=1,II=0,PI1=0,PI2=0, N=0;
        ^
config.c:408:9: warning: variable ‘pTA1’ set but not used [-Wunused-but-set-variable]
   byte *pTA1=NULL;
         ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o std_log.o std_log.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o emu_options.o emu_options.c
ar r lce.a command.o config.o std_log.o emu_options.o
ar: creating lce.a
ranlib lce.a
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o des.o des.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o ec.o ec.c
ec.c: In function ‘log_current_status’:
ec.c:84:15: warning: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Wpointer-sign]
     strcpy(bf,chan->name);
               ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from ec.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:102:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
 ^
ec.c: In function ‘DoEC’:
ec.c:447:30: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
    if (cur_chan) strncpy(msg,cur_chan->labelname,16);
                              ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from ec.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
ec.c:448:39: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
    else if (real_ec.chan) strncpy(msg,real_ec.chan->labelname,16);
                                       ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from ec.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
ec.c:461:20: warning: pointer targets in passing argument 2 of ‘sendbyte_n’ differ in signedness [-Wpointer-sign]
    sendbyte_n(dbg, msg, n);
                    ^
In file included from common.h:63:0,
                 from ec.h:4,
                 from ec.c:9:
serfunc.h:39:5: note: expected ‘byte *’ but argument is of type ‘char *’
 int sendbyte_n(int deb,byte *ch, int n) ;
     ^
ec.c:1129:8: warning: variable ‘key’ set but not used [-Wunused-but-set-variable]
   byte key;
        ^
ec.c:1261:23: warning: variable ‘cp’ set but not used [-Wunused-but-set-variable]
        char txt[60], *cp;
                       ^
ec.c:1408:23: warning: variable ‘cp’ set but not used [-Wunused-but-set-variable]
        char txt[60], *cp;
                       ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o conax.o conax.c
conax.c: In function ‘ParseECM’:
conax.c:702:10: warning: pointer targets in passing argument 1 of ‘strncpy’ differ in signedness [-Wpointer-sign]
  strncpy(name, buf+i+1, nanolen-1);
          ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
conax.c:702:16: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
  strncpy(name, buf+i+1, nanolen-1);
                ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
conax.c:740:14: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    if(strlen(strb) > 0)
              ^
In file included from conax.c:6:0:
/usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘byte *’
 extern size_t strlen (const char *__s)
               ^
conax.c: In function ‘build_OSD_txt’:
conax.c:855:11: warning: pointer targets in passing argument 1 of ‘strncpy’ differ in signedness [-Wpointer-sign]
   strncpy(OSD_txt+6, txt, l);
           ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
conax.c: In function ‘DoConax’:
conax.c:1322:43: warning: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness [-Wpointer-sign]
               for(i=0; i<64; i++) sprintf(decoded+i*3, "%02X ", demm[i]);
                                           ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from conax.c:4:
/usr/include/i386-linux-gnu/bits/stdio2.h:31:1: note: expected ‘char * __restrict__’ but argument is of type ‘byte *’
 __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
 ^
conax.c:1497:16: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name = tempChannel->name;
                ^
conax.c:1565:13: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    curr_name=cur_chan->name;
             ^
conax.c:1695:15: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name=currch->name;
               ^
conax.c:1781:13: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    curr_name=nagraChannel->name;
             ^
conax.c:1883:16: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name = subc->name;
                ^
conax.c:1885:16: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
      curr_name = conaxChannel->name;
                ^
conax.c:1969:14: warning: pointer targets in passing argument 1 of ‘SetUL’ differ in signedness [-Wpointer-sign]
    if (SetUL(B2_ins+3,&pin,sz-1,10))
              ^
In file included from conax.c:9:0:
confutil.h:54:5: note: expected ‘char *’ but argument is of type ‘byte *’
 int SetUL(char *val,unsigned long  *var, unsigned sz, int base);
     ^
conax.c:1974:8: warning: format not a string literal and no format arguments [-Wformat-security]
        scrprint(msg);
        ^
conax.c:908:12: warning: variable ‘dbgsend’ set but not used [-Wunused-but-set-variable]
   int dbg, dbgsend;
            ^
conax.c:903:7: warning: variable ‘tempp3’ set but not used [-Wunused-but-set-variable]
   int tempp3 = 0;
       ^
conax.c: In function ‘ChangeConaxSubsystem’:
conax.c:176:22: warning: iteration 6u invokes undefined behavior [-Waggressive-loop-optimizations]
         if (systab[i].sys1) {
                      ^
conax.c:175:7: note: containing loop
       for(i=0; i<...) {
       ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o irdeto.o irdeto.c
irdeto.c: In function ‘DoIrdeto’:
irdeto.c:296:17: warning: pointer targets in initialization differ in signedness [-Wpointer-sign]
    byte *demm = buf+14+8+1;
                 ^
irdeto.c:299:31: warning: pointer targets in passing argument 1 of ‘Nagra_RSADecrypt_SSL_EMM’ differ in signedness [-Wpointer-sign]
      Nagra_RSADecrypt_SSL_EMM(buf+14, (int)buf[12],nagraChannel->b[E11], nagraChannel->b[N11],nagraChannel->b[N12]);
                               ^
In file included from irdeto.c:20:0:
nagra.h:11:13: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 extern void Nagra_RSADecrypt_SSL_EMM(unsigned char* Data, int provid, BIGNUM *e1, BIGNUM *n1, BIGNUM *n2);
             ^
irdeto.c:302:31: warning: pointer targets in passing argument 1 of ‘Nagra_RSADecrypt_SSL_EMM’ differ in signedness [-Wpointer-sign]
      Nagra_RSADecrypt_SSL_EMM(buf+14, (int)buf[12],nagraChannel->b[E11], nagraChannel->b[N11],nagraChannel->b[N22]);
                               ^
In file included from irdeto.c:20:0:
nagra.h:11:13: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 extern void Nagra_RSADecrypt_SSL_EMM(unsigned char* Data, int provid, BIGNUM *e1, BIGNUM *n1, BIGNUM *n2);
             ^
irdeto.c:306:33: warning: pointer targets in passing argument 1 of ‘Nagra_RSADecrypt_SSL_EMM’ differ in signedness [-Wpointer-sign]
        Nagra_RSADecrypt_SSL_EMM(buf+14, (int)buf[12],nagraChannel->b[E31], nagraChannel->b[N31],nagraChannel->b[N32]);
                                 ^
In file included from irdeto.c:20:0:
nagra.h:11:13: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 extern void Nagra_RSADecrypt_SSL_EMM(unsigned char* Data, int provid, BIGNUM *e1, BIGNUM *n1, BIGNUM *n2);
             ^
irdeto.c:314:35: warning: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness [-Wpointer-sign]
      for (i=0; i<64; i++) sprintf(decoded+i*3, "%02X ", demm[i]);
                                   ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from irdeto.c:3:
/usr/include/i386-linux-gnu/bits/stdio2.h:31:1: note: expected ‘char * __restrict__’ but argument is of type ‘byte *’
 __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
 ^
irdeto.c:438:13: warning: variable ‘nw’ set but not used [-Wunused-but-set-variable]
         int nw;
             ^
irdeto.c:211:25: warning: variable ‘camkey_inuse’ set but not used [-Wunused-but-set-variable]
   int i=0,counter=0,x=0,camkey_inuse=0;
                         ^
irdeto.c:207:12: warning: variable ‘dbgsend’ set but not used [-Wunused-but-set-variable]
   int dbg, dbgsend;
            ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o irdeto_v1_algorithm.o irdeto_v1_algorithm.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o seca.o seca.c
seca.c: In function ‘DoSeca’:
seca.c:608:12: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
       tbuf = buf;
            ^
seca.c:618:29: warning: pointer targets in passing argument 2 of ‘mlogprint_buffer’ differ in signedness [-Wpointer-sign]
       mlogprint_buffer(dbg, buf, 0,  counter, "\n\nIndata  :");
                             ^
In file included from common.h:22:0,
                 from config.h:23,
                 from seca.c:5:
debug.h:213:6: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 void mlogprint_buffer(int dbg, unsigned char *buf, int first, int sz,
      ^
seca.c:622:38: warning: pointer targets in passing argument 3 of ‘Seca2decryptEMM’ differ in signedness [-Wpointer-sign]
  int res = Seca2decryptEMM(chan, p2, buf, p3);
                                      ^
In file included from seca.c:10:0:
seca2Algorithm.h:9:5: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 int Seca2decryptEMM(struct Secachannel *ch, unsigned char key_in_use, unsigned char *emm, int len);
     ^
seca.c:634:16: warning: pointer targets in passing argument 3 of ‘SecaDecrypt’ differ in signedness [-Wpointer-sign]
                buf+counter-8);
                ^
In file included from seca.h:5:0,
                 from seca.c:8:
secaAlgorithm.h:7:6: note: expected ‘unsigned char *’ but argument is of type ‘char *’
 void SecaDecrypt(unsigned char *k1, unsigned char *k2, unsigned char *d);
      ^
seca.c: In function ‘log_current_SECA_status’:
seca.c:761:11: warning: variable ‘name’ set but not used [-Wunused-but-set-variable]
     char *name;
           ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o viaccess.o viaccess.c
viaccess.c: In function ‘log_current_status_Viaccess’:
viaccess.c:95:15: warning: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Wpointer-sign]
     strcpy(bf,chan->name);
               ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/string.h:25,
                 from viaccess.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:102:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
 ^
viaccess.c: In function ‘DoViaccess’:
viaccess.c:281:20: warning: pointer targets in passing argument 2 of ‘sendbyte_n’ differ in signedness [-Wpointer-sign]
    sendbyte_n(dbg, provider, p3-6);
                    ^
In file included from common.h:63:0,
                 from config.h:23,
                 from viaccess.c:9:
serfunc.h:39:5: note: expected ‘byte *’ but argument is of type ‘char *’
 int sendbyte_n(int deb,byte *ch, int n) ;
     ^
viaccess.c:354:20: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    if (cur_chan) cp=cur_chan->labelname ;
                    ^
viaccess.c:517:20: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
      strncpy(msg+n,cur_chan->labelname,lsz-n);
                    ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/string.h:25,
                 from viaccess.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘u8 *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
viaccess.c:528:22: warning: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness [-Wpointer-sign]
        strncpy(txt+1,curr_CS->system,4);
                      ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/string.h:25,
                 from viaccess.c:3:
/usr/include/i386-linux-gnu/bits/string3.h:117:1: note: expected ‘const char * __restrict__’ but argument is of type ‘byte *’
 __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
 ^
viaccess.c:541:20: warning: pointer targets in passing argument 2 of ‘sendbyte_n’ differ in signedness [-Wpointer-sign]
    sendbyte_n(dbg, msg, n);
                    ^
In file included from common.h:63:0,
                 from config.h:23,
                 from viaccess.c:9:
serfunc.h:39:5: note: expected ‘byte *’ but argument is of type ‘char *’
 int sendbyte_n(int deb,byte *ch, int n) ;
     ^
viaccess.c:1449:19: warning: variable ‘cp’ set but not used [-Wunused-but-set-variable]
    char txt[60], *cp;
                   ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o tpscrypt.o tpscrypt.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o secaAlgorithm.o secaAlgorithm.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o videoguard.o videoguard.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o ec-s.o ec-s.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o nagra.o nagra.c
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o seca2Algorithm.o seca2Algorithm.c
seca2Algorithm.c: In function ‘Seca2decrypt’:
seca2Algorithm.c:1253:26: warning: variable ‘nanoD2Data’ set but not used [-Wunused-but-set-variable]
     const unsigned char *nanoD2Data=0;
                          ^
seca2Algorithm.c: In function ‘Seca2decryptEMM’:
seca2Algorithm.c:1419:10: warning: variable ‘Mask’ set but not used [-Wunused-but-set-variable]
   void (*Mask)(unsigned short offset, unsigned char *buffer);
          ^
seca2Algorithm.c: At top level:
seca2Algorithm.c:281:22: warning: ‘tabFx1_pol’ defined but not used [-Wunused-variable]
 static unsigned char tabFx1_pol[256] = {
                      ^
seca2Algorithm.c:298:22: warning: ‘tabFx2_pol’ defined but not used [-Wunused-variable]
 static unsigned char tabFx2_pol[256] = {
                      ^
gcc -Wall  -O2 -g  -DUNIX -DUSE_PRIORITY_SCHEDULING -DVERS=\"0.21a\"   -c -o sha.o sha.c
make: *** No rule to make target '6805_cpu.h', needed by 'NagraFxEmu.o'.  Stop.
5.11.2018 21:29 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Ak chces, daj mail, posli zdrojaky a Ti to upravim zajtra a zdrajoaky si nenecham/zmazem.

V makefile by niekde mal zacat riadok NagraFxEmu.o, tak zmaz zavistlost na .h. ten by sa nemal najskor generovat, cize sa proste len vlozi. (ak nie, ak by bolo inak, takto upravime).
5.11.2018 21:31 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Link na zdrojaky máš vyššie...
5.11.2018 21:40 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Uz som nasiel niekde inde na fore.
5.11.2018 21:43 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
pcsat (zavinac) mail (tecka) telekom (tecka) sk
5.11.2018 21:51 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Mas vytvorit prazdny subor v lincardemu-0.21a.

Takze napr.:
touch 6805_cpu.h
Podla: https://www.comhit.net/threads/32910-Funkar-lincardemu
5.11.2018 22:03 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Ok, dík, podľa tvojho odkazu kompilácia prejde...
10.11.2018 15:24 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Odpovědět | | Sbalit | Link | Blokovat | Admin
Helfne mi niekto s úpravou tohto programu?
10.11.2018 20:22 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Co konkretne? ... Ten program mi v pohode prelozilo.
10.11.2018 21:03 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Neviem prečo, nefunguje tam jedna funkcia - ir_CAMencrypt. Ak sa zavolá, tak to ostane visieť.
10.11.2018 22:48 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Skor by som povedal, ze chyba nie je v kode, ale v ovladani zariadenia. Presne neviem. S takym HW skusenosti nemam. ... Nastavoval si podla toho madarskeho linku (tak pisal ako to rozbiehal)?
11.11.2018 06:11 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Skôr by som povedal, že to je švédsky link. Ovládanie zar. je ok. Bez toho camcryptu mi to ide. Ale na tom camcrypte je niečo naprd, aj keď to vyzerá, že je to ok.
void ir_CAMencrypt(unsigned char *a, byte *camkey)
{ 
  char i, j;
  unsigned char t;
  unsigned char xor;
  byte keytemp[8];
  
  memcpy((byte *)keytemp, (byte *)camkey, 8);
    	
for (i = 7; i >= 0; --i) 
{
    for (j = 7; j >= 0; --j)
    {
      xor = a[6];
      xor ^= keytemp[(unsigned char)j];
      xor ^= i;
      xor = ir_table1[xor];
      t = a[7];
      a[7] = a[6];
      a[6] = a[5] ^ xor;
      a[5] = a[4];
      a[4] = a[3];
      a[3] = a[2];
      a[2] = a[1];
      a[1] = a[0];
      a[0] = t ^ xor;
    }
    ir_rotrk(keytemp);
 } 
   
}
myslím, že to mrzne na tých cykloch...
11.11.2018 10:47 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Pozeral som zdrojak, tj. tu funkciu. Ale nie je tam nekonecny cyklus. Je tam nastavenie pamete. Konecny dvojcyklus a xor sa pouziva sifrovanie/encryptonie alebo vypocet kontrolnych suctov a po kazdom vypocte poslane na zaredenie. Nazov funkcie je CAM znaci ir_CAMencrypt. Kluc CAM enkryptuje. Neviem, co presne. Lebo tu oblast IT nepoznam az tak. CAM
11.11.2018 14:06 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Pomohla zmena char i, j; na int i, j;
11.11.2018 14:44 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Zaujimave. Zeby pretecenie? Ale otestoval som , ale neskoncilo mi nekonecnim cyklom. Tj. program sa ukoncil.
/* edited debian+ ir_CAMencrypt from lincardemu (GPLv2) */
#include "stdio.h"
#define byte char
void ir_CAMencrypt(unsigned char *a, byte *camkey)
{ 
  char i, j;
  unsigned char t;
  unsigned char xor;
  byte keytemp[8];
  
  //memcpy((byte *)keytemp, (byte *)camkey, 8);
    	
for (i = 7; i >= 0; --i) 
{
    for (j = 7; j >= 0; --j)
    {
      /*xor = a[6];
      xor ^= keytemp[(unsigned char)j];
      xor ^= i;
      xor = ir_table1[xor];
      t = a[7];
      a[7] = a[6];
      a[6] = a[5] ^ xor;
      a[5] = a[4];
      a[4] = a[3];
      a[3] = a[2];
      a[2] = a[1];
      a[1] = a[0];
      a[0] = t ^ xor;*/
    }
    //ir_rotrk(keytemp);
 } 
   
}

int main(int argc, char **argv)
{
	ir_CAMencrypt(0, NULL);
	return 0;
}

Ale ked pozeram na riadok:
xor ^= i;
tam mohlo pripadne zmenit vypocet kontrolneho suctu a potom nieco nesedelo, ked poslalo, tak to zostalo stat/vysiet. char ma definovanu velkost 1B, ostatne maju iba urceny minimalny rozsah.
11.11.2018 15:29 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Na tej funkcii to proste končilo(nič sa neposielalo). S CRC to nemá nič, ten sa dopočitáva inak(aj keď ešte neviem kde), pre celú ins.
11.11.2018 15:43 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Prave v tej funkcie rata ... Vid nazov encrypt (opak je decrypt). Vid kod, tam exclusiv OR ^ (XOR zapis v C).

A program len tak zamrznut nemohol. Kto vie, aky kod je v ir_rotrk()). Ale to je jedno. Hlavne ze si opravil.

Uz vsetko ide?
11.11.2018 16:24 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Spomínaná funkcia preráta(podľa camkey) 16 bytov plain cws(control words) na encryptovaných 16 bytov cws. Tie sa vložia do ins.(odpoveď karty/season), ku ktorej sa dopočítava 1B crc(signatúra) niekde inde v programe. Ir_rotrk je bitová rotácia a na nej to nepadalo(testované vynechaním funkcie). Problém bol jednoznačne v tom char_e, ale prečo, to musí vysvetliť nejaká múdra hlava.

Fakčí mi to zatial len v usb čítačke ovládanej oscamom, čo je len také testovacie prostr. Cieľom je rozbehať to v hw CAM_e, povedzme aj certifikovanom.

Nateraz to vidím tak, že bude potrebné sa pohrať s resetom a ATR_kom, tak ako to má vyriešené Fausto(windows apl., ktorá disponuje aj touto funkciou), kde po štarte sa čaká na reset(privedené napätie na určitý pin season interface), inak povedané zasunutie karty do CAM(čítačka). Lincardemu posiela ATR po štarte, aj keď je tam aj funkcia manual_reset...Proste ešte bude treba na tom čo porobiť.
11.11.2018 17:21 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Ak to robi chyby a fakt nevies preco, tak je zrejme poskodeny zasobnik (neuvolnanena pamet, nespravne pouzity pointer). Pouzi valgrind.
11.11.2018 18:52 Michal Kubeček | skóre: 72 | Luštěnice
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.

Mohlo by to záležet na tom, jak překladač implementuje typ char. Pokud jako unsigned, bude podmínka "i > 0" automaticky splněná a novější překladače rovnou přeloží cyklus jako nekonečný.

11.11.2018 19:43 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
To by mohlo byť ono, bolo to kompilované na arm_e OPi PC. Aj podľa tejto diskusie.
11.11.2018 20:55 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
To ma napadlo, preto som si vyskusal kod.
11.11.2018 21:21 Michal Kubeček | skóre: 72 | Luštěnice
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Tohle je právě jeden z příkladů, kdy vyzkoušet nestačí, protože chování závisí na překladači. Moje doporučení je:
  • Typ char používat jen tam, kde se jedná čistě o znak a neprovádím žádné aritmetické operace.
  • Pokud dělám cokoli, kde by výsledek mohl záviset na tom, jestli je typ znaménkový nebo ne, explicitně deklarovat jako (un)signed char.
  • Pokud hodnoty nepoužívám jako znaky ale jako osmibitová čísla, použít (u)int8_t.
12.12.2018 12:18 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Odpovědět | | Sbalit | Link | Blokovat | Admin
Potreboval by som ešte helfnúť s týmto programom. Problém spočíva v tom, že pokiaľ ho nespustím cez screen a snažím sa ho spúšťať na pozadí(napr. po štarte systému), tak neúmerne vyťažuje cpu a jeho funkčnosť nie je korektná. Ide o to, že napr. v staršom settoboxe dm500s nič také ako screen nie je(možno by šiel screen pre powerpc skompilovať, ale neviem si to dosť dobre predstaviť).

Ako inak by sa dalo tomu pomôcť? Napadá ma zakomponovanie backround funkcie priamo do programu, ale sám s tým nehnem.

12.12.2018 12:51 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
https://packages.debian.org/jessie/powerpc/screen/download

Akej background funkcie?
12.12.2018 14:24 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Dík za ten screen, ale asi si s tým nepomôžem. Vyžaduje to všeliake knižnice a nie je ich pre nedostatok miesta na flash proste kde uložiť.

Backround funkciou som myslel upraviť zdrojak tak, aby sa program spúšťal na pozadí.

12.12.2018 18:17 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Kolko mas volneho miesta?

Na pozadie, cize spustit ako deamon, tak to sa robi lahko v linuxe. To je v linuxe krasa. Zavolas funkciu deamon(). (toto je striktne nutne) a pripadne este pouzit 2 krat funkciu fork (prvy fork() zbavi vlastnika a druhy skupiny).
13.12.2018 10:39 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
V dm500s je 8MB flash, a dir /var, ktorý je read-write je možno 2MB. Nechceš načrtnúť to s tým deamon/fork?
13.12.2018 21:57 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
V programe pouzivaj absolutne cesty.

Kod mozes pouzit vselijak. Tu mas program.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

#ifndef COUNT_OUT_FILE
 #define COUNT_OUT_FILE 100
#endif

void create_file(char *path)
{
	FILE *file=NULL;
	
	if(path == NULL)
		return;
	file=fopen(path, "w");
	if(file == NULL)
		return;
	fclose(file);
}

int main(int argc, char **argv)
{
	int i;
	char path[200];
	
	if(daemon(1, 1) == -1)
	{
		fputs("Error run program as deamon().\n", stderr);
		return 1;
	}
	
	/* pocka 3 sekundy */
	sleep(3);
	
	/* vytvori COUNT_OUT_FILE praznych suborov v /tmp */
	for(i=1;i<=COUNT_OUT_FILE;i++)
	{
		snprintf(path, 200, "/tmp/files_%02d", i);
		create_file(path);
	}

	return 0;
}
Cez prikaz si mozes overit, ze ma prava vlastnika:
ps aux|grep tmp_deamon
14.12.2018 12:09 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Funkciu daemon volám v main lincardemu. Ale správa sa to stále rovnako - po zavretí terminálu lincardemu síce ostáva spustený, ale začne vyťažovať cpu(90%).

Vyzerá to skôr na nejaký bug v lincardemu.

14.12.2018 12:30 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Inac, chyba, prva parameter deamon pouzivaj 0.

Mali hack. Vytvor deamon, ktory sa cez ssh spusti program ten a bude bezat (ne uzivatel sa prihlasi cez ssh/telnet, ale program spusteni cez telnet).
15.12.2018 21:25 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Cez quazi hack to funguje, ale je to humáč...
15.12.2018 22:29 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
:D
14.12.2018 12:32 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Aku mas velku RAM? Kolko jej volneho miesta?
14.12.2018 12:39 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Ja to teraz testujem na ntb linux-ubuntu(2GB ram), kde sa to správa rovnako ako na tom dreamboxe. Pokiaľ to nespustím so screen_om, tak lincardemu spustený na pozadí neúmerne vyťažuje cpu.
14.12.2018 12:48 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Mna zaujima aku ram mas na tom routry ci co mini pc?
14.12.2018 12:52 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Na dm500s je 32 MB ram.
14.12.2018 12:54 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
a volnej? mas prava roota?
14.12.2018 13:09 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Tam iný užívateľ ako root nie je. Voľnej ram tam určite veľa nie je, keď som s tým včera robil, tak myslím cca 6MB. Nakoniec som tam ten screen nejak narval, ale zbytočne. Začalo to vyhadzovať chybu ohľadom libc.so.6, a to už bolo moc aj na koňa.
14.12.2018 13:13 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Daj vypis:
ldd PATH_TO_SCREEN_BINARY
14.12.2018 13:42 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
ldd: not found
14.12.2018 13:39 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Preloz si screen pre danu platformu. Ale preklad daj static library. To znamena zo vsetkymi kniznicnimi zavistlostam. U mna to je 2.7 MB. Screen mal 1.8MB. GCC C kniznica 1MB.

staicky prekad
14.12.2018 13:50 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Myslíš kompiláciu priamo v dreamboxe?
14.12.2018 14:09 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Tam by to bolo najlepsie. Ale zrejme miesta nemas, tak Ti musi stacit krizovy preklad (Křížový překladač).

P.S.: mozno aj --with-newlib by stacilo, aby sa to do ram zmestilo
14.12.2018 14:23 kysučan | skóre: 14
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
A ktoré zdrojaky screenu sa na to najlepšie hodia, lebo už som to skúšal https://github.com/shyouhei/screen, ale bez úspechu.
14.12.2018 14:28 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Oficialne ...
git clone https://git.savannah.gnu.org/git/screen.git
14.12.2018 14:40 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Normalna preklad
git clone https://git.savannah.gnu.org/git/screen.git
cd git
cd src
./autogen.sh
./configure
make

# spustenie
./screen

# instalacia do systemu (ako root) ... instaluje do /usr/local/bin atd.
# make install
Make instal
15.12.2018 13:57 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Nepodarilo sa mi to nijak spraviť a vzdávam to. Proste skompilovať tmux alebo screen (alebo niečo podobné) pre powerpc je umenie. A s repo tmux(screen) mi to nechodí(libc.so.6 problém). Možno tomu veľa nechýba, ale nateraz, síce(ač) nerád, proste kapitulujem.
15.12.2018 22:45 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
How to compile Hello World program for PowerPC (odpoved)

Najprv si skus prelozit iba hello world.
16.12.2018 08:55 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
To nie je problém. Napokon lincardemu s oldtoolchainom sa preloží bez komplikácií(stačí v makefile nastaviť cestu k powerpc gcc). Lenže screen(tmux) požadoval napr. libevent, alebo libncurses a to už bola pre mňa neprekonateľná prekážka.
16.12.2018 11:05 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Tak si preloz dtach. Odlahcene mini screen. 3 C-ckove zdrojaky. Iba C (tty) prostredie.
$ git clone https://github.com/crigler/dtach
$ cd dtach
$ ./configure
$ make CC="powerpc-linux-gnu-gcc -static"
$ du -h dtach  
724K	dtach

# sputenie program v dtach
# dtach -A PATH_SOCKET COMMAND

# priklad spustenia htop (odkusane)
./dtach -A /tmp/session1 htop
16.12.2018 11:18 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
A pokial si zavrel kartu a chces obnovit okno, tak obnovis:
./dtach -a /tmp/session1
16.12.2018 14:35 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Díky moc za tvoj záujem. Ale asi to budeme musiť vzdať.

Kompilujem to s ppcold toolchainom, pretože s repoz. gcc mi hocijaka kompilácia(lincardemu,hello_word,dtach..), aj keď prebehne ok, spustená aplikácia vyhodí segmentation fault.

A k tomu dtach_u, po chvíľke to spadne:
root@dm500 /var/bin # dtach -A /tmp/session1 lincardemu -r
Got CA ID 0609 from 127.0.0.1 - port 11113
Got CA ID 0624 from 127.0.0.1 - port 11112
*** ATR(16): 3b f7 11 00 01 40 96 54 30 04 0e 6c b6 d6 90 00
*** Warning : ATR(Seca) size mismatch, size=14, should be=14 ***
Build/check ATR(Irdeto) :
 ts:3b t0:9f ta1:21 td1:0e hist.(15): 49 52 44 45 54 4f 20 41 43 53 20 56 36 2e 30
*** ATR(20): 3b 9f 21 0e 49 52 44 45 54 4f 20 41 43 53 20 56 36 2e 30 9e
 fi=2 di=1 ii=0 pi1=0 pi2=0, guardtime N=0
External clk., max fs= 6.000MHz, F=558, D=1.00, max I=25mA, Vpp=0V
Work @  6.000MHz  3.571MHz  4.000MHz
 etu    93000▒s  156250▒s  139500▒s
 bps    10753,     6400      7168 [bits per second]
ATR(Irdeto): direct, BPS=9600, parity=odd
*** ATR(9): 3b 24 00 30 42 30 30 90 00
*** Warning : ATR(Eurocrypt-S) size mismatch, size=7, should be=7 ***
 lincardemu 0.21a 'Eurocrypt, Viaccess, Seca, Irdeto, Conax, VGuard alpha'..
 (C) 2000-2004 The Linux Card Emulator Team
 This program is free software; under the GNU General Public License (GPL)
 Read Copyright.txt or http://www.fsf.org for more information on GPL.
 System:Irdeto Protocol: 9600 8,None,1,Direct COM1,/dev/tts/0
Waiting for reset

ATR sent successfully
!! Signal 0x1 received
saving & shutting down

[EOF - dtach terminating]
16.12.2018 15:18 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Ak Ti ten hack funguje a staci, tak je to ok.

Pri jednom prikaze sa ku static este nieco davalo. Len to neviem najst. Napr. rozne platformu moze na rozne pozicie zarovnavat data v pamete. To by aj presnejsie chcelo vediet typ pamete, resp. dokonca ho mat.

Urcite sa to da, chce to cas (a ci to stoji za to) ...

16.12.2018 17:37 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Tak najmä vďaka debian+ som to nakonie nejak dal. V main.c som vypol EXTRATIMELOOP a s dtach to už nepadá.
16.12.2018 17:51 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Cize dtach si nakoniec pouzil? A ako si na to prisiel, ze prave bol problem EXTRATIMELOOP?

Som rad. Ked si sa uz tolko babral s programovanim, takto nebolo zbytocne.
16.12.2018 18:07 kysučan
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
Metóda P_O (pokus_omyl).

Najskôr som "vypol" v main.c...void sighandler_general(int sv). A nakoniec sa ukázalo, že stačilo vypnúť EXTRAT. (čo ani neviem načo je, možno na automatické save/check files).

16.12.2018 18:16 debian+
Rozbalit Rozbalit vše Re: Kompilácia starších zdrojákov.
v dtach kode to nie je. Ok. Tema uzavreta.

P.S.: A prvy krat som kompiloval pre powerpc.

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.