<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.natea.ro/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nicu</id>
	<title>Random Stuff - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.natea.ro/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nicu"/>
	<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php/Special:Contributions/Nicu"/>
	<updated>2026-11-19T07:58:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=File:Small_pcb.png&amp;diff=66</id>
		<title>File:Small pcb.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=File:Small_pcb.png&amp;diff=66"/>
		<updated>2021-08-24T20:20:39Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Aura_Led_Cube&amp;diff=65</id>
		<title>Aura Led Cube</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Aura_Led_Cube&amp;diff=65"/>
		<updated>2021-08-24T20:20:18Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Materiale legate de cubul folosit de noi:&lt;br /&gt;
https://www.instructables.com/AuraCube-8x8x8-Compelete-Assembly-Guide/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Noi in proiectul nostru tintim sa inlocuim urmatoarea placuta:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:small_pcb.png|Small PCB]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pentru a face asta, trebuie sa vedem cum putem folosi:&lt;br /&gt;
 A0&lt;br /&gt;
 A1&lt;br /&gt;
 A2&lt;br /&gt;
 DatA&lt;br /&gt;
 DatB&lt;br /&gt;
 OE&lt;br /&gt;
 CLK&lt;br /&gt;
 ST&lt;br /&gt;
&lt;br /&gt;
Nu vom conecta 5V si GND, pt ca raspbery-ul o sa fie alimentat dintr-o alta sursa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pentru a face asta o sa ne bazam pe datasheetul cubului curent si sursele folosite pt STM&lt;br /&gt;
--------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Example of using the datasheet:&lt;br /&gt;
&lt;br /&gt;
DataSheet PCB:&lt;br /&gt;
https://drive.google.com/open?id=1TpA1zuHrZGRsxQEAUC7ePYAQedIoSKEg&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Asa ca daca urmarim big_pcb.pdf la 74HC138: demux, avem ca input A0, A1, A2 pe care le folosim ca sa activam una dintre iesirile: yang1, yang2, ... yang8&lt;br /&gt;
&lt;br /&gt;
Apoi daca va uitati la: U13, U14, U15, U16, avem folosit yang1, yang2, ... yang8 pt a selecta intre rgb1, rgb2, ... rgb8.&lt;br /&gt;
&lt;br /&gt;
De aici concluzia ca rgb1/rgb2/...rgb8, reprezinta anodurile corespunzatoare unui layer, unde printr-un layer intelegem un rand complet de 8 x 8 leduri. &lt;br /&gt;
daca avem o matrice: Leds[8][8][8], atunci:&lt;br /&gt;
 randul 1 contine Leds[0][?][?], &lt;br /&gt;
 randul 2 contine Leds[1][?][?], &lt;br /&gt;
 etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
More info on the hardware:&lt;br /&gt;
&lt;br /&gt;
Shift registers - o sa vedem mai jos de ce:&lt;br /&gt;
   https://en.wikipedia.org/wiki/Shift_register&lt;br /&gt;
&lt;br /&gt;
74HC138 - 3 la 8 demultiplexer -&lt;br /&gt;
   https://pdf1.alldatasheet.com/datasheet-pdf/view/15535/PHILIPS/74HC138.html&lt;br /&gt;
   https://www.youtube.com/watch?v=1UKsOYXAO8E&lt;br /&gt;
&lt;br /&gt;
74HC245&lt;br /&gt;
   https://pdf1.alldatasheet.com/datasheet-pdf/view/15572/PHILIPS/74HC245.html&lt;br /&gt;
   https://www.youtube.com/watch?v=F1aoDN2N128&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------------&lt;br /&gt;
Example of using the sources:&lt;br /&gt;
&lt;br /&gt;
Surse STM:&lt;br /&gt;
   https://drive.google.com/open?id=1JqKoayEv9wA4e-NlURtmIAhMU3aZBSkS&lt;br /&gt;
&lt;br /&gt;
Fisiere de interes:&lt;br /&gt;
    ./USER/src/stm32f10x_it.c  =&amp;gt; TIM2_IRQHandler&lt;br /&gt;
    ./USER/src/LED.c           =&amp;gt; Send_Data &lt;br /&gt;
    ./USER/inc/LED.h           =&amp;gt; pini pe care intentionam sa-i folosim, pe care trebuie sa-i cautam in cod pt a intelege mecanismul: rgb_OE_SET / rgb_ST_SET / rgb_CLK_SET / rgb_DAT_B_SET / rgb_DAT_A_SET / HC138_A_SET / HC138_B_SET / HC138_C_SET /.... _reset&lt;br /&gt;
&lt;br /&gt;
Basic idea:&lt;br /&gt;
Avem un timer activat periodic[TIM2_IRQHandler], care selecteaza si actualizeaza un layer (Send_Data: 8 randuri x 8 coloane x 3 culori = 192 valori)&lt;br /&gt;
&lt;br /&gt;
Selectia layer-ului se face pe baza lui A0, A1, A2. Aditional se dezactiveaza output-ul pe perioada configurarii folosind OE, si se reactiveaza la final pana la urmatorul trigger al timer-ului.&lt;br /&gt;
Presupunerea mea legata de codul din Send_Data e ca avem doua seturi de shift_registers legate in serie.&lt;br /&gt;
Folosim DatA si DatB ca sa indicam ce biti vrem sa shiftam in cele doua seturi, si folosim CLK ca sa generam push'ul. Imagine the shift register a std::queue of bits corresponding to each color of each led. Fiecare bit indica daca culoarea corespunzatoare ledului este sau nu este activa.&lt;br /&gt;
Deci in momentul asta avem 96 de intrari bagate in fiecare set.&lt;br /&gt;
&lt;br /&gt;
Functia Send_data primeste ca parametru:&lt;br /&gt;
&lt;br /&gt;
1. numarul layer'ului pe care lucram, ca sa stie ce valoare sa verifice in matricea corespunzatoare tuturor ledurilor.&lt;br /&gt;
&lt;br /&gt;
2. bit'ul pe care vrem sa il verificam in intrarea corespunzatoare asocierii dintre un led si o culoare. Ne da intensitatea. In principiu Send_Data va fi apelata de mai multe ori pt a stabili culoarea unui led.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Aura_Led_Cube&amp;diff=64</id>
		<title>Aura Led Cube</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Aura_Led_Cube&amp;diff=64"/>
		<updated>2021-08-24T19:24:01Z</updated>

		<summary type="html">&lt;p&gt;Nicu: Created page with &amp;quot;Materiale legate de cubul folosit de noi: https://www.instructables.com/AuraCube-8x8x8-Compelete-Assembly-Guide/   ------------------------------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Materiale legate de cubul folosit de noi:&lt;br /&gt;
https://www.instructables.com/AuraCube-8x8x8-Compelete-Assembly-Guide/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Noi in proiectul nostru tintim sa inlocuim urmatoarea placuta:&lt;br /&gt;
&lt;br /&gt;
https://content.instructables.com/ORIG/FBS/DNJR/J960NW59/FBSDNJRJ960NW59.jpg?auto=webp&amp;amp;frame=1&amp;amp;width=1024&amp;amp;height=1024&amp;amp;fit=bounds&amp;amp;md=dc53a247266d177d9e274c0f27c9dbb9&lt;br /&gt;
&lt;br /&gt;
Pentru a face asta, trebuie sa vedem cum putem folosi: A0, A1, A2, DataA, DataB, OE, CLK, ST.&lt;br /&gt;
Nu vom conecta 5V si GND, pt ca raspbery-ul o sa fie alimentat dintr-o alta sursa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pentru a face asta o sa ne bazam pe datasheetul cubului curent si sursele folosite pt STM&lt;br /&gt;
--------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Example of using the datasheet:&lt;br /&gt;
&lt;br /&gt;
DataSheet PCB:&lt;br /&gt;
https://drive.google.com/open?id=1TpA1zuHrZGRsxQEAUC7ePYAQedIoSKEg&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Asa ca daca urmarim big_pcb.pdf la 74HC138: demux, avem ca input A0, A1, A2 pe care le folosim ca sa activam una dintre iesirile: yang1, yang2, ... yang8&lt;br /&gt;
&lt;br /&gt;
Apoi daca va uitati la: U13, U14, U15, U16, avem folosit yang1, yang2, ... yang8 pt a selecta intre rgb1, rgb2, ... rgb8.&lt;br /&gt;
&lt;br /&gt;
De aici concluzia ca rgb1/rgb2/...rgb8, reprezinta anodurile corespunzatoare unui layer, unde printr-un layer intelegem un rand complet de 8 x 8 leduri. &lt;br /&gt;
daca avem o matrice: Leds[8][8][8], atunci:&lt;br /&gt;
 randul 1 contine Leds[0][?][?], &lt;br /&gt;
 randul 2 contine Leds[1][?][?], &lt;br /&gt;
 etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
More info on the hardware:&lt;br /&gt;
&lt;br /&gt;
Shift registers - o sa vedem mai jos de ce:&lt;br /&gt;
   https://en.wikipedia.org/wiki/Shift_register&lt;br /&gt;
&lt;br /&gt;
74HC138 - 3 la 8 demultiplexer -&lt;br /&gt;
   https://pdf1.alldatasheet.com/datasheet-pdf/view/15535/PHILIPS/74HC138.html&lt;br /&gt;
   https://www.youtube.com/watch?v=1UKsOYXAO8E&lt;br /&gt;
&lt;br /&gt;
74HC245&lt;br /&gt;
   https://pdf1.alldatasheet.com/datasheet-pdf/view/15572/PHILIPS/74HC245.html&lt;br /&gt;
   https://www.youtube.com/watch?v=F1aoDN2N128&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------------&lt;br /&gt;
Example of using the sources:&lt;br /&gt;
&lt;br /&gt;
Surse STM:&lt;br /&gt;
   https://drive.google.com/open?id=1JqKoayEv9wA4e-NlURtmIAhMU3aZBSkS&lt;br /&gt;
&lt;br /&gt;
Fisiere de interes:&lt;br /&gt;
    ./USER/src/stm32f10x_it.c  =&amp;gt; TIM2_IRQHandler&lt;br /&gt;
    ./USER/src/LED.c           =&amp;gt; Send_Data &lt;br /&gt;
    ./USER/inc/LED.h           =&amp;gt; pini pe care intentionam sa-i folosim, pe care trebuie sa-i cautam in cod pt a intelege mecanismul: rgb_OE_SET / rgb_ST_SET / rgb_CLK_SET / rgb_DAT_B_SET / rgb_DAT_A_SET / HC138_A_SET / HC138_B_SET / HC138_C_SET /.... _reset&lt;br /&gt;
&lt;br /&gt;
Basic idea:&lt;br /&gt;
Avem un timer activat periodic[TIM2_IRQHandler], care selecteaza si actualizeaza un layer (Send_Data: 8 randuri x 8 coloane x 3 culori = 192 valori)&lt;br /&gt;
&lt;br /&gt;
Selectia layer-ului se face pe baza lui A0, A1, A2. Aditional se dezactiveaza output-ul pe perioada configurarii folosind OE, si se reactiveaza la final pana la urmatorul trigger al timer-ului.&lt;br /&gt;
Presupunerea mea legata de codul din Send_Data e ca avem doua seturi de shift_registers legate in serie.&lt;br /&gt;
Folosim DatA si DatB ca sa indicam ce biti vrem sa shiftam in cele doua seturi, si folosim CLK ca sa generam push'ul. Imagine the shift register a std::queue of bits coresponding to each color of each led. Fiecare bit indica daca culoarea corespunzatoare ledului este sau nu este activa.&lt;br /&gt;
Deci in momentul asta avem 96 de intrari bagate in fiecare set.&lt;br /&gt;
&lt;br /&gt;
Functia Send_data primeste ca parametru:&lt;br /&gt;
 - numarul layer'ului pe care lucram, ca sa stie ce valoare sa verifice in matricea corespunzatoare tuturor ledurilor.&lt;br /&gt;
 - bit'ul pe care vrem sa il verificam in intrarea corespunzatoare asocierii dintre un led si o culoare. Ne da intensitatea&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=63</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=63"/>
		<updated>2021-08-24T19:23:24Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/C%2B%2B_Rampup C++ Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Generic_application Generic application]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Linux_Rampup Linux Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Docker Docker]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Test_driven_development TDD]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Debugging Debugging]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Raspberry Raspberry]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Aura_Led_Cube Aura Led Cube]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=62</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=62"/>
		<updated>2021-08-24T19:22:46Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/C%2B%2B_Rampup C++ Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Generic_application Generic application]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Linux_Rampup Linux Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Docker Docker]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Test_driven_development TDD]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Debugging Debugging]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Raspberry Raspberry]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Aura Led Cube]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=61</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=61"/>
		<updated>2021-07-28T20:43:14Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* Control GPIO’s */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configuration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image onto the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the sdcard in the raspberry and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
Outputing a signal&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
----------------------------------&lt;br /&gt;
&lt;br /&gt;
Reading a signal&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;23&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 23 as an input&lt;br /&gt;
 echo &amp;quot;in&amp;quot; &amp;gt; /sys/class/gpio/gpio23/direction&lt;br /&gt;
&lt;br /&gt;
 # Set interrupt on rising edge for pin 23&lt;br /&gt;
 echo &amp;quot;rising&amp;quot; &amp;gt; /sys/class/gpio/gpio23/edge&lt;br /&gt;
&lt;br /&gt;
 # Read the state of pin 23&lt;br /&gt;
 cat /sys/class/gpio/gpio23/value&lt;br /&gt;
&lt;br /&gt;
 # Invert the value&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio23/active_low&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other pins to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.10.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.10.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Playing with layers and recipes =&lt;br /&gt;
=== Lazy way to set a static ip for a yocto image ===&lt;br /&gt;
We could edit the files we've fetched directly:&lt;br /&gt;
&lt;br /&gt;
For example in `sources/poky/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces`&lt;br /&gt;
&lt;br /&gt;
and replace:&lt;br /&gt;
 iface eth0 inet dhcp&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
   address 192.168.10.2&lt;br /&gt;
   netmask 255.255.255.0&lt;br /&gt;
   network 192.168.10.0&lt;br /&gt;
   gateway 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
It's lazy because we are editing the actual source files that we do not own, so if we want to switch to a different version of poky(maybe because it supports a new kernel or has support for some special apps), we would have to fetch the new version wich does not have our changes so we would need to reapply them manually, and that is not pleasant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A better way ===&lt;br /&gt;
A smarter way is to create a new layer, that would normally just enhance some existing recipes.&lt;br /&gt;
&lt;br /&gt;
A layer is basically a collection of recipes, and is applied over existing layers based on a priority. (kind of a short description ... )&lt;br /&gt;
&lt;br /&gt;
A recipe is a set of rules by which a component is fetched(could be from git), built and finally packaged and installed on the image.&lt;br /&gt;
&lt;br /&gt;
==== Creating a layer ====&lt;br /&gt;
As an example, lets create a new layer called `meta-aurora`.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming we've sourced our environment `. sources/poky/oe-init-build-env` and we are in the build folder, we'll simply run the command:&lt;br /&gt;
 bitbake-layers create-layer --priority 25 ../sources/meta-aurora&lt;br /&gt;
This layer shall have an assigned priority that is higher than the poky, openembedded and raspberry layers, because we want to add new feature to recipes in those layers(`applied over`).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After running the command a new folder should have been crated in `../sources/meta-aurora` with a sample recipe.&lt;br /&gt;
Within a layer folder we have a file `/conf/layer.conf` which gives us hints of the priority of the layer and where it loads recipes from(`BBFILES`)&lt;br /&gt;
&lt;br /&gt;
 BBFILES += &amp;quot;${LAYERDIR}/recipes-*/*/*.bb \&lt;br /&gt;
             ${LAYERDIR}/recipes-*/*/*.bbappend&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Normally, we might just want to change the behavior of an existing component, by adding a custom configuration file. For this we would normally create a *.bbappend file that simply adds some additional steps to build a recipe.&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the static ip change we could also create a git *.patch file that would be applied when configuring the component. More on that later .... much later.&lt;br /&gt;
&lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
Let's say we want to add a dhcp server. A dhcp server basically has some rules by which it can assign an ip to devices that connect to it. In our case, we'll be connecting the PC to the raspberryPi directly through an ethernet cable without a router in between. So, we want the PC to be assigned an IP address in the same subnet as the raspberry.&lt;br /&gt;
&lt;br /&gt;
A recipe that provides a dhcp server in the `hardknott` version of poky is `kea`. To add it to the image we would need to update our local.conf file from `build/conf/local.conf` and simply append to it:&lt;br /&gt;
&lt;br /&gt;
  IMAGE_INSTALL_append = &amp;quot; kea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now if we were to build the image `bitbake core-image-full-cmdline` we would have a dhcp server running with some default configuration, assigning IP addresses in a range that we might not like, so we would like to create a custom configuration file. =&amp;gt; we enhance the recipe adding a bbappend file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First let's add our layer to the image search path by updating build/conf/bblayers.conf: conf/bblayers.conf and add to the end of BBLAYERS&lt;br /&gt;
  ${TOPDIR}/../sources/meta-aurora \&lt;br /&gt;
&lt;br /&gt;
Note: We could use a command to do this like: &amp;quot;bitbake-layers add-layer ../sources/meta-aurora&amp;quot;, but it adds an absolute path and we won't want that in the future.&lt;br /&gt;
&lt;br /&gt;
==== Creating our first recipe ====&lt;br /&gt;
&lt;br /&gt;
Next, in `sources/meta-aurora` we'll create a new folder `recipes-conectivity` in which we'll add yet another folder which has the same name as the recipe we want to enhance.&lt;br /&gt;
ie. kea (we've chosen these names because kea may be found in `sources/poky/meta/recipes-connectivity/kea`, however that's not mandatory. What's important is the name of the recipe - *bb or *bbappend)&lt;br /&gt;
In this folder we would create a file named: kea_%.bbappend&lt;br /&gt;
&lt;br /&gt;
The % indicates a wildcard indicating that this bbappend file applies to kea for whatever version. If we'd want the bbappend to apply only to a particular version we'd be more explicit. For example: `kea_1.8.2.bbappend`. But since we're adding a config file, it's likely it will work even on future versions of the component. Worst case, in a degraded mode or without some features active.&lt;br /&gt;
&lt;br /&gt;
Sidenote: you could have multiple versions of a recipe, in your environment in different layers. You could explicitly specify the one which you want to pick, or leave yocto to choose the latest one. (too much info)&lt;br /&gt;
&lt;br /&gt;
Anyway, we would add to the `kea_%.bbappend` file the following content:&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS_prepend := &amp;quot;${THISDIR}/${PN}:&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 SRC_URI += &amp;quot;file://kea-dhcp4.conf&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 do_install_append() { &lt;br /&gt;
     install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS will indicate that we want to add some extra paths to the location in yocto is looking for files that we might reference later.&lt;br /&gt;
 _prepend indicates that we want to add the path at the begining of the list in which it searches for files. We want to add it at the begining because once it finds a file, it stops the search. ... and the search is in the order of: FILESEXTRAPATHS&lt;br /&gt;
 ${THISDIR} refers to the directory of the recipe&lt;br /&gt;
 ${PN} refers to the project name, which is the name of the bb/bbappend file, so 'kea'. We could also have ${PV} which would be project version. etc.&lt;br /&gt;
 the ':' at the end is required because the paths in FILESEXTRAPATHS are separated by ':'&lt;br /&gt;
 ${THISDIR}/${PN} would refer in our case to `sources/meta-aurora/recipes-connectivity/kea/kea/`&lt;br /&gt;
 SRC_URI indicates a file we want copied to the current working directory. (will be referenced later)&lt;br /&gt;
 &amp;quot;file://&amp;quot; indicates we're referencing a file from FILESEXTRAPATHS. but that could just as well be git:// if we want yocto to fetch the sources from an external repository&lt;br /&gt;
 do_install refers to what happens in the build step. We have an additional `_append` here because we don't want to overwrite the recipes existing do_install script, we just want to add some additional steps.&lt;br /&gt;
 install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf =&amp;gt; basically copy from the working directory the file we've indicated through SRC_URI to '${sysconfdir}' which on the image coresponds to the `/etc` folder ... so /etc/kea/kea-dhcp4.conf. Obviously, 644 is the access mode for the new file on the device.&lt;br /&gt;
&lt;br /&gt;
The next step is to add the actual config file we want copied onto the device. To be in tune with the above file we will create:&lt;br /&gt;
 sources/meta-aurora/recipes-connectivity/kea/kea/kea-dhcp4.conf&lt;br /&gt;
&lt;br /&gt;
It's up to you to set the appropriate contents of this file.&lt;br /&gt;
&lt;br /&gt;
You could build the image with 'kea' enabled but without our special bbappend and connect to the device, copy the contents of `/etc/kea/kea-dhcp4.conf` and just tweak that file however you want .... and after, rebuild the image again, flash and check that whatever you added works as intended. (Or cheat by copying the file from another image)&lt;br /&gt;
&lt;br /&gt;
Build and flash ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Additional things to do:&lt;br /&gt;
 check out a better wiki: https://docs.yoctoproject.org/&lt;br /&gt;
 run the steps mentioned above&lt;br /&gt;
 install an additional application to the image: ex. a simpler text editor: nano&lt;br /&gt;
 create a recipe that installs one of your scripts in /usr/bin so you may run it without giving the path to it.&lt;br /&gt;
 create a new recipe from a git repository and include it your own image (see the usage of https://docs.yoctoproject.org/singleindex.html#term-SRC_URI ) - maybe we could come back to this once we make our own apps&lt;br /&gt;
 to be updated ...&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=60</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=60"/>
		<updated>2021-07-28T20:42:30Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* Control GPIO’s */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configuration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image onto the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the sdcard in the raspberry and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
----------------------------------&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;23&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 23 as an input&lt;br /&gt;
 echo &amp;quot;in&amp;quot; &amp;gt; /sys/class/gpio/gpio23/direction&lt;br /&gt;
&lt;br /&gt;
 # Set interrupt on rising edge for pin 23&lt;br /&gt;
 echo &amp;quot;rising&amp;quot; &amp;gt; /sys/class/gpio/gpio23/edge&lt;br /&gt;
&lt;br /&gt;
 # Read the state of pin 23&lt;br /&gt;
 cat /sys/class/gpio/gpio23/value&lt;br /&gt;
&lt;br /&gt;
 # Invert the value&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio23/active_low&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other pins to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.10.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.10.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Playing with layers and recipes =&lt;br /&gt;
=== Lazy way to set a static ip for a yocto image ===&lt;br /&gt;
We could edit the files we've fetched directly:&lt;br /&gt;
&lt;br /&gt;
For example in `sources/poky/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces`&lt;br /&gt;
&lt;br /&gt;
and replace:&lt;br /&gt;
 iface eth0 inet dhcp&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
   address 192.168.10.2&lt;br /&gt;
   netmask 255.255.255.0&lt;br /&gt;
   network 192.168.10.0&lt;br /&gt;
   gateway 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
It's lazy because we are editing the actual source files that we do not own, so if we want to switch to a different version of poky(maybe because it supports a new kernel or has support for some special apps), we would have to fetch the new version wich does not have our changes so we would need to reapply them manually, and that is not pleasant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A better way ===&lt;br /&gt;
A smarter way is to create a new layer, that would normally just enhance some existing recipes.&lt;br /&gt;
&lt;br /&gt;
A layer is basically a collection of recipes, and is applied over existing layers based on a priority. (kind of a short description ... )&lt;br /&gt;
&lt;br /&gt;
A recipe is a set of rules by which a component is fetched(could be from git), built and finally packaged and installed on the image.&lt;br /&gt;
&lt;br /&gt;
==== Creating a layer ====&lt;br /&gt;
As an example, lets create a new layer called `meta-aurora`.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming we've sourced our environment `. sources/poky/oe-init-build-env` and we are in the build folder, we'll simply run the command:&lt;br /&gt;
 bitbake-layers create-layer --priority 25 ../sources/meta-aurora&lt;br /&gt;
This layer shall have an assigned priority that is higher than the poky, openembedded and raspberry layers, because we want to add new feature to recipes in those layers(`applied over`).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After running the command a new folder should have been crated in `../sources/meta-aurora` with a sample recipe.&lt;br /&gt;
Within a layer folder we have a file `/conf/layer.conf` which gives us hints of the priority of the layer and where it loads recipes from(`BBFILES`)&lt;br /&gt;
&lt;br /&gt;
 BBFILES += &amp;quot;${LAYERDIR}/recipes-*/*/*.bb \&lt;br /&gt;
             ${LAYERDIR}/recipes-*/*/*.bbappend&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Normally, we might just want to change the behavior of an existing component, by adding a custom configuration file. For this we would normally create a *.bbappend file that simply adds some additional steps to build a recipe.&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the static ip change we could also create a git *.patch file that would be applied when configuring the component. More on that later .... much later.&lt;br /&gt;
&lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
Let's say we want to add a dhcp server. A dhcp server basically has some rules by which it can assign an ip to devices that connect to it. In our case, we'll be connecting the PC to the raspberryPi directly through an ethernet cable without a router in between. So, we want the PC to be assigned an IP address in the same subnet as the raspberry.&lt;br /&gt;
&lt;br /&gt;
A recipe that provides a dhcp server in the `hardknott` version of poky is `kea`. To add it to the image we would need to update our local.conf file from `build/conf/local.conf` and simply append to it:&lt;br /&gt;
&lt;br /&gt;
  IMAGE_INSTALL_append = &amp;quot; kea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now if we were to build the image `bitbake core-image-full-cmdline` we would have a dhcp server running with some default configuration, assigning IP addresses in a range that we might not like, so we would like to create a custom configuration file. =&amp;gt; we enhance the recipe adding a bbappend file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First let's add our layer to the image search path by updating build/conf/bblayers.conf: conf/bblayers.conf and add to the end of BBLAYERS&lt;br /&gt;
  ${TOPDIR}/../sources/meta-aurora \&lt;br /&gt;
&lt;br /&gt;
Note: We could use a command to do this like: &amp;quot;bitbake-layers add-layer ../sources/meta-aurora&amp;quot;, but it adds an absolute path and we won't want that in the future.&lt;br /&gt;
&lt;br /&gt;
==== Creating our first recipe ====&lt;br /&gt;
&lt;br /&gt;
Next, in `sources/meta-aurora` we'll create a new folder `recipes-conectivity` in which we'll add yet another folder which has the same name as the recipe we want to enhance.&lt;br /&gt;
ie. kea (we've chosen these names because kea may be found in `sources/poky/meta/recipes-connectivity/kea`, however that's not mandatory. What's important is the name of the recipe - *bb or *bbappend)&lt;br /&gt;
In this folder we would create a file named: kea_%.bbappend&lt;br /&gt;
&lt;br /&gt;
The % indicates a wildcard indicating that this bbappend file applies to kea for whatever version. If we'd want the bbappend to apply only to a particular version we'd be more explicit. For example: `kea_1.8.2.bbappend`. But since we're adding a config file, it's likely it will work even on future versions of the component. Worst case, in a degraded mode or without some features active.&lt;br /&gt;
&lt;br /&gt;
Sidenote: you could have multiple versions of a recipe, in your environment in different layers. You could explicitly specify the one which you want to pick, or leave yocto to choose the latest one. (too much info)&lt;br /&gt;
&lt;br /&gt;
Anyway, we would add to the `kea_%.bbappend` file the following content:&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS_prepend := &amp;quot;${THISDIR}/${PN}:&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 SRC_URI += &amp;quot;file://kea-dhcp4.conf&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 do_install_append() { &lt;br /&gt;
     install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS will indicate that we want to add some extra paths to the location in yocto is looking for files that we might reference later.&lt;br /&gt;
 _prepend indicates that we want to add the path at the begining of the list in which it searches for files. We want to add it at the begining because once it finds a file, it stops the search. ... and the search is in the order of: FILESEXTRAPATHS&lt;br /&gt;
 ${THISDIR} refers to the directory of the recipe&lt;br /&gt;
 ${PN} refers to the project name, which is the name of the bb/bbappend file, so 'kea'. We could also have ${PV} which would be project version. etc.&lt;br /&gt;
 the ':' at the end is required because the paths in FILESEXTRAPATHS are separated by ':'&lt;br /&gt;
 ${THISDIR}/${PN} would refer in our case to `sources/meta-aurora/recipes-connectivity/kea/kea/`&lt;br /&gt;
 SRC_URI indicates a file we want copied to the current working directory. (will be referenced later)&lt;br /&gt;
 &amp;quot;file://&amp;quot; indicates we're referencing a file from FILESEXTRAPATHS. but that could just as well be git:// if we want yocto to fetch the sources from an external repository&lt;br /&gt;
 do_install refers to what happens in the build step. We have an additional `_append` here because we don't want to overwrite the recipes existing do_install script, we just want to add some additional steps.&lt;br /&gt;
 install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf =&amp;gt; basically copy from the working directory the file we've indicated through SRC_URI to '${sysconfdir}' which on the image coresponds to the `/etc` folder ... so /etc/kea/kea-dhcp4.conf. Obviously, 644 is the access mode for the new file on the device.&lt;br /&gt;
&lt;br /&gt;
The next step is to add the actual config file we want copied onto the device. To be in tune with the above file we will create:&lt;br /&gt;
 sources/meta-aurora/recipes-connectivity/kea/kea/kea-dhcp4.conf&lt;br /&gt;
&lt;br /&gt;
It's up to you to set the appropriate contents of this file.&lt;br /&gt;
&lt;br /&gt;
You could build the image with 'kea' enabled but without our special bbappend and connect to the device, copy the contents of `/etc/kea/kea-dhcp4.conf` and just tweak that file however you want .... and after, rebuild the image again, flash and check that whatever you added works as intended. (Or cheat by copying the file from another image)&lt;br /&gt;
&lt;br /&gt;
Build and flash ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Additional things to do:&lt;br /&gt;
 check out a better wiki: https://docs.yoctoproject.org/&lt;br /&gt;
 run the steps mentioned above&lt;br /&gt;
 install an additional application to the image: ex. a simpler text editor: nano&lt;br /&gt;
 create a recipe that installs one of your scripts in /usr/bin so you may run it without giving the path to it.&lt;br /&gt;
 create a new recipe from a git repository and include it your own image (see the usage of https://docs.yoctoproject.org/singleindex.html#term-SRC_URI ) - maybe we could come back to this once we make our own apps&lt;br /&gt;
 to be updated ...&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=59</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=59"/>
		<updated>2021-07-27T05:44:55Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configuration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image onto the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the sdcard in the raspberry and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other pins to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.10.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.10.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Playing with layers and recipes =&lt;br /&gt;
=== Lazy way to set a static ip for a yocto image ===&lt;br /&gt;
We could edit the files we've fetched directly:&lt;br /&gt;
&lt;br /&gt;
For example in `sources/poky/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces`&lt;br /&gt;
&lt;br /&gt;
and replace:&lt;br /&gt;
 iface eth0 inet dhcp&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
   address 192.168.10.2&lt;br /&gt;
   netmask 255.255.255.0&lt;br /&gt;
   network 192.168.10.0&lt;br /&gt;
   gateway 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
It's lazy because we are editing the actual source files that we do not own, so if we want to switch to a different version of poky(maybe because it supports a new kernel or has support for some special apps), we would have to fetch the new version wich does not have our changes so we would need to reapply them manually, and that is not pleasant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A better way ===&lt;br /&gt;
A smarter way is to create a new layer, that would normally just enhance some existing recipes.&lt;br /&gt;
&lt;br /&gt;
A layer is basically a collection of recipes, and is applied over existing layers based on a priority. (kind of a short description ... )&lt;br /&gt;
&lt;br /&gt;
A recipe is a set of rules by which a component is fetched(could be from git), built and finally packaged and installed on the image.&lt;br /&gt;
&lt;br /&gt;
==== Creating a layer ====&lt;br /&gt;
As an example, lets create a new layer called `meta-aurora`.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming we've sourced our environment `. sources/poky/oe-init-build-env` and we are in the build folder, we'll simply run the command:&lt;br /&gt;
 bitbake-layers create-layer --priority 25 ../sources/meta-aurora&lt;br /&gt;
This layer shall have an assigned priority that is higher than the poky, openembedded and raspberry layers, because we want to add new feature to recipes in those layers(`applied over`).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After running the command a new folder should have been crated in `../sources/meta-aurora` with a sample recipe.&lt;br /&gt;
Within a layer folder we have a file `/conf/layer.conf` which gives us hints of the priority of the layer and where it loads recipes from(`BBFILES`)&lt;br /&gt;
&lt;br /&gt;
 BBFILES += &amp;quot;${LAYERDIR}/recipes-*/*/*.bb \&lt;br /&gt;
             ${LAYERDIR}/recipes-*/*/*.bbappend&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Normally, we might just want to change the behavior of an existing component, by adding a custom configuration file. For this we would normally create a *.bbappend file that simply adds some additional steps to build a recipe.&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the static ip change we could also create a git *.patch file that would be applied when configuring the component. More on that later .... much later.&lt;br /&gt;
&lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
Let's say we want to add a dhcp server. A dhcp server basically has some rules by which it can assign an ip to devices that connect to it. In our case, we'll be connecting the PC to the raspberryPi directly through an ethernet cable without a router in between. So, we want the PC to be assigned an IP address in the same subnet as the raspberry.&lt;br /&gt;
&lt;br /&gt;
A recipe that provides a dhcp server in the `hardknott` version of poky is `kea`. To add it to the image we would need to update our local.conf file from `build/conf/local.conf` and simply append to it:&lt;br /&gt;
&lt;br /&gt;
  IMAGE_INSTALL_append = &amp;quot; kea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now if we were to build the image `bitbake core-image-full-cmdline` we would have a dhcp server running with some default configuration, assigning IP addresses in a range that we might not like, so we would like to create a custom configuration file. =&amp;gt; we enhance the recipe adding a bbappend file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First let's add our layer to the image search path by updating build/conf/bblayers.conf: conf/bblayers.conf and add to the end of BBLAYERS&lt;br /&gt;
  ${TOPDIR}/../sources/meta-aurora \&lt;br /&gt;
&lt;br /&gt;
Note: We could use a command to do this like: &amp;quot;bitbake-layers add-layer ../sources/meta-aurora&amp;quot;, but it adds an absolute path and we won't want that in the future.&lt;br /&gt;
&lt;br /&gt;
==== Creating our first recipe ====&lt;br /&gt;
&lt;br /&gt;
Next, in `sources/meta-aurora` we'll create a new folder `recipes-conectivity` in which we'll add yet another folder which has the same name as the recipe we want to enhance.&lt;br /&gt;
ie. kea (we've chosen these names because kea may be found in `sources/poky/meta/recipes-connectivity/kea`, however that's not mandatory. What's important is the name of the recipe - *bb or *bbappend)&lt;br /&gt;
In this folder we would create a file named: kea_%.bbappend&lt;br /&gt;
&lt;br /&gt;
The % indicates a wildcard indicating that this bbappend file applies to kea for whatever version. If we'd want the bbappend to apply only to a particular version we'd be more explicit. For example: `kea_1.8.2.bbappend`. But since we're adding a config file, it's likely it will work even on future versions of the component. Worst case, in a degraded mode or without some features active.&lt;br /&gt;
&lt;br /&gt;
Sidenote: you could have multiple versions of a recipe, in your environment in different layers. You could explicitly specify the one which you want to pick, or leave yocto to choose the latest one. (too much info)&lt;br /&gt;
&lt;br /&gt;
Anyway, we would add to the `kea_%.bbappend` file the following content:&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS_prepend := &amp;quot;${THISDIR}/${PN}:&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 SRC_URI += &amp;quot;file://kea-dhcp4.conf&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 do_install_append() { &lt;br /&gt;
     install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS will indicate that we want to add some extra paths to the location in yocto is looking for files that we might reference later.&lt;br /&gt;
 _prepend indicates that we want to add the path at the begining of the list in which it searches for files. We want to add it at the begining because once it finds a file, it stops the search. ... and the search is in the order of: FILESEXTRAPATHS&lt;br /&gt;
 ${THISDIR} refers to the directory of the recipe&lt;br /&gt;
 ${PN} refers to the project name, which is the name of the bb/bbappend file, so 'kea'. We could also have ${PV} which would be project version. etc.&lt;br /&gt;
 the ':' at the end is required because the paths in FILESEXTRAPATHS are separated by ':'&lt;br /&gt;
 ${THISDIR}/${PN} would refer in our case to `sources/meta-aurora/recipes-connectivity/kea/kea/`&lt;br /&gt;
 SRC_URI indicates a file we want copied to the current working directory. (will be referenced later)&lt;br /&gt;
 &amp;quot;file://&amp;quot; indicates we're referencing a file from FILESEXTRAPATHS. but that could just as well be git:// if we want yocto to fetch the sources from an external repository&lt;br /&gt;
 do_install refers to what happens in the build step. We have an additional `_append` here because we don't want to overwrite the recipes existing do_install script, we just want to add some additional steps.&lt;br /&gt;
 install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf =&amp;gt; basically copy from the working directory the file we've indicated through SRC_URI to '${sysconfdir}' which on the image coresponds to the `/etc` folder ... so /etc/kea/kea-dhcp4.conf. Obviously, 644 is the access mode for the new file on the device.&lt;br /&gt;
&lt;br /&gt;
The next step is to add the actual config file we want copied onto the device. To be in tune with the above file we will create:&lt;br /&gt;
 sources/meta-aurora/recipes-connectivity/kea/kea/kea-dhcp4.conf&lt;br /&gt;
&lt;br /&gt;
It's up to you to set the appropriate contents of this file.&lt;br /&gt;
&lt;br /&gt;
You could build the image with 'kea' enabled but without our special bbappend and connect to the device, copy the contents of `/etc/kea/kea-dhcp4.conf` and just tweak that file however you want .... and after, rebuild the image again, flash and check that whatever you added works as intended. (Or cheat by copying the file from another image)&lt;br /&gt;
&lt;br /&gt;
Build and flash ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Additional things to do:&lt;br /&gt;
 check out a better wiki: https://docs.yoctoproject.org/&lt;br /&gt;
 run the steps mentioned above&lt;br /&gt;
 install an additional application to the image: ex. a simpler text editor: nano&lt;br /&gt;
 create a recipe that installs one of your scripts in /usr/bin so you may run it without giving the path to it.&lt;br /&gt;
 create a new recipe from a git repository and include it your own image (see the usage of https://docs.yoctoproject.org/singleindex.html#term-SRC_URI ) - maybe we could come back to this once we make our own apps&lt;br /&gt;
 to be updated ...&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=58</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=58"/>
		<updated>2021-07-26T20:59:58Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* Playing with layers and recipes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configuration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image onto the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the sdcard in the raspberry and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other pins to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.0.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.0.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Playing with layers and recipes =&lt;br /&gt;
=== Lazy way to set a static ip for a yocto image ===&lt;br /&gt;
We could edit the files we've fetched directly:&lt;br /&gt;
&lt;br /&gt;
For example in `sources/poky/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces`&lt;br /&gt;
&lt;br /&gt;
and replace:&lt;br /&gt;
 iface eth0 inet dhcp&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
   address 192.168.10.2&lt;br /&gt;
   netmask 255.255.255.0&lt;br /&gt;
   network 192.168.10.0&lt;br /&gt;
   gateway 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
It's lazy because we are editing the actual source files that we do not own, so if we want to switch to a different version of poky(maybe because it supports a new kernel or has support for some special apps), we would have to fetch the new version wich does not have our changes so we would need to reapply them manually, and that is not pleasant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A better way ===&lt;br /&gt;
A smarter way is to create a new layer, that would normally just enhance some existing recipes.&lt;br /&gt;
&lt;br /&gt;
A layer is basically a collection of recipes, and is applied over existing layers based on a priority. (kind of a short description ... )&lt;br /&gt;
&lt;br /&gt;
A recipe is a set of rules by which a component is fetched(could be from git), built and finally packaged and installed on the image.&lt;br /&gt;
&lt;br /&gt;
==== Creating a layer ====&lt;br /&gt;
As an example, lets create a new layer called `meta-aurora`.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming we've sourced our environment `. sources/poky/oe-init-build-env` and we are in the build folder, we'll simply run the command:&lt;br /&gt;
 bitbake-layers create-layer --priority 25 ../sources/meta-aurora&lt;br /&gt;
This layer shall have an assigned priority that is higher than the poky, openembedded and raspberry layers, because we want to add new feature to recipes in those layers(`applied over`).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After running the command a new folder should have been crated in `../sources/meta-aurora` with a sample recipe.&lt;br /&gt;
Within a layer folder we have a file `/conf/layer.conf` which gives us hints of the priority of the layer and where it loads recipes from(`BBFILES`)&lt;br /&gt;
&lt;br /&gt;
 BBFILES += &amp;quot;${LAYERDIR}/recipes-*/*/*.bb \&lt;br /&gt;
             ${LAYERDIR}/recipes-*/*/*.bbappend&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Normally, we might just want to change the behavior of an existing component, by adding a custom configuration file. For this we would normally create a *.bbappend file that simply adds some additional steps to build a recipe.&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the static ip change we could also create a git *.patch file that would be applied when configuring the component. More on that later .... much later.&lt;br /&gt;
&lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
Let's say we want to add a dhcp server. A dhcp server basically has some rules by which it can assign an ip to devices that connect to it. In our case, we'll be connecting the PC to the raspberryPi directly through an ethernet cable without a router in between. So, we want the PC to be assigned an IP address in the same subnet as the raspberry.&lt;br /&gt;
&lt;br /&gt;
A recipe that provides a dhcp server in the `hardknott` version of poky is `kea`. To add it to the image we would need to update our local.conf file from `build/conf/local.conf` and simply append to it:&lt;br /&gt;
&lt;br /&gt;
  IMAGE_INSTALL_append = &amp;quot; kea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now if we were to build the image `bitbake core-image-full-cmdline` we would have a dhcp server running with some default configuration, assigning IP addresses in a range that we might not like, so we would like to create a custom configuration file. =&amp;gt; we enhance the recipe adding a bbappend file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First let's add our layer to the image search path by updating build/conf/bblayers.conf: conf/bblayers.conf and add to the end of BBLAYERS&lt;br /&gt;
  ${TOPDIR}/../sources/meta-aurora \&lt;br /&gt;
&lt;br /&gt;
Note: We could use a command to do this like: &amp;quot;bitbake-layers add-layer ../sources/meta-aurora&amp;quot;, but it adds an absolute path and we won't want that in the future.&lt;br /&gt;
&lt;br /&gt;
==== Creating our first recipe ====&lt;br /&gt;
&lt;br /&gt;
Next, in `sources/meta-aurora` we'll create a new folder `recipes-conectivity` in which we'll add yet another folder which has the same name as the recipe we want to enhance.&lt;br /&gt;
ie. kea (we've chosen these names because kea may be found in `sources/poky/meta/recipes-connectivity/kea`, however that's not mandatory. What's important is the name of the recipe - *bb or *bbappend)&lt;br /&gt;
In this folder we would create a file named: kea_%.bbappend&lt;br /&gt;
&lt;br /&gt;
The % indicates a wildcard indicating that this bbappend file applies to kea for whatever version. If we'd want the bbappend to apply only to a particular version we'd be more explicit. For example: `kea_1.8.2.bbappend`. But since we're adding a config file, it's likely it will work even on future versions of the component. Worst case, in a degraded mode or without some features active.&lt;br /&gt;
&lt;br /&gt;
Sidenote: you could have multiple versions of a recipe, in your environment in different layers. You could explicitly specify the one which you want to pick, or leave yocto to choose the latest one. (too much info)&lt;br /&gt;
&lt;br /&gt;
Anyway, we would add to the `kea_%.bbappend` file the following content:&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS_prepend := &amp;quot;${THISDIR}/${PN}:&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 SRC_URI += &amp;quot;file://kea-dhcp4.conf&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 do_install_append() { &lt;br /&gt;
     install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS will indicate that we want to add some extra paths to the location in yocto is looking for files that we might reference later.&lt;br /&gt;
 _prepend indicates that we want to add the path at the begining of the list in which it searches for files. We want to add it at the begining because once it finds a file, it stops the search. ... and the search is in the order of: FILESEXTRAPATHS&lt;br /&gt;
 ${THISDIR} refers to the directory of the recipe&lt;br /&gt;
 ${PN} refers to the project name, which is the name of the bb/bbappend file, so 'kea'. We could also have ${PV} which would be project version. etc.&lt;br /&gt;
 the ':' at the end is required because the paths in FILESEXTRAPATHS are separated by ':'&lt;br /&gt;
 ${THISDIR}/${PN} would refer in our case to `sources/meta-aurora/recipes-connectivity/kea/kea/`&lt;br /&gt;
 SRC_URI indicates a file we want copied to the current working directory. (will be referenced later)&lt;br /&gt;
 &amp;quot;file://&amp;quot; indicates we're referencing a file from FILESEXTRAPATHS. but that could just as well be git:// if we want yocto to fetch the sources from an external repository&lt;br /&gt;
 do_install refers to what happens in the build step. We have an additional `_append` here because we don't want to overwrite the recipes existing do_install script, we just want to add some additional steps.&lt;br /&gt;
 install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf =&amp;gt; basically copy from the working directory the file we've indicated through SRC_URI to '${sysconfdir}' which on the image coresponds to the `/etc` folder ... so /etc/kea/kea-dhcp4.conf. si evident, 644 e modul de access pt noul fisier.&lt;br /&gt;
&lt;br /&gt;
The next step is to add the actual config file we want copied onto the device. To be in tune with the above file we will create:&lt;br /&gt;
 sources/meta-aurora/recipes-connectivity/kea/kea/kea-dhcp4.conf&lt;br /&gt;
&lt;br /&gt;
It's up to you to set the appropriate contents of this file.&lt;br /&gt;
&lt;br /&gt;
You could build the image with 'kea' enabled but without our special bbappend and connect to the device, copy the contents of `/etc/kea/kea-dhcp4.conf` and just tweak that file however you want .... and after, rebuild the image again, flash and check that whatever you added works as intended. (Or cheat by copying the file from another image)&lt;br /&gt;
&lt;br /&gt;
Build and flash ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Additional things to do:&lt;br /&gt;
 check out a better wiki: https://docs.yoctoproject.org/&lt;br /&gt;
 run the steps mentioned above&lt;br /&gt;
 install an additional application to the image: ex. a simpler text editor: nano&lt;br /&gt;
 create a recipe that installs one of your scripts in /usr/bin so you may run it without giving the path to it.&lt;br /&gt;
 create a new recipe from a git repository and include it your own image (see the usage of https://docs.yoctoproject.org/singleindex.html#term-SRC_URI ) - maybe we could come back to this once we make our own apps&lt;br /&gt;
 to be updated ...&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=57</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=57"/>
		<updated>2021-07-26T20:35:59Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configuration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image onto the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the sdcard in the raspberry and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other pins to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.0.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.0.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Playing with layers and recipes =&lt;br /&gt;
Lazy way to set a static ip for a yocto image&lt;br /&gt;
We could edit the files we've fetched directly:&lt;br /&gt;
For example in `sources/poky/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces`&lt;br /&gt;
&lt;br /&gt;
and replace:&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
iface eth0 inet dhcp static&lt;br /&gt;
	address 192.168.10.2&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	network 192.168.10.0&lt;br /&gt;
	gateway 192.168.10.1&lt;br /&gt;
&lt;br /&gt;
It's lazy because we are editing the actual source files that we do not own, so if we want to switch to a different version of poky(maybe because it supports a new kernel or has support for some special apps), we would have to fetch the new version wich does not have our changes so we would need to reapply them manually, and that is not pleasent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A smarter way is to create a new layer, that would normally just enhance some existing recipes.&lt;br /&gt;
A layer is basically a collection of recipes, and is applied over existing layers based on a priority.&lt;br /&gt;
(kind of a short description ... )&lt;br /&gt;
A recipe is a set of rules by which a component is fetched(could be from git), built and finally packaged and installed on the image.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As an example, lets create a new layer called `meta-aurora`.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming we've sourced our environment `. sources/poky/oe-init-build-env` and we are in the build folder, we'll simply run the command:&lt;br /&gt;
bitbake-layers create-layer --priority 25 ../sources/meta-aurora&lt;br /&gt;
This layer shall have an assigned priority that is higher than the poky, openembedded and raspberry layers, because we want to add new feature to recipes in those layers(`applied over`).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After running the command a new folder should have been crated in `../sources/meta-aurora` with a sample recipe.&lt;br /&gt;
Within a layer folder we have a file `/conf/layer.conf` which gives us hints of the priority of the layer and where it loads recipes from(`BBFILES`)&lt;br /&gt;
&lt;br /&gt;
 BBFILES += &amp;quot;${LAYERDIR}/recipes-*/*/*.bb \&lt;br /&gt;
             ${LAYERDIR}/recipes-*/*/*.bbappend&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Normally, we might just want to change the behaviour of an existing component, by adding a custom configuration file. For this we would normally create a bbappend file that simply adds some additional steps to build a recipe.&lt;br /&gt;
Alternatively, for the static ip change we could also create a git *.patch file that would be applied when configuring the component. More on that later .... much later.&lt;br /&gt;
&lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
Let's say we want to add a dhcp server. A dhcp server basically has some rules by which it can assign an ip to devices that connect to it. In our case, we'll be connecting the pc to the raspberryPi directly through an ethernet cable without a router in between, so we want the pc to be assigned an ip address in the same subnet as the raspberry.&lt;br /&gt;
&lt;br /&gt;
A recipe that provides a dhcp server in the `hardknott` version of poky is `kea`, so to add it to the image we would need to update our local.conf file from `build/conf/local.conf` and simply applend to it:&lt;br /&gt;
&lt;br /&gt;
  IMAGE_INSTALL_append = &amp;quot; kea&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now if we were to build the image `bitbake core-image-full-cmdline` we would have a dhcp server running with some default configuration, assigning ip addresses in a range that we might not like, so we would like to create a custom configuration file. =&amp;gt; we enhance the recipe adding a bbappend file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First let's add our layer to the image build search path by updating build/conf/bblayers.conf: conf/bblayers.conf and add to the end of BBLAYERS&lt;br /&gt;
  ${TOPDIR}/../sources/meta-aurora \&lt;br /&gt;
&lt;br /&gt;
Note: We could use a command to do this like: &amp;quot;bitbake-layers add-layer ../sources/meta-aurora&amp;quot;, but it adds an absolute path and we don't want that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, in `sources/meta-aurora` we'll create a new folder `recipes-conectivity` in which we'll add yet another folder which has the same name as the recipe we want to enhance. ie. kea (we've chosen these names because kea may be found in `sources/poky/meta/recipes-connectivity/kea`, however that's not mandatory, what's important is the name of the recipe - *bb or *bbappend)&lt;br /&gt;
In this folder we would create a file named: kea_%.bbappend&lt;br /&gt;
&lt;br /&gt;
The % indicates a wildcard indicating that this bbappend file applies to kea for whatever version. If we'd want the bbappend to apply only to a particular version we'd be more explicit. For example: `kea_1.8.2.bbappend`. But since we're adding a config file, it's likely it will work even on future versions of the component, worst case in a degraded mode or without some features active.&lt;br /&gt;
&lt;br /&gt;
Sidenote: you could have multiple versions of a recipe, in your environment. You could explicitly specify the one which you want to pick, or leave yocto to choose the latest one. (too much info)&lt;br /&gt;
&lt;br /&gt;
Anyway, we would add to the `kea_%.bbappend` file the following content:&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS_prepend := &amp;quot;${THISDIR}/${PN}:&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 SRC_URI += &amp;quot;file://kea-dhcp4.conf&amp;quot; &lt;br /&gt;
 &lt;br /&gt;
 do_install_append() { &lt;br /&gt;
     install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 FILESEXTRAPATHS will indicate that we want to add some extra paths to the location in yocto is looking for files that we might reference later.&lt;br /&gt;
 _prepend indicates that we want to add the path at the begining of the list in which it searches for files. We want to add it at the begining because once it finds a file, it stops the search. ... and the search is in the order of: FILESEXTRAPATHS&lt;br /&gt;
 ${THISDIR} refers to the directory of the recipe&lt;br /&gt;
 ${PN} refers to the project name, which is the name of the bb/bbappend file, so 'kea'. We could also have ${PV} which would be project version. etc.&lt;br /&gt;
 the ':' at the end is required because the paths in FILESEXTRAPATHS are separated by ':'&lt;br /&gt;
 ${THISDIR}/${PN} would refer in our case to `sources/meta-aurora/recipes-connectivity/kea/kea/`&lt;br /&gt;
 SRC_URI indicates a file we want copied to the current working directory. (will be referenced later)&lt;br /&gt;
 &amp;quot;file://&amp;quot; indicates we're referencing a file from FILESEXTRAPATHS. but that could just as well be git:// if we want yocto to fetch the sources from an external repository&lt;br /&gt;
 do_install refers to what happens in the build step. We have an additional `_append` here because we don't want to overwrite the recipes existing do_install script, we just want to add some additional steps.&lt;br /&gt;
 install -m 644 ${WORKDIR}/kea-dhcp4.conf ${D}${sysconfdir}/kea/kea-dhcp4.conf =&amp;gt; basically copy from the working directory the file we've indicated through SRC_URI to '${sysconfdir}' which on the image coresponds to the `/etc` folder ... so /etc/kea/kea-dhcp4.conf&lt;br /&gt;
&lt;br /&gt;
The next step is to add the actual config file we want copied onto the device. To be in tune with the above file we will create:&lt;br /&gt;
sources/meta-aurora/recipes-connectivity/kea/kea/kea-dhcp4.conf&lt;br /&gt;
&lt;br /&gt;
It's up to you to set the appropriate content of this file.&lt;br /&gt;
You could build the image with 'kea' enabled but without our special bbappend and connect to the device, copy the contents of `/etc/kea/kea-dhcp4.conf` and just tweak that file however you want .... and after rebuild the image, flash and check that whatever you added works as intended. (Or cheat by copying the file from another image)&lt;br /&gt;
&lt;br /&gt;
Build and flash ....&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=56</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=56"/>
		<updated>2021-07-23T14:56:59Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Instalare docker=&lt;br /&gt;
 Windows: https://www.docker.com/get-started&lt;br /&gt;
 Alta distributie: https://docs.docker.com/engine/install/debian/&lt;br /&gt;
&lt;br /&gt;
'''Note:''' docker are nevoie de hyper-v, asa ca e posibil sa creeze un conflict cu ceva ce se bazeaza ca acesta sa fie dezactivat(ex. virtualbox) =&amp;gt; any thoughts of getting around it are appreciated.&lt;br /&gt;
&lt;br /&gt;
=Ganduri zburdalnice pe Linux=&lt;br /&gt;
Ca sa puteti rulati docker ca si utilizator normal:&lt;br /&gt;
  sudo usermod -aG docker ${USER}&lt;br /&gt;
  restart / logout&lt;br /&gt;
&lt;br /&gt;
Ca sa porneasca automat:&lt;br /&gt;
  sudo systemctl enable docker&lt;br /&gt;
  sudo systemctl start docker&lt;br /&gt;
&lt;br /&gt;
Ca sa nu salveze imaginile si restul de fisiere pe partitia de sistem:&lt;br /&gt;
  sudo service docker stop&lt;br /&gt;
  sudo gedit /etc/docker/daemon.json&lt;br /&gt;
&lt;br /&gt;
  # Adauga noua cale. ex.&lt;br /&gt;
  { &lt;br /&gt;
     &amp;quot;data-root&amp;quot;: &amp;quot;/home/nicu/workspace/docker&amp;quot; &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Muta vechile imagini in o noua locatie&lt;br /&gt;
  sudo rsync -aP /var/lib/docker/ /home/nicu/workspace/docker&lt;br /&gt;
  # Sterge vechile imagini?&lt;br /&gt;
  sudo rm -rf /var/lib/docker&lt;br /&gt;
&lt;br /&gt;
  # Reporneste daemonul&lt;br /&gt;
  sudo service docker start&lt;br /&gt;
&lt;br /&gt;
=Crearea unui container=&lt;br /&gt;
Pentru crearea unui container ne vom defini un fisier de tip Dockerfile. ex:&lt;br /&gt;
 FROM debian:stretch-slim&lt;br /&gt;
 &lt;br /&gt;
 LABEL &amp;quot;description&amp;quot;=&amp;quot;Docker image for building and running a generic app&amp;quot;&lt;br /&gt;
 LABEL &amp;quot;author&amp;quot;=&amp;quot;nicolae.natea&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 ENV CLEANUP &amp;quot;set -xe &amp;amp;&amp;amp; apt-get autoclean &amp;amp;&amp;amp; apt-get clean &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/*&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Cleanup&lt;br /&gt;
 RUN set -xe &amp;amp;&amp;amp; apt-get update &amp;amp;&amp;amp; apt-get -y upgrade &amp;amp;&amp;amp; ${CLEANUP}&lt;br /&gt;
 &lt;br /&gt;
 RUN apt-get install -y make build-essential g++ cmake curl gdbserver &amp;amp;&amp;amp; ${CLEANUP}&lt;br /&gt;
 &lt;br /&gt;
 # Setting the command to launch&lt;br /&gt;
 CMD [&amp;quot;bash&amp;quot;, &amp;quot;-l&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
In cadrul fisierului descriem:&lt;br /&gt;
* distributia de la care pornim(ie. debian:stretch-slim)&lt;br /&gt;
* putem seta diverse atribute pt container precum descriere/autor&lt;br /&gt;
* putem defini o variabila pe care sa o reutilizam precum CLEANUP&lt;br /&gt;
* rulam niste comenzi ca si cum am fi in interiorul distributiei(ie. actualizare, instalat toolchain)&lt;br /&gt;
* putem copia un fisier extern in interiorul containerului. ex:&lt;br /&gt;
 # Add additional files&lt;br /&gt;
 COPY entrypoint.sh /bin/entrypoint.sh&lt;br /&gt;
* putem schimba permisiuni si seta ca acel fisier sa ruleze la pornirea containerului&lt;br /&gt;
 RUN chmod +x /bin/entrypoint.sh&lt;br /&gt;
 ENTRYPOINT [&amp;quot;/bin/entrypoint.sh&amp;quot;]&lt;br /&gt;
* and much more ...&lt;br /&gt;
&lt;br /&gt;
Pt a crea imaginea vom rula comanda&lt;br /&gt;
 $ docker image build -t nna/generic_builder:latest .&lt;br /&gt;
 unde nna/generic_builder:latest reprezinta un tag prin care identificam imaginea&lt;br /&gt;
 se presupune ca fisierul cu denumirea Dockerfile se afla in directorul curent. altfel poate fi specificat adaugand: -f &amp;quot;&amp;lt;cale&amp;gt;/Dockerfile&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Daca totul decurge ok, putem verifica cum ca imaginea a fost creata ok ruland comanda:&lt;br /&gt;
 $ docker images&lt;br /&gt;
 REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE&lt;br /&gt;
 nna/generic_builder   latest              963fd255c1fd        4 hours ago         391MB&lt;br /&gt;
&lt;br /&gt;
Pornirea unui container poate fi facuta folosind comanda:&lt;br /&gt;
 $ docker run -i -t nna/generic_builder&lt;br /&gt;
&lt;br /&gt;
Parametrii aditionali mai interesanti ce pot fi pasati comenzii run:&lt;br /&gt;
* -h, --hostname string                Container host name&lt;br /&gt;
* -v, --volume list                    Bind mount a volume&lt;br /&gt;
* -w, --workdir string                 Working directory inside the container&lt;br /&gt;
* -e, --env list                       Set environment variables&lt;br /&gt;
* etc... docker run --help&lt;br /&gt;
ie. docker run -i -h builder -e USER_NAME=${USER} -e USER_ID=`id -u ${USER}` -v ${PWD}:${PWD} -w ${PWD} -t nna/generic_builder&lt;br /&gt;
 -v ${PWD}:${PWD} -&amp;gt; mapam directorul curent la directorul cu acelasi nume din cadrul containerului&lt;br /&gt;
 -w ${PWD} -&amp;gt; setam calea curenta ca si cale de start in interiorul containerului&lt;br /&gt;
 -e USER_NAME=${USER} -&amp;gt; setam o variabila de sistem USER_NAME in interiorul containerului cu valoarea userului curent&lt;br /&gt;
 -h=builder -&amp;gt; setam ca hostul sa fie builder&lt;br /&gt;
&lt;br /&gt;
Dupa ce rulati comanda de mai sus veti vedea ca sunteti logati ca si root. un lucru pe care l-am putea face prin entrypoint.sh, ar fi sa folosim valoarile primite prin variabile de sistem pt a schimba utilizatorul curent (groupadd / useradd / su). etc.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' putem sa ne facem containerul public pe docker hub, daca ne creem un utilizator. Pentru aceasta am folosi comanda: '''docker push &amp;lt;nume imagine&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
=Utilizarea unui container existent (gitlab-ce)=&lt;br /&gt;
Putem folosi un container existent pe care sa il downloadam dintr-un repository privat sau cel public.&lt;br /&gt;
&lt;br /&gt;
Am putea sa ne aducem o imagine local(ex. versiunea comunity pentru gitlab) folosind comanda:&lt;br /&gt;
 docker pull gitlab/gitlab-ce:latest&lt;br /&gt;
&lt;br /&gt;
Cu toate astea, e adusa automat local daca nu exista atunci cand rulam comanda cu run:&lt;br /&gt;
 docker run --detach \&lt;br /&gt;
   --hostname localhost \&lt;br /&gt;
   --publish 443:443 --publish 80:80 --publish 22:22 \&lt;br /&gt;
   --name gitlab \&lt;br /&gt;
   --restart always \&lt;br /&gt;
   --volume $HOME/gitlab/config:/etc/gitlab \&lt;br /&gt;
   --volume $HOME/gitlab/logs:/var/log/gitlab \&lt;br /&gt;
   --volume $HOME/gitlab/data:/var/opt/gitlab \&lt;br /&gt;
   gitlab/gitlab-ce:latest&lt;br /&gt;
&lt;br /&gt;
In comanda de mai sus pornim un server de gitlab comunity edition:&lt;br /&gt;
* --detach =&amp;gt; containerul va rula in background&lt;br /&gt;
* --publish &amp;lt;local port&amp;gt;:&amp;lt;container port&amp;gt; =&amp;gt; mapam portul din container la portul local.&lt;br /&gt;
* --restart always =&amp;gt; in cazul in care moare containerul, vrem sa reporneasca automat&lt;br /&gt;
* --volume &amp;lt;cai&amp;gt; =&amp;gt; mapeaza niste cai permanente unde vor fi tinute configuratiile si proiectele&lt;br /&gt;
* --name gitlab =&amp;gt; un nume atribuit containerului. vizibil daca dati comanda: '''docker container list'''&lt;br /&gt;
&lt;br /&gt;
Gitlab nu porneste incredibil de rapid mai ales prima oara, asa ca putem sa ne atasam sa urmarim logurile folosind comanda:&lt;br /&gt;
 docker logs -f gitlab&lt;br /&gt;
&lt;br /&gt;
Dupa vre-un minut/doua putem sa accesam din browser: http://localhost (port 80), https://localhost (port 443), iar 22 e portul pt ssh folosit pentru git&lt;br /&gt;
&lt;br /&gt;
=Further steps=&lt;br /&gt;
Atasez la un container ce ruleaza: '''docker attach ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Salvarea starii curente a unui container intr-o imagine noua '''docker commit ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Listare imagini: '''docker image list'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Stergere imagine: '''docker image rm ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Listare container ce ruleaza: '''docker container list'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Restart container: '''docker restart ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Oprire fortata container: '''docker kill ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
etc. foarte stufos&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Comanda '''docker --help''' e foarte utila.&amp;lt;br /&amp;gt;&lt;br /&gt;
Deasemenea putem da ca si parametrii help si pt subcomenzi: ex. '''docker run --help'''&lt;br /&gt;
&lt;br /&gt;
=Integrare cu eclipse=&lt;br /&gt;
Instalam eclipse CDT: https://www.eclipse.org/downloads/&lt;br /&gt;
&lt;br /&gt;
Ideal ar fi sa ne instalam cateva extensii in cadrul eclipse din: ''Help -&amp;gt; Install new software''&lt;br /&gt;
* Docker Tooling&lt;br /&gt;
* C/C++ Docker Launch....&lt;br /&gt;
[[File:eclipse_dependencies.gif]]&lt;br /&gt;
&lt;br /&gt;
Dupa asta putem crea un proiect nou:&lt;br /&gt;
 File -&amp;gt; New -&amp;gt; Other -&amp;gt; C++ Project -&amp;gt; Makefile Project -&amp;gt; Hello world -&amp;gt; ....&lt;br /&gt;
Configuram proiectul pentru a folosi containerul anterior creat&lt;br /&gt;
 Click dreapta pe proiectul creat: Properties -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; Container Settings -&amp;gt; Bifam &amp;quot;build inside docker image&amp;quot;&lt;br /&gt;
 Aditional putem indica niste directoare pe care ni le dorim mapate&lt;br /&gt;
 Apply&lt;br /&gt;
Si suntem pregatiti pentru a compila si rula aplicatia in interiorul containerului&amp;lt;br /&amp;gt;&lt;br /&gt;
'''Note:''' Pentru debug se presupune ca aveti gdb pe host(ar trebui sa fie daca ati adaugat caile catre MinGW si l-ati bifat cand ati instalat)&lt;br /&gt;
&lt;br /&gt;
[[File:eclipse_new_project.gif]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=55</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=55"/>
		<updated>2021-07-23T14:50:07Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Instalare docker=&lt;br /&gt;
 Windows: https://www.docker.com/get-started&lt;br /&gt;
 Alta distributie: https://docs.docker.com/engine/install/debian/&lt;br /&gt;
&lt;br /&gt;
'''Note:''' docker are nevoie de hyper-v, asa ca e posibil sa creeze un conflict cu ceva ce se bazeaza ca acesta sa fie dezactivat(ex. virtualbox) =&amp;gt; any thoughts of getting around it are appreciated.&lt;br /&gt;
&lt;br /&gt;
=Ganduri zburdalnice pe Linux=&lt;br /&gt;
Ca sa puteti rulati docker ca si utilizator normal:&lt;br /&gt;
  sudo usermod -aG docker ${USER}&lt;br /&gt;
  restart / logout&lt;br /&gt;
&lt;br /&gt;
Ca sa porneasca automat:&lt;br /&gt;
  sudo systemctl enable docker&lt;br /&gt;
  sudo systemctl start docker&lt;br /&gt;
&lt;br /&gt;
Ca sa nu salveze imaginile si restul de fisiere pe partitia de sistem:&lt;br /&gt;
  sudo service docker stop&lt;br /&gt;
  sudo gedit /etc/docker/daemon.json&lt;br /&gt;
&lt;br /&gt;
  # Adauga noua cale. ex.&lt;br /&gt;
  { &lt;br /&gt;
     &amp;quot;data-root&amp;quot;: &amp;quot;/home/nicu/workspace/docker&amp;quot; &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  # Muta vechile imagini in o noua locatie&lt;br /&gt;
  sudo rsync -aP /var/lib/docker/ /home/nicu/workspace/docker&lt;br /&gt;
  # Sterge vechile imagini?&lt;br /&gt;
  sudo rm -rf /var/lib/docker.old&lt;br /&gt;
&lt;br /&gt;
  # Reporneste daemonul&lt;br /&gt;
  sudo service docker start&lt;br /&gt;
&lt;br /&gt;
=Crearea unui container=&lt;br /&gt;
Pentru crearea unui container ne vom defini un fisier de tip Dockerfile. ex:&lt;br /&gt;
 FROM debian:stretch-slim&lt;br /&gt;
 &lt;br /&gt;
 LABEL &amp;quot;description&amp;quot;=&amp;quot;Docker image for building and running a generic app&amp;quot;&lt;br /&gt;
 LABEL &amp;quot;author&amp;quot;=&amp;quot;nicolae.natea&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 ENV CLEANUP &amp;quot;set -xe &amp;amp;&amp;amp; apt-get autoclean &amp;amp;&amp;amp; apt-get clean &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/*&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Cleanup&lt;br /&gt;
 RUN set -xe &amp;amp;&amp;amp; apt-get update &amp;amp;&amp;amp; apt-get -y upgrade &amp;amp;&amp;amp; ${CLEANUP}&lt;br /&gt;
 &lt;br /&gt;
 RUN apt-get install -y make build-essential g++ cmake curl gdbserver &amp;amp;&amp;amp; ${CLEANUP}&lt;br /&gt;
 &lt;br /&gt;
 # Setting the command to launch&lt;br /&gt;
 CMD [&amp;quot;bash&amp;quot;, &amp;quot;-l&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
In cadrul fisierului descriem:&lt;br /&gt;
* distributia de la care pornim(ie. debian:stretch-slim)&lt;br /&gt;
* putem seta diverse atribute pt container precum descriere/autor&lt;br /&gt;
* putem defini o variabila pe care sa o reutilizam precum CLEANUP&lt;br /&gt;
* rulam niste comenzi ca si cum am fi in interiorul distributiei(ie. actualizare, instalat toolchain)&lt;br /&gt;
* putem copia un fisier extern in interiorul containerului. ex:&lt;br /&gt;
 # Add additional files&lt;br /&gt;
 COPY entrypoint.sh /bin/entrypoint.sh&lt;br /&gt;
* putem schimba permisiuni si seta ca acel fisier sa ruleze la pornirea containerului&lt;br /&gt;
 RUN chmod +x /bin/entrypoint.sh&lt;br /&gt;
 ENTRYPOINT [&amp;quot;/bin/entrypoint.sh&amp;quot;]&lt;br /&gt;
* and much more ...&lt;br /&gt;
&lt;br /&gt;
Pt a crea imaginea vom rula comanda&lt;br /&gt;
 $ docker image build -t nna/generic_builder:latest .&lt;br /&gt;
 unde nna/generic_builder:latest reprezinta un tag prin care identificam imaginea&lt;br /&gt;
 se presupune ca fisierul cu denumirea Dockerfile se afla in directorul curent. altfel poate fi specificat adaugand: -f &amp;quot;&amp;lt;cale&amp;gt;/Dockerfile&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Daca totul decurge ok, putem verifica cum ca imaginea a fost creata ok ruland comanda:&lt;br /&gt;
 $ docker images&lt;br /&gt;
 REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE&lt;br /&gt;
 nna/generic_builder   latest              963fd255c1fd        4 hours ago         391MB&lt;br /&gt;
&lt;br /&gt;
Pornirea unui container poate fi facuta folosind comanda:&lt;br /&gt;
 $ docker run -i -t nna/generic_builder&lt;br /&gt;
&lt;br /&gt;
Parametrii aditionali mai interesanti ce pot fi pasati comenzii run:&lt;br /&gt;
* -h, --hostname string                Container host name&lt;br /&gt;
* -v, --volume list                    Bind mount a volume&lt;br /&gt;
* -w, --workdir string                 Working directory inside the container&lt;br /&gt;
* -e, --env list                       Set environment variables&lt;br /&gt;
* etc... docker run --help&lt;br /&gt;
ie. docker run -i -h builder -e USER_NAME=${USER} -e USER_ID=`id -u ${USER}` -v ${PWD}:${PWD} -w ${PWD} -t nna/generic_builder&lt;br /&gt;
 -v ${PWD}:${PWD} -&amp;gt; mapam directorul curent la directorul cu acelasi nume din cadrul containerului&lt;br /&gt;
 -w ${PWD} -&amp;gt; setam calea curenta ca si cale de start in interiorul containerului&lt;br /&gt;
 -e USER_NAME=${USER} -&amp;gt; setam o variabila de sistem USER_NAME in interiorul containerului cu valoarea userului curent&lt;br /&gt;
 -h=builder -&amp;gt; setam ca hostul sa fie builder&lt;br /&gt;
&lt;br /&gt;
Dupa ce rulati comanda de mai sus veti vedea ca sunteti logati ca si root. un lucru pe care l-am putea face prin entrypoint.sh, ar fi sa folosim valoarile primite prin variabile de sistem pt a schimba utilizatorul curent (groupadd / useradd / su). etc.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' putem sa ne facem containerul public pe docker hub, daca ne creem un utilizator. Pentru aceasta am folosi comanda: '''docker push &amp;lt;nume imagine&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
=Utilizarea unui container existent (gitlab-ce)=&lt;br /&gt;
Putem folosi un container existent pe care sa il downloadam dintr-un repository privat sau cel public.&lt;br /&gt;
&lt;br /&gt;
Am putea sa ne aducem o imagine local(ex. versiunea comunity pentru gitlab) folosind comanda:&lt;br /&gt;
 docker pull gitlab/gitlab-ce:latest&lt;br /&gt;
&lt;br /&gt;
Cu toate astea, e adusa automat local daca nu exista atunci cand rulam comanda cu run:&lt;br /&gt;
 docker run --detach \&lt;br /&gt;
   --hostname localhost \&lt;br /&gt;
   --publish 443:443 --publish 80:80 --publish 22:22 \&lt;br /&gt;
   --name gitlab \&lt;br /&gt;
   --restart always \&lt;br /&gt;
   --volume $HOME/gitlab/config:/etc/gitlab \&lt;br /&gt;
   --volume $HOME/gitlab/logs:/var/log/gitlab \&lt;br /&gt;
   --volume $HOME/gitlab/data:/var/opt/gitlab \&lt;br /&gt;
   gitlab/gitlab-ce:latest&lt;br /&gt;
&lt;br /&gt;
In comanda de mai sus pornim un server de gitlab comunity edition:&lt;br /&gt;
* --detach =&amp;gt; containerul va rula in background&lt;br /&gt;
* --publish &amp;lt;local port&amp;gt;:&amp;lt;container port&amp;gt; =&amp;gt; mapam portul din container la portul local.&lt;br /&gt;
* --restart always =&amp;gt; in cazul in care moare containerul, vrem sa reporneasca automat&lt;br /&gt;
* --volume &amp;lt;cai&amp;gt; =&amp;gt; mapeaza niste cai permanente unde vor fi tinute configuratiile si proiectele&lt;br /&gt;
* --name gitlab =&amp;gt; un nume atribuit containerului. vizibil daca dati comanda: '''docker container list'''&lt;br /&gt;
&lt;br /&gt;
Gitlab nu porneste incredibil de rapid mai ales prima oara, asa ca putem sa ne atasam sa urmarim logurile folosind comanda:&lt;br /&gt;
 docker logs -f gitlab&lt;br /&gt;
&lt;br /&gt;
Dupa vre-un minut/doua putem sa accesam din browser: http://localhost (port 80), https://localhost (port 443), iar 22 e portul pt ssh folosit pentru git&lt;br /&gt;
&lt;br /&gt;
=Further steps=&lt;br /&gt;
Atasez la un container ce ruleaza: '''docker attach ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Salvarea starii curente a unui container intr-o imagine noua '''docker commit ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Listare imagini: '''docker image list'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Stergere imagine: '''docker image rm ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Listare container ce ruleaza: '''docker container list'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Restart container: '''docker restart ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Oprire fortata container: '''docker kill ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
etc. foarte stufos&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Comanda '''docker --help''' e foarte utila.&amp;lt;br /&amp;gt;&lt;br /&gt;
Deasemenea putem da ca si parametrii help si pt subcomenzi: ex. '''docker run --help'''&lt;br /&gt;
&lt;br /&gt;
=Integrare cu eclipse=&lt;br /&gt;
Instalam eclipse CDT: https://www.eclipse.org/downloads/&lt;br /&gt;
&lt;br /&gt;
Ideal ar fi sa ne instalam cateva extensii in cadrul eclipse din: ''Help -&amp;gt; Install new software''&lt;br /&gt;
* Docker Tooling&lt;br /&gt;
* C/C++ Docker Launch....&lt;br /&gt;
[[File:eclipse_dependencies.gif]]&lt;br /&gt;
&lt;br /&gt;
Dupa asta putem crea un proiect nou:&lt;br /&gt;
 File -&amp;gt; New -&amp;gt; Other -&amp;gt; C++ Project -&amp;gt; Makefile Project -&amp;gt; Hello world -&amp;gt; ....&lt;br /&gt;
Configuram proiectul pentru a folosi containerul anterior creat&lt;br /&gt;
 Click dreapta pe proiectul creat: Properties -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; Container Settings -&amp;gt; Bifam &amp;quot;build inside docker image&amp;quot;&lt;br /&gt;
 Aditional putem indica niste directoare pe care ni le dorim mapate&lt;br /&gt;
 Apply&lt;br /&gt;
Si suntem pregatiti pentru a compila si rula aplicatia in interiorul containerului&amp;lt;br /&amp;gt;&lt;br /&gt;
'''Note:''' Pentru debug se presupune ca aveti gdb pe host(ar trebui sa fie daca ati adaugat caile catre MinGW si l-ati bifat cand ati instalat)&lt;br /&gt;
&lt;br /&gt;
[[File:eclipse_new_project.gif]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=54</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=54"/>
		<updated>2021-07-22T14:47:32Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configuration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image onto the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the sdcard in the raspberry and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other pins to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.0.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.0.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=53</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=53"/>
		<updated>2021-07-22T13:34:38Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configuration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image onto the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the device in the raspbery and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other leds to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.0.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.0.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=52</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=52"/>
		<updated>2021-07-22T12:56:37Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* Control GPIO’s */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image on the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the device in the raspbery and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other leds to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.0.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.0.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=51</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=51"/>
		<updated>2021-07-22T12:55:20Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image on the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the device in the raspbery and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.jpeg|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;/nowiki&amp;gt;Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other leds to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.0.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.0.151&lt;br /&gt;
&lt;br /&gt;
[[File:Oneledonraspberry.jpg|One led connection]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=File:Oneledonraspberry.jpg&amp;diff=50</id>
		<title>File:Oneledonraspberry.jpg</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=File:Oneledonraspberry.jpg&amp;diff=50"/>
		<updated>2021-07-22T12:54:35Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=File:Led_pins.jpeg&amp;diff=49</id>
		<title>File:Led pins.jpeg</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=File:Led_pins.jpeg&amp;diff=49"/>
		<updated>2021-07-22T12:54:10Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=File:Raspberrypi4_piniout.png&amp;diff=48</id>
		<title>File:Raspberrypi4 piniout.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=File:Raspberrypi4_piniout.png&amp;diff=48"/>
		<updated>2021-07-22T12:51:30Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=47</id>
		<title>Raspberry</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Raspberry&amp;diff=47"/>
		<updated>2021-07-22T12:51:10Z</updated>

		<summary type="html">&lt;p&gt;Nicu: Created page with &amp;quot;= Setup environment =    Assuming a debian distribution, install the following dependencies:    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setup environment =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming a debian distribution, install the following dependencies:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \&lt;br /&gt;
      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \&lt;br /&gt;
      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \&lt;br /&gt;
      pylint3 xterm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Fetching the sources =&lt;br /&gt;
&lt;br /&gt;
Create a new project directory in your workspace folder. For example in ~/workspace&lt;br /&gt;
&lt;br /&gt;
 # Create the new project structure:&lt;br /&gt;
 mkdir -p raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Enter the sources folder&lt;br /&gt;
 cd raspberry/sources&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # And clone the following repositories&lt;br /&gt;
 git clone git://git.yoctoproject.org/poky -b hardknott&lt;br /&gt;
 git clone https://git.openembedded.org/meta-openembedded -b hardknott&lt;br /&gt;
 git clone git://git.yoctoproject.org/meta-raspberrypi -b hardknott&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuring the project =&lt;br /&gt;
&lt;br /&gt;
 # Move back to the project folder and source the environment&lt;br /&gt;
 cd -&lt;br /&gt;
 . sources/poky/oe-init-build-env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice the you are now in a new build directory. ie. ~/workspace/raspberry/build, and some new configuration files have been added in a conf folder.&lt;br /&gt;
&lt;br /&gt;
 # Edit the bblayer.conf&lt;br /&gt;
 gedit conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
and make sure it now has the following content for BBLAYERS:&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following variable has the following layers set:&lt;br /&gt;
 BBLAYERS ?= &amp;quot; \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-poky \&lt;br /&gt;
   ${TOPDIR}/../sources/poky/meta-yocto-bsp \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-raspberrypi \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-oe \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-networking \&lt;br /&gt;
   ${TOPDIR}/../sources/meta-openembedded/meta-python \&lt;br /&gt;
 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Now we will edit the second configration file and we will make sure the MACHINE is set to our target board.&lt;br /&gt;
 gedit conf/local.conf&lt;br /&gt;
&lt;br /&gt;
 # Make sure the following machine is set:&lt;br /&gt;
 MACHINE ?= &amp;quot;raspberrypi4&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Building an image =&lt;br /&gt;
&lt;br /&gt;
To build an image we will run:&lt;br /&gt;
 bitbake core-image-full-cmdline&lt;br /&gt;
&lt;br /&gt;
'Note': A rough way to get an idea of what other images you may build would be to run from the sources folder:&lt;br /&gt;
 find . -wholename *images/*.bb&lt;br /&gt;
&lt;br /&gt;
However for the moment core-image-full-cmdline satisfies our needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Flashing the image on the sdcard =&lt;br /&gt;
&lt;br /&gt;
To find the image go from your build folder in: '''tmp/deploy/images/raspberrypi4/'''&lt;br /&gt;
&lt;br /&gt;
If we’ve build '''core-image-full-cmdline''' you should see here a file named: '''core-image-full-cmdline.wic.bz2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Extract the file&lt;br /&gt;
 bzip2 -df core-image-full-cmdline.wic.bz2&lt;br /&gt;
&lt;br /&gt;
Now you should see that '''core-image-full-cmdline.wic.bz2''' dissapeared and there is a new file named: '''core-image-full-cmdline.wic'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Insert the sd card in the pc and check the device to which it corresponds using: &lt;br /&gt;
 lsblk -p&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are unsure. Unplug the sdcard, run the command again check which device dissapears/appears&lt;br /&gt;
&lt;br /&gt;
Possible sample output:&lt;br /&gt;
 NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT&lt;br /&gt;
 /dev/loop0         7:0    0 215.4M  1 loop /snap/rpi-imager/170&lt;br /&gt;
 /dev/loop1         7:1    0  99.2M  1 loop /snap/core/10958&lt;br /&gt;
 /dev/loop2         7:2    0  61.7M  1 loop /snap/core20/975&lt;br /&gt;
 /dev/loop3         7:3    0  61.7M  1 loop /snap/core20/1026&lt;br /&gt;
 /dev/loop4         7:4    0  99.4M  1 loop /snap/core/11316&lt;br /&gt;
 /dev/loop5         7:5    0 196.5M  1 loop /snap/rpi-imager/184&lt;br /&gt;
 /dev/sda           8:0    0 111.8G  0 disk &lt;br /&gt;
 ├─/dev/sda1        8:1    0  37.3G  0 part /&lt;br /&gt;
 ├─/dev/sda2        8:2    0     1K  0 part &lt;br /&gt;
 ├─/dev/sda5        8:5    0   3.7G  0 part [SWAP]&lt;br /&gt;
 └─/dev/sda6        8:6    0  70.8G  0 part /home&lt;br /&gt;
 /dev/sdb           8:16   1 698.7G  0 disk &lt;br /&gt;
 ├─/dev/sdb1        8:17   1   200G  0 part /media/nicu/6E56907E5690492B1&lt;br /&gt;
 ├─/dev/sdb2        8:18   1   200G  0 part /media/nicu/Local Disk3&lt;br /&gt;
 ├─/dev/sdb3        8:19   1   201G  0 part /media/nicu/Local Disk2&lt;br /&gt;
 ├─/dev/sdb4        8:20   1     1K  0 part &lt;br /&gt;
 ├─/dev/sdb5        8:21   1   4.6G  0 part &lt;br /&gt;
 └─/dev/sdb6        8:22   1  93.1G  0 part /media/nicu/DebianPart3&lt;br /&gt;
 /dev/mmcblk0     179:0    0    30G  0 disk &lt;br /&gt;
 ├─/dev/mmcblk0p1 179:1    0  50.3M  0 part /media/nicu/boot&lt;br /&gt;
 └─/dev/mmcblk0p2 179:2    0 192.4M  0 part /media/nicu/root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the above example the sdcard is: '''/dev/mmcblk0 '''and it’s a 32 GB card. It has two partitions: mmcblk0p1 and mmcblk0p2.&lt;br /&gt;
&lt;br /&gt;
Now that we have identified the image and the device, we will have to write the image.&lt;br /&gt;
&lt;br /&gt;
'''Don’t proceed if you are unsure you have the right device, as you might erase the data on your laptop. The data on the sdcard will be erased.'''&lt;br /&gt;
&lt;br /&gt;
So if all is ok run the following command:&lt;br /&gt;
 dd if=&amp;lt;raspberry image&amp;gt; of=&amp;lt;device&amp;gt; bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
so in my case:&lt;br /&gt;
 dd if=core-image-full-cmdline.wic of=/dev/mmcblk0 bs=4M conv=fsync&lt;br /&gt;
&lt;br /&gt;
The process shall take around 1 minute, wait until it finishes.&lt;br /&gt;
&lt;br /&gt;
Once done plug the device in the raspbery and power it on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Raspberry pinout = &lt;br /&gt;
&lt;br /&gt;
[[File:raspberrypi4_piniout.png|Raspberry pi4 pinout]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic led =&lt;br /&gt;
&lt;br /&gt;
There are two types of rgb leds: with common cathod or common anode. The longest pin is usually the common one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:led_pins.png|Led pins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Control GPIO’s =&lt;br /&gt;
&lt;br /&gt;
 # &amp;lt;/nowiki&amp;gt;Export pin to userspace&lt;br /&gt;
 echo &amp;quot;18&amp;quot; &amp;gt; /sys/class/gpio/export &lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 as an output&lt;br /&gt;
 echo &amp;quot;out&amp;quot; &amp;gt; /sys/class/gpio/gpio18/direction&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to high&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
 # Set pin 18 to low&lt;br /&gt;
 echo &amp;quot;0&amp;quot; &amp;gt; /sys/class/gpio/gpio18/value&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Putting it all together =&lt;br /&gt;
For my case I chose pin 18(the 6th pin on the right side). this pin will be connected to the anod (longest pin of the led) and I will connect any of the other leds to a ground(ex. 3rd pin on the right side).&lt;br /&gt;
&lt;br /&gt;
When the pin is high the led should light up. When it’s low, it should shut down.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Connect to the device with a patch cord cable, and use a command like nmap to find the address of the device:&lt;br /&gt;
 ex. nmap -sP 192.168.0.0/24&lt;br /&gt;
&lt;br /&gt;
Connect to the device through ssh:&lt;br /&gt;
 ex. ssh root@192.168.0.151&lt;br /&gt;
&lt;br /&gt;
[[File:oneledonraspberry.jpg|One led connection]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=46</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=46"/>
		<updated>2021-07-22T11:14:10Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/C%2B%2B_Rampup C++ Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Generic_application Generic application]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Linux_Rampup Linux Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Docker Docker]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Test_driven_development TDD]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Debugging Debugging]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Raspberry Raspberry]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Debugging&amp;diff=45</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Debugging&amp;diff=45"/>
		<updated>2020-10-09T21:02:46Z</updated>

		<summary type="html">&lt;p&gt;Nicu: Created page with &amp;quot;= GDB - versiune masochista =  == Informatii despre comenzi == O pagina utila in opinia mea este: http://scc.ustc.edu.cn/zlsc/sugon/intel/debugger/cl/main/bk_command_ref_gdb.h...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= GDB - versiune masochista =&lt;br /&gt;
&lt;br /&gt;
== Informatii despre comenzi ==&lt;br /&gt;
O pagina utila in opinia mea este: http://scc.ustc.edu.cn/zlsc/sugon/intel/debugger/cl/main/bk_command_ref_gdb.htm &amp;lt;br /&amp;gt;&lt;br /&gt;
Alternativ, dupa ce ati deschis gdb, puteti da comanda 'help', pt a vedea o lista de posibile comenzi.&amp;lt;br /&amp;gt;&lt;br /&gt;
Comenziile sunt impartite in subcapitole si putem accesa, mai adanc: &amp;quot;help breakpoints&amp;quot; / &amp;quot;help running&amp;quot; / etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
Pentru a iesi din gdb, avem comanda quit.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Un tool putin mai vizual cu ajutorul caruia va puteti juca cu comenziile de GDB: https://www.onlinegdb.com/&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pornirea sesiunii de debug ==&lt;br /&gt;
In mod normal am porni gdb folosind comanda:&lt;br /&gt;
 gdb &amp;lt;nume aplicatie&amp;gt;&lt;br /&gt;
sau pentru cazul in care vrem sa ii dam si argumente&lt;br /&gt;
 gdb -args &amp;lt;numeaplicatie&amp;gt; arg1 arg2 arg...n&lt;br /&gt;
&lt;br /&gt;
Pentru a rula executabilul putem da comanda:&lt;br /&gt;
 (gdb) run&lt;br /&gt;
sau, daca am pornit aplicatia fara argumente si vrem sa specificam un set de argumente, putem da comanda: &lt;br /&gt;
 (gdb) run arg1 arg2 arg...n&lt;br /&gt;
&lt;br /&gt;
== Listarea codului curent ==&lt;br /&gt;
Pentru a vizualiza codul curent vom putea folosi comanda:&lt;br /&gt;
 (gdb) list&lt;br /&gt;
Ce ar putea rezulta in:&lt;br /&gt;
 9       #include &amp;lt;stdio.h&amp;gt;                                                                            &lt;br /&gt;
 10                                                                                                    &lt;br /&gt;
 11      int main()                                                                                    &lt;br /&gt;
 12      {                                                                                             &lt;br /&gt;
 13          int i = 0;  &lt;br /&gt;
&lt;br /&gt;
Daca dorim sa vedem o combinatie de cod C++ si asamblare am putea folosi comanda:&lt;br /&gt;
 (gdb) disassemble /m &amp;lt;nume functie&amp;gt;&lt;br /&gt;
Ce ar putea rezulta in:&lt;br /&gt;
 Dump of assembler code for function main():                                                           &lt;br /&gt;
 12      {                                                                                             &lt;br /&gt;
   0x0000000000400536 &amp;lt;+0&amp;gt;:     push   %rbp                                                           &lt;br /&gt;
   0x0000000000400537 &amp;lt;+1&amp;gt;:     mov    %rsp,%rbp                                                      &lt;br /&gt;
   0x000000000040053a &amp;lt;+4&amp;gt;:     sub    $0x10,%rsp                                                     &lt;br /&gt;
                                                                                                      &lt;br /&gt;
 13          int i = 0;                                                                                &lt;br /&gt;
 =&amp;gt; 0x000000000040053e &amp;lt;+8&amp;gt;:     movl   $0x0,-0x4(%rbp)                                                &lt;br /&gt;
                                                                                                       &lt;br /&gt;
 14                                                                                                    &lt;br /&gt;
 15          for (int j = 0; j&amp;lt; i; j++) {  &lt;br /&gt;
&lt;br /&gt;
== Vizualizarea callstackului ==&lt;br /&gt;
Pentru a vizualiza callstackul vom putea folosi comanda:&lt;br /&gt;
 (gdb) backtrace                                                                                       &lt;br /&gt;
&lt;br /&gt;
 #0  main () at main.cpp:13&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Breakpoint-uri ==&lt;br /&gt;
Pentru a seta un breakpoint in gdb in mod normal vom folosi comanda:&lt;br /&gt;
 (gdb) break &amp;lt;param&amp;gt;&lt;br /&gt;
unde param poate fi:&lt;br /&gt;
* numele unei functii.&lt;br /&gt;
 (gdb) break main&lt;br /&gt;
* o linie in cod ex. vezi exemplul de la vizualizarea codului curent, pentru a vedea de ce e valoarea 13&lt;br /&gt;
 (gdb) break 13&lt;br /&gt;
* un offset relativ la linia curenta. ex. 2 linii mai jos:&lt;br /&gt;
 (gdb) break +2&lt;br /&gt;
* o adresa&lt;br /&gt;
 (gdb) break 0x000000000040053e&lt;br /&gt;
Putem da comanda break fara parametrii, pentru a seta un breakpoint la linia urmatoarea:&lt;br /&gt;
 (gdb) break&lt;br /&gt;
Aceasta variant este utila si pentru a opri o aplicatie ce ruleaza un momentul de fata.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pentru a vedea o lista cu breakpoint-urile setate putem da comanda:&lt;br /&gt;
 (gdb) info breaks&lt;br /&gt;
&lt;br /&gt;
si vom vedea ceva de genul:&lt;br /&gt;
 Num     Type           Disp Enb Address            What                                               &lt;br /&gt;
 1       breakpoint     keep y   0x000000000040053e in main() at main.cpp:13&lt;br /&gt;
unde prima coloana ne indica un breakpoint id&lt;br /&gt;
&lt;br /&gt;
Pentru a dezactiva un breakpoint avem comanda:&lt;br /&gt;
 (gdb) disable &amp;lt;breakpoint id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pentru a re-activa un breakpoint avem comanda:&lt;br /&gt;
 (gdb) enable &amp;lt;breakpoint id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pentru a sterge un breakpoint avem comanda:&lt;br /&gt;
 (gdb) delete&lt;br /&gt;
 (gdb) delete &amp;lt;breakpoint id&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Daca dorim sa setam un breakpoint care se sterge automat dupa prima captura, avem comanda:&lt;br /&gt;
 (gdb) tbreak &amp;lt;param&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Lucrul cu variabile ==&lt;br /&gt;
Pentru a vedea o lista cu valorile registrilor, avem comanda:&lt;br /&gt;
 (gdb) info registers&lt;br /&gt;
sau pentru a vedea un anumit registru:&lt;br /&gt;
 (gdb) info registers $pc&lt;br /&gt;
&lt;br /&gt;
Pentru a vedea o lista cu toate variabilele, avem comanda:&lt;br /&gt;
 (gdb) info variables&lt;br /&gt;
&lt;br /&gt;
Pentru a vedea o lista cu toate variabilele locale, avem comanda:&lt;br /&gt;
 (gdb) info locals&lt;br /&gt;
&lt;br /&gt;
Pentru a vedea valoarea unei anumite variabile avem comanda:&lt;br /&gt;
 (gdb) print &amp;lt;nume_variabila&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pentru a vedea valoarea unei anumite variabile avem comanda:&lt;br /&gt;
 (gdb) print &amp;lt;nume_variabila&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putem afla adresa unei variabile folosind(similar cu C sau C++):&lt;br /&gt;
 (gdb) print &amp;amp;&amp;lt;nume_variabila&amp;gt;&lt;br /&gt;
ex. &lt;br /&gt;
    (gdb) print &amp;amp;i&lt;br /&gt;
    $1 = (int *) 0x7fffffffebec&lt;br /&gt;
&lt;br /&gt;
Putem vedea ce se afla la o adresa folosind cast si dereferentiere:&lt;br /&gt;
    (gdb) print *((int *) 0x7fffffffebec)                                                             &lt;br /&gt;
    $2 = 0&lt;br /&gt;
&lt;br /&gt;
Putem seta valoarea unei variabile folosind acelasi principii cu comanda:&lt;br /&gt;
 (gdb) set variable &amp;lt;nume_variabila&amp;gt;=&amp;lt;valoare&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putem seta valoarea ununi registru folosind comanda:&lt;br /&gt;
 (gdb) set &amp;lt;nume registru&amp;gt;=&amp;lt;valoare&amp;gt;&lt;br /&gt;
unde nume registru incepe cu $. ex. $pc, $sp, $eax&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cum ne miscam in cadrul aplicatiei ==&lt;br /&gt;
Prima comanda dupa ce ne-am setat breakpointurile o sa fie evident: run&lt;br /&gt;
Odata ce suntem blocati intr-un breakpoint avem optiunea de a:&lt;br /&gt;
&lt;br /&gt;
* Continua executia pana la urmatorul breakpoint sau terminarea aplicatiei, folosind comanda:&lt;br /&gt;
 (gdb) continue&lt;br /&gt;
* A sari la urmatoarea instructiune (step into), folosind comanda:&lt;br /&gt;
 (gdb) step&lt;br /&gt;
 (gdb) stepi # step into la nivel de instructiune in asamblare&lt;br /&gt;
* A sari la urmatoarea instructiune (step over), folosind comanda:&lt;br /&gt;
 (gdb) next&lt;br /&gt;
 (gdb) nexti - step over la nivel de instructiune in asamblare&lt;br /&gt;
* A continua executia pana la iesirea din functia curenta(step out), folosind comanda:&lt;br /&gt;
 (gdb) finish&lt;br /&gt;
* A returna din functia curenta fara a mai executa restul instructiunilor, folosind comanda:&lt;br /&gt;
 (gdb) return&lt;br /&gt;
* Sarim neconditionat la o adresa folosind comanda:&lt;br /&gt;
 (gdb) jump &amp;lt;addresa sau linie&amp;gt;&lt;br /&gt;
Alternativ am putea seta valoare program counterului folosind comanda:&lt;br /&gt;
 (gdb) set $pc &amp;lt;adresa&amp;gt;&lt;br /&gt;
unde adresa poate fi: main, sau main+8&lt;br /&gt;
&lt;br /&gt;
== Multithreaded application ==&lt;br /&gt;
Pentru a vedea informatii despre threadurile aplicatiatie:&lt;br /&gt;
 (gdb) info threads                                                                                    &lt;br /&gt;
   Id   Target Id         Frame                                                                        &lt;br /&gt;
 * 2    Thread 0x7ffff6fbe700 (LWP 28728) &amp;quot;a.out&amp;quot; func () at main.cpp:16                               &lt;br /&gt;
   1    Thread 0x7ffff7fe1780 (LWP 28724) &amp;quot;a.out&amp;quot; 0x00007ffff7bc565b in pthread_join (threadid=140737337091840, thread_return=0x0) at pthread_join.c:92 &lt;br /&gt;
Prima coloanal ne indica id'ul threadurilor. Marcat cu steluta este threadul pe care ne aflam noi, in momentul acesta.&lt;br /&gt;
&lt;br /&gt;
Pentru a schimba threadul curent, putem da comanda:&lt;br /&gt;
 (gdb) thread &amp;lt;thread id&amp;gt;&lt;br /&gt;
'''Note:''' Exista si optiunea sa setati breakpointuri doar la nivel de thread: [http://scc.ustc.edu.cn/zlsc/sugon/intel/debugger/cl/commandref/gdb_mode/cmd_break.htm break] [{func | line | *addr}] [if cond] [thread thread]&lt;br /&gt;
&lt;br /&gt;
= GDB - easy version =&lt;br /&gt;
Versiunea simpla implica integrarea GDB in eclipse. (Ceea ce e disponibil implicit)&lt;br /&gt;
See. http://wiki.natea.ro/index.php/Docker#Integrare_cu_eclipse&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= GDB - remote =&lt;br /&gt;
Detalii despre gdb server + attach la proces&lt;br /&gt;
&lt;br /&gt;
= GDB - embedded systems - yocto =&lt;br /&gt;
Ce retete trebuie sa activam&lt;br /&gt;
&lt;br /&gt;
= Compilarea unei aplicatie =&lt;br /&gt;
cum adaugam simboluri, cum linkam surse set substitute-path&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=44</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=44"/>
		<updated>2020-10-09T20:34:01Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/C%2B%2B_Rampup C++ Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Generic_application Generic application]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Linux_Rampup Linux Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Docker Docker]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Test_driven_development TDD]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Debugging Debugging]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=43</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=43"/>
		<updated>2020-08-25T20:52:45Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/C%2B%2B_Rampup C++ Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Generic_application Generic application]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Linux_Rampup Linux Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Docker Docker]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Test_driven_development TDD]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=42</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=42"/>
		<updated>2020-08-25T20:50:48Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* timere */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Sa se scrie o componenta care va permite parsarea unui fisier.&lt;br /&gt;
 - se va crea un Dockerfile care sa permita compilarea si rularea aplicatiei.&lt;br /&gt;
 - se va testa integrarea librariei avand ca date de intrare atat un fisier valid cat si un fisier invalid folosind gtest.&lt;br /&gt;
 - se va exemplifica citirea unui nod&lt;br /&gt;
&lt;br /&gt;
 A se implementa pt:&lt;br /&gt;
  - json&lt;br /&gt;
  - xml&lt;br /&gt;
  - yaml&lt;br /&gt;
 (libjson, libxml, libyaml, ... sau alte librarii)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 Se se defineasca/scrie un modul care permite logarea de informatii.&lt;br /&gt;
 - functiile exportate vor trebui sa permita extragerea urmatoarelor date: &lt;br /&gt;
   - fisierul si linia de unde a fost apelata functia de logare.&lt;br /&gt;
   - nivelul logului (verbose, info, warning, error, wtf &amp;lt;- what a terrible failure.  primit ca parametru)&lt;br /&gt;
   - timpul curent&lt;br /&gt;
   - modulul (string primit ca parametru)&lt;br /&gt;
   - un mesaj (string primit ca parametru)&lt;br /&gt;
   - (bonus) &lt;br /&gt;
       - overload operatorul &amp;quot;&amp;lt;&amp;lt;&amp;quot; ex. sa putem scrie: Log_info(MODUL) &amp;lt;&amp;lt; &amp;quot;Hello World nbr. &amp;quot; &amp;lt;&amp;lt; 7;&lt;br /&gt;
       sau&lt;br /&gt;
       - variadic argument. ex. asemeni sprintf(&amp;lt;format&amp;gt;, ...)&lt;br /&gt;
 - se va scrie o metoda prin care un consumator poate inregistra un callback&lt;br /&gt;
 - datele extrase vor fi trimise catre consumatorii inregistrati, sau printate pe consola, daca nu exista consumatori.&lt;br /&gt;
 Note: recomandarea este ca parametrul dat la functia de callback sa fie de tip shared_ptr&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele extrase de logger si le printeaza pe consola&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza intr-un fisier atunci cand apare o eroare.&lt;br /&gt;
 - datele primite vor fi salvate intr-un buffer circular de o dimensiune fixa.&lt;br /&gt;
 - la aparitia mesajului de eroare bufferul va fi copiat intr-un fisier si curatat.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - dimensiunea bufferului&lt;br /&gt;
      - calea catre fisierul de iesire (fisierul va avea in nume: numele modulului care a generat eroarea, cat si un timestamp)&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza in fisiere prin rotatie.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - nivelul minim al logurilor&lt;br /&gt;
      - numarul de fisiere&lt;br /&gt;
      - dimensiunea maxima pentru un fisier&lt;br /&gt;
      - calea catre fisierul de iesire&lt;br /&gt;
      - cazuri speciale: dimensiune=0, numarul de fisiere=0 =&amp;gt; nelimitat&lt;br /&gt;
      - la fiecare pornire aplicatia va continua scrierea din ultimul fisier editat(verificare timestamp)&lt;br /&gt;
 ex.&lt;br /&gt;
   log level minim = warning =&amp;gt; se vor printa doar mesaje de: warning, error, wtf&lt;br /&gt;
   dimensiune maxima = 5MB =&amp;gt; un fisier de log va avea maxim 5MB, o data ce dimensiunea este atinsa se va trece la un alt fisier. ex. file1.log (5MB) =&amp;gt; trecem la file2.log. cand aceasta va fi plin, trecem la file3.log&lt;br /&gt;
  odata ce numarul maxim de fisiere e atins ex. 3, sarim inapoi la primul fisier si il suprascriem.&lt;br /&gt;
&lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 A se defini si crea o procedura/componenta ce exemplifica prototype pattern.&amp;lt;br /&amp;gt;&lt;br /&gt;
 Se va permite initializarea unui numar maxim predefinit de componente. (will see from the document - initializare statica obiecte)&amp;lt;br /&amp;gt;&lt;br /&gt;
 Noile componente vor primi ca si parametru un obiect de tip json. Acest obiect se va presupune ca ar contine date de configurare&amp;lt;br /&amp;gt;&lt;br /&gt;
 A se adapta consumatorii definiti la pasul anterior.&lt;br /&gt;
&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
&lt;br /&gt;
===integrare===&lt;br /&gt;
 A se defini o structura pentru un fisier de intrare care sa permita identificarea componentelor cat si a parametrilor asociati.&lt;br /&gt;
&lt;br /&gt;
 A se scrie o functie care parseaza structura definita anterior pornind de la prototipul din task-ul 1 - config parser - si creaza copii pt componentele identificate conform prototipului din task-ul 3 - prototype pattern -&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 Se vor implementa urmatoarele metode: publish(MESSAGE_ID, STRUCT)/subscribe(MESSAGE_ID, CALLBACK)&lt;br /&gt;
 Aceste metode vor face parte dintr-o clasa de baza ce va fi mostenita de catre fiecare componenta.&lt;br /&gt;
 &lt;br /&gt;
 Metoda subscribe ii va permite unei componente sa inregistrese un callback, asociat cu un id de mesaj.&lt;br /&gt;
 Metoda publish va avea rolul unui dispatcher care va trimite niste date componentelor inregistrate pt un anumit id de mesaj.&lt;br /&gt;
&lt;br /&gt;
 A se defini o structura ce permite transmiterea de date variabile(ie. string, int, {string, string, int}. hint: map)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 A se crea doua metode in clasa de baza care sa permita pornirea unui timer: one_shot/periodic, asociat cu un callback.&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=41</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=41"/>
		<updated>2020-08-25T20:48:32Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* implementarea unui dispatcher */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Sa se scrie o componenta care va permite parsarea unui fisier.&lt;br /&gt;
 - se va crea un Dockerfile care sa permita compilarea si rularea aplicatiei.&lt;br /&gt;
 - se va testa integrarea librariei avand ca date de intrare atat un fisier valid cat si un fisier invalid folosind gtest.&lt;br /&gt;
 - se va exemplifica citirea unui nod&lt;br /&gt;
&lt;br /&gt;
 A se implementa pt:&lt;br /&gt;
  - json&lt;br /&gt;
  - xml&lt;br /&gt;
  - yaml&lt;br /&gt;
 (libjson, libxml, libyaml, ... sau alte librarii)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 Se se defineasca/scrie un modul care permite logarea de informatii.&lt;br /&gt;
 - functiile exportate vor trebui sa permita extragerea urmatoarelor date: &lt;br /&gt;
   - fisierul si linia de unde a fost apelata functia de logare.&lt;br /&gt;
   - nivelul logului (verbose, info, warning, error, wtf &amp;lt;- what a terrible failure.  primit ca parametru)&lt;br /&gt;
   - timpul curent&lt;br /&gt;
   - modulul (string primit ca parametru)&lt;br /&gt;
   - un mesaj (string primit ca parametru)&lt;br /&gt;
   - (bonus) &lt;br /&gt;
       - overload operatorul &amp;quot;&amp;lt;&amp;lt;&amp;quot; ex. sa putem scrie: Log_info(MODUL) &amp;lt;&amp;lt; &amp;quot;Hello World nbr. &amp;quot; &amp;lt;&amp;lt; 7;&lt;br /&gt;
       sau&lt;br /&gt;
       - variadic argument. ex. asemeni sprintf(&amp;lt;format&amp;gt;, ...)&lt;br /&gt;
 - se va scrie o metoda prin care un consumator poate inregistra un callback&lt;br /&gt;
 - datele extrase vor fi trimise catre consumatorii inregistrati, sau printate pe consola, daca nu exista consumatori.&lt;br /&gt;
 Note: recomandarea este ca parametrul dat la functia de callback sa fie de tip shared_ptr&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele extrase de logger si le printeaza pe consola&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza intr-un fisier atunci cand apare o eroare.&lt;br /&gt;
 - datele primite vor fi salvate intr-un buffer circular de o dimensiune fixa.&lt;br /&gt;
 - la aparitia mesajului de eroare bufferul va fi copiat intr-un fisier si curatat.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - dimensiunea bufferului&lt;br /&gt;
      - calea catre fisierul de iesire (fisierul va avea in nume: numele modulului care a generat eroarea, cat si un timestamp)&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza in fisiere prin rotatie.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - nivelul minim al logurilor&lt;br /&gt;
      - numarul de fisiere&lt;br /&gt;
      - dimensiunea maxima pentru un fisier&lt;br /&gt;
      - calea catre fisierul de iesire&lt;br /&gt;
      - cazuri speciale: dimensiune=0, numarul de fisiere=0 =&amp;gt; nelimitat&lt;br /&gt;
      - la fiecare pornire aplicatia va continua scrierea din ultimul fisier editat(verificare timestamp)&lt;br /&gt;
 ex.&lt;br /&gt;
   log level minim = warning =&amp;gt; se vor printa doar mesaje de: warning, error, wtf&lt;br /&gt;
   dimensiune maxima = 5MB =&amp;gt; un fisier de log va avea maxim 5MB, o data ce dimensiunea este atinsa se va trece la un alt fisier. ex. file1.log (5MB) =&amp;gt; trecem la file2.log. cand aceasta va fi plin, trecem la file3.log&lt;br /&gt;
  odata ce numarul maxim de fisiere e atins ex. 3, sarim inapoi la primul fisier si il suprascriem.&lt;br /&gt;
&lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 A se defini si crea o procedura/componenta ce exemplifica prototype pattern.&amp;lt;br /&amp;gt;&lt;br /&gt;
 Se va permite initializarea unui numar maxim predefinit de componente. (will see from the document - initializare statica obiecte)&amp;lt;br /&amp;gt;&lt;br /&gt;
 Noile componente vor primi ca si parametru un obiect de tip json. Acest obiect se va presupune ca ar contine date de configurare&amp;lt;br /&amp;gt;&lt;br /&gt;
 A se adapta consumatorii definiti la pasul anterior.&lt;br /&gt;
&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
&lt;br /&gt;
===integrare===&lt;br /&gt;
 A se defini o structura pentru un fisier de intrare care sa permita identificarea componentelor cat si a parametrilor asociati.&lt;br /&gt;
&lt;br /&gt;
 A se scrie o functie care parseaza structura definita anterior pornind de la prototipul din task-ul 1 - config parser - si creaza copii pt componentele identificate conform prototipului din task-ul 3 - prototype pattern -&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 Se vor implementa urmatoarele metode: publish(MESSAGE_ID, STRUCT)/subscribe(MESSAGE_ID, CALLBACK)&lt;br /&gt;
 Aceste metode vor face parte dintr-o clasa de baza ce va fi mostenita de catre fiecare componenta.&lt;br /&gt;
 &lt;br /&gt;
 Metoda subscribe ii va permite unei componente sa inregistrese un callback, asociat cu un id de mesaj.&lt;br /&gt;
 Metoda publish va avea rolul unui dispatcher care va trimite niste date componentelor inregistrate pt un anumit id de mesaj.&lt;br /&gt;
&lt;br /&gt;
 A se defini o structura ce permite transmiterea de date variabile(ie. string, int, {string, string, int}. hint: map)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 api pt creare timere&lt;br /&gt;
 (acoperit: chrono, lambda, bind)&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=40</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=40"/>
		<updated>2020-08-25T20:39:09Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* metoda initializare componente */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Sa se scrie o componenta care va permite parsarea unui fisier.&lt;br /&gt;
 - se va crea un Dockerfile care sa permita compilarea si rularea aplicatiei.&lt;br /&gt;
 - se va testa integrarea librariei avand ca date de intrare atat un fisier valid cat si un fisier invalid folosind gtest.&lt;br /&gt;
 - se va exemplifica citirea unui nod&lt;br /&gt;
&lt;br /&gt;
 A se implementa pt:&lt;br /&gt;
  - json&lt;br /&gt;
  - xml&lt;br /&gt;
  - yaml&lt;br /&gt;
 (libjson, libxml, libyaml, ... sau alte librarii)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 Se se defineasca/scrie un modul care permite logarea de informatii.&lt;br /&gt;
 - functiile exportate vor trebui sa permita extragerea urmatoarelor date: &lt;br /&gt;
   - fisierul si linia de unde a fost apelata functia de logare.&lt;br /&gt;
   - nivelul logului (verbose, info, warning, error, wtf &amp;lt;- what a terrible failure.  primit ca parametru)&lt;br /&gt;
   - timpul curent&lt;br /&gt;
   - modulul (string primit ca parametru)&lt;br /&gt;
   - un mesaj (string primit ca parametru)&lt;br /&gt;
   - (bonus) &lt;br /&gt;
       - overload operatorul &amp;quot;&amp;lt;&amp;lt;&amp;quot; ex. sa putem scrie: Log_info(MODUL) &amp;lt;&amp;lt; &amp;quot;Hello World nbr. &amp;quot; &amp;lt;&amp;lt; 7;&lt;br /&gt;
       sau&lt;br /&gt;
       - variadic argument. ex. asemeni sprintf(&amp;lt;format&amp;gt;, ...)&lt;br /&gt;
 - se va scrie o metoda prin care un consumator poate inregistra un callback&lt;br /&gt;
 - datele extrase vor fi trimise catre consumatorii inregistrati, sau printate pe consola, daca nu exista consumatori.&lt;br /&gt;
 Note: recomandarea este ca parametrul dat la functia de callback sa fie de tip shared_ptr&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele extrase de logger si le printeaza pe consola&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza intr-un fisier atunci cand apare o eroare.&lt;br /&gt;
 - datele primite vor fi salvate intr-un buffer circular de o dimensiune fixa.&lt;br /&gt;
 - la aparitia mesajului de eroare bufferul va fi copiat intr-un fisier si curatat.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - dimensiunea bufferului&lt;br /&gt;
      - calea catre fisierul de iesire (fisierul va avea in nume: numele modulului care a generat eroarea, cat si un timestamp)&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza in fisiere prin rotatie.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - nivelul minim al logurilor&lt;br /&gt;
      - numarul de fisiere&lt;br /&gt;
      - dimensiunea maxima pentru un fisier&lt;br /&gt;
      - calea catre fisierul de iesire&lt;br /&gt;
      - cazuri speciale: dimensiune=0, numarul de fisiere=0 =&amp;gt; nelimitat&lt;br /&gt;
      - la fiecare pornire aplicatia va continua scrierea din ultimul fisier editat(verificare timestamp)&lt;br /&gt;
 ex.&lt;br /&gt;
   log level minim = warning =&amp;gt; se vor printa doar mesaje de: warning, error, wtf&lt;br /&gt;
   dimensiune maxima = 5MB =&amp;gt; un fisier de log va avea maxim 5MB, o data ce dimensiunea este atinsa se va trece la un alt fisier. ex. file1.log (5MB) =&amp;gt; trecem la file2.log. cand aceasta va fi plin, trecem la file3.log&lt;br /&gt;
  odata ce numarul maxim de fisiere e atins ex. 3, sarim inapoi la primul fisier si il suprascriem.&lt;br /&gt;
&lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 A se defini si crea o procedura/componenta ce exemplifica prototype pattern.&amp;lt;br /&amp;gt;&lt;br /&gt;
 Se va permite initializarea unui numar maxim predefinit de componente. (will see from the document - initializare statica obiecte)&amp;lt;br /&amp;gt;&lt;br /&gt;
 Noile componente vor primi ca si parametru un obiect de tip json. Acest obiect se va presupune ca ar contine date de configurare&amp;lt;br /&amp;gt;&lt;br /&gt;
 A se adapta consumatorii definiti la pasul anterior.&lt;br /&gt;
&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
&lt;br /&gt;
===integrare===&lt;br /&gt;
 A se defini o structura pentru un fisier de intrare care sa permita identificarea componentelor cat si a parametrilor asociati.&lt;br /&gt;
&lt;br /&gt;
 A se scrie o functie care parseaza structura definita anterior pornind de la prototipul din task-ul 1 - config parser - si creaza copii pt componentele identificate conform prototipului din task-ul 3 - prototype pattern -&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 implementarea unui dispatcher de mesaje care ofera urmatorele doua functii: publish/subscribe&lt;br /&gt;
 (tinta e sa avem o metoda prin care componentele sa comunice intre ele. parametrii(string si un obiect 'nedefinit'). ie poti folosi pt a inregistra un callback, sau pur si simplu sa activezi un feature.)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 api pt creare timere&lt;br /&gt;
 (acoperit: chrono, lambda, bind)&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=39</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=39"/>
		<updated>2020-08-25T20:37:50Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* integrare */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Sa se scrie o componenta care va permite parsarea unui fisier.&lt;br /&gt;
 - se va crea un Dockerfile care sa permita compilarea si rularea aplicatiei.&lt;br /&gt;
 - se va testa integrarea librariei avand ca date de intrare atat un fisier valid cat si un fisier invalid folosind gtest.&lt;br /&gt;
 - se va exemplifica citirea unui nod&lt;br /&gt;
&lt;br /&gt;
 A se implementa pt:&lt;br /&gt;
  - json&lt;br /&gt;
  - xml&lt;br /&gt;
  - yaml&lt;br /&gt;
 (libjson, libxml, libyaml, ... sau alte librarii)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 Se se defineasca/scrie un modul care permite logarea de informatii.&lt;br /&gt;
 - functiile exportate vor trebui sa permita extragerea urmatoarelor date: &lt;br /&gt;
   - fisierul si linia de unde a fost apelata functia de logare.&lt;br /&gt;
   - nivelul logului (verbose, info, warning, error, wtf &amp;lt;- what a terrible failure.  primit ca parametru)&lt;br /&gt;
   - timpul curent&lt;br /&gt;
   - modulul (string primit ca parametru)&lt;br /&gt;
   - un mesaj (string primit ca parametru)&lt;br /&gt;
   - (bonus) &lt;br /&gt;
       - overload operatorul &amp;quot;&amp;lt;&amp;lt;&amp;quot; ex. sa putem scrie: Log_info(MODUL) &amp;lt;&amp;lt; &amp;quot;Hello World nbr. &amp;quot; &amp;lt;&amp;lt; 7;&lt;br /&gt;
       sau&lt;br /&gt;
       - variadic argument. ex. asemeni sprintf(&amp;lt;format&amp;gt;, ...)&lt;br /&gt;
 - se va scrie o metoda prin care un consumator poate inregistra un callback&lt;br /&gt;
 - datele extrase vor fi trimise catre consumatorii inregistrati, sau printate pe consola, daca nu exista consumatori.&lt;br /&gt;
 Note: recomandarea este ca parametrul dat la functia de callback sa fie de tip shared_ptr&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele extrase de logger si le printeaza pe consola&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza intr-un fisier atunci cand apare o eroare.&lt;br /&gt;
 - datele primite vor fi salvate intr-un buffer circular de o dimensiune fixa.&lt;br /&gt;
 - la aparitia mesajului de eroare bufferul va fi copiat intr-un fisier si curatat.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - dimensiunea bufferului&lt;br /&gt;
      - calea catre fisierul de iesire (fisierul va avea in nume: numele modulului care a generat eroarea, cat si un timestamp)&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza in fisiere prin rotatie.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - nivelul minim al logurilor&lt;br /&gt;
      - numarul de fisiere&lt;br /&gt;
      - dimensiunea maxima pentru un fisier&lt;br /&gt;
      - calea catre fisierul de iesire&lt;br /&gt;
      - cazuri speciale: dimensiune=0, numarul de fisiere=0 =&amp;gt; nelimitat&lt;br /&gt;
      - la fiecare pornire aplicatia va continua scrierea din ultimul fisier editat(verificare timestamp)&lt;br /&gt;
 ex.&lt;br /&gt;
   log level minim = warning =&amp;gt; se vor printa doar mesaje de: warning, error, wtf&lt;br /&gt;
   dimensiune maxima = 5MB =&amp;gt; un fisier de log va avea maxim 5MB, o data ce dimensiunea este atinsa se va trece la un alt fisier. ex. file1.log (5MB) =&amp;gt; trecem la file2.log. cand aceasta va fi plin, trecem la file3.log&lt;br /&gt;
  odata ce numarul maxim de fisiere e atins ex. 3, sarim inapoi la primul fisier si il suprascriem.&lt;br /&gt;
&lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 A se defini si crea o procedura/componenta ce exemplifica prototype pattern.&amp;lt;br /&amp;gt;&lt;br /&gt;
 Se va permite initializarea unui numar maxim predefinit de componente. (will see from the document - initializare statica obiecte)&amp;lt;br /&amp;gt;&lt;br /&gt;
 Noile componente vor primi ca si parametru un obiect de tip json. Acest obiect se va presupune ca ar contine date de configurare&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
&lt;br /&gt;
===integrare===&lt;br /&gt;
 A se defini o structura pentru un fisier de intrare care sa permita identificarea componentelor cat si a parametrilor asociati.&lt;br /&gt;
&lt;br /&gt;
 A se scrie o functie care parseaza structura definita anterior pornind de la prototipul din task-ul 1 - config parser - si creaza copii pt componentele identificate conform prototipului din task-ul 3 - prototype pattern -&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 implementarea unui dispatcher de mesaje care ofera urmatorele doua functii: publish/subscribe&lt;br /&gt;
 (tinta e sa avem o metoda prin care componentele sa comunice intre ele. parametrii(string si un obiect 'nedefinit'). ie poti folosi pt a inregistra un callback, sau pur si simplu sa activezi un feature.)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 api pt creare timere&lt;br /&gt;
 (acoperit: chrono, lambda, bind)&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=38</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=38"/>
		<updated>2020-08-25T20:31:18Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* metoda initializare componente */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Sa se scrie o componenta care va permite parsarea unui fisier.&lt;br /&gt;
 - se va crea un Dockerfile care sa permita compilarea si rularea aplicatiei.&lt;br /&gt;
 - se va testa integrarea librariei avand ca date de intrare atat un fisier valid cat si un fisier invalid folosind gtest.&lt;br /&gt;
 - se va exemplifica citirea unui nod&lt;br /&gt;
&lt;br /&gt;
 A se implementa pt:&lt;br /&gt;
  - json&lt;br /&gt;
  - xml&lt;br /&gt;
  - yaml&lt;br /&gt;
 (libjson, libxml, libyaml, ... sau alte librarii)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 Se se defineasca/scrie un modul care permite logarea de informatii.&lt;br /&gt;
 - functiile exportate vor trebui sa permita extragerea urmatoarelor date: &lt;br /&gt;
   - fisierul si linia de unde a fost apelata functia de logare.&lt;br /&gt;
   - nivelul logului (verbose, info, warning, error, wtf &amp;lt;- what a terrible failure.  primit ca parametru)&lt;br /&gt;
   - timpul curent&lt;br /&gt;
   - modulul (string primit ca parametru)&lt;br /&gt;
   - un mesaj (string primit ca parametru)&lt;br /&gt;
   - (bonus) &lt;br /&gt;
       - overload operatorul &amp;quot;&amp;lt;&amp;lt;&amp;quot; ex. sa putem scrie: Log_info(MODUL) &amp;lt;&amp;lt; &amp;quot;Hello World nbr. &amp;quot; &amp;lt;&amp;lt; 7;&lt;br /&gt;
       sau&lt;br /&gt;
       - variadic argument. ex. asemeni sprintf(&amp;lt;format&amp;gt;, ...)&lt;br /&gt;
 - se va scrie o metoda prin care un consumator poate inregistra un callback&lt;br /&gt;
 - datele extrase vor fi trimise catre consumatorii inregistrati, sau printate pe consola, daca nu exista consumatori.&lt;br /&gt;
 Note: recomandarea este ca parametrul dat la functia de callback sa fie de tip shared_ptr&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele extrase de logger si le printeaza pe consola&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza intr-un fisier atunci cand apare o eroare.&lt;br /&gt;
 - datele primite vor fi salvate intr-un buffer circular de o dimensiune fixa.&lt;br /&gt;
 - la aparitia mesajului de eroare bufferul va fi copiat intr-un fisier si curatat.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - dimensiunea bufferului&lt;br /&gt;
      - calea catre fisierul de iesire (fisierul va avea in nume: numele modulului care a generat eroarea, cat si un timestamp)&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza in fisiere prin rotatie.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - nivelul minim al logurilor&lt;br /&gt;
      - numarul de fisiere&lt;br /&gt;
      - dimensiunea maxima pentru un fisier&lt;br /&gt;
      - calea catre fisierul de iesire&lt;br /&gt;
      - cazuri speciale: dimensiune=0, numarul de fisiere=0 =&amp;gt; nelimitat&lt;br /&gt;
      - la fiecare pornire aplicatia va continua scrierea din ultimul fisier editat(verificare timestamp)&lt;br /&gt;
 ex.&lt;br /&gt;
   log level minim = warning =&amp;gt; se vor printa doar mesaje de: warning, error, wtf&lt;br /&gt;
   dimensiune maxima = 5MB =&amp;gt; un fisier de log va avea maxim 5MB, o data ce dimensiunea este atinsa se va trece la un alt fisier. ex. file1.log (5MB) =&amp;gt; trecem la file2.log. cand aceasta va fi plin, trecem la file3.log&lt;br /&gt;
  odata ce numarul maxim de fisiere e atins ex. 3, sarim inapoi la primul fisier si il suprascriem.&lt;br /&gt;
&lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 A se defini si crea o procedura/componenta ce exemplifica prototype pattern.&amp;lt;br /&amp;gt;&lt;br /&gt;
 Se va permite initializarea unui numar maxim predefinit de componente. (will see from the document - initializare statica obiecte)&amp;lt;br /&amp;gt;&lt;br /&gt;
 Noile componente vor primi ca si parametru un obiect de tip json. Acest obiect se va presupune ca ar contine date de configurare&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
&lt;br /&gt;
===integrare===&lt;br /&gt;
 integrare cod din task 1 si task 3 pt a putea initializa alte componente in functie de un fisier text, ie. activarea loggerelor de la task 2&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 implementarea unui dispatcher de mesaje care ofera urmatorele doua functii: publish/subscribe&lt;br /&gt;
 (tinta e sa avem o metoda prin care componentele sa comunice intre ele. parametrii(string si un obiect 'nedefinit'). ie poti folosi pt a inregistra un callback, sau pur si simplu sa activezi un feature.)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 api pt creare timere&lt;br /&gt;
 (acoperit: chrono, lambda, bind)&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=37</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=37"/>
		<updated>2020-08-25T20:23:05Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* loggere */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Sa se scrie o componenta care va permite parsarea unui fisier.&lt;br /&gt;
 - se va crea un Dockerfile care sa permita compilarea si rularea aplicatiei.&lt;br /&gt;
 - se va testa integrarea librariei avand ca date de intrare atat un fisier valid cat si un fisier invalid folosind gtest.&lt;br /&gt;
 - se va exemplifica citirea unui nod&lt;br /&gt;
&lt;br /&gt;
 A se implementa pt:&lt;br /&gt;
  - json&lt;br /&gt;
  - xml&lt;br /&gt;
  - yaml&lt;br /&gt;
 (libjson, libxml, libyaml, ... sau alte librarii)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 Se se defineasca/scrie un modul care permite logarea de informatii.&lt;br /&gt;
 - functiile exportate vor trebui sa permita extragerea urmatoarelor date: &lt;br /&gt;
   - fisierul si linia de unde a fost apelata functia de logare.&lt;br /&gt;
   - nivelul logului (verbose, info, warning, error, wtf &amp;lt;- what a terrible failure.  primit ca parametru)&lt;br /&gt;
   - timpul curent&lt;br /&gt;
   - modulul (string primit ca parametru)&lt;br /&gt;
   - un mesaj (string primit ca parametru)&lt;br /&gt;
   - (bonus) &lt;br /&gt;
       - overload operatorul &amp;quot;&amp;lt;&amp;lt;&amp;quot; ex. sa putem scrie: Log_info(MODUL) &amp;lt;&amp;lt; &amp;quot;Hello World nbr. &amp;quot; &amp;lt;&amp;lt; 7;&lt;br /&gt;
       sau&lt;br /&gt;
       - variadic argument. ex. asemeni sprintf(&amp;lt;format&amp;gt;, ...)&lt;br /&gt;
 - se va scrie o metoda prin care un consumator poate inregistra un callback&lt;br /&gt;
 - datele extrase vor fi trimise catre consumatorii inregistrati, sau printate pe consola, daca nu exista consumatori.&lt;br /&gt;
 Note: recomandarea este ca parametrul dat la functia de callback sa fie de tip shared_ptr&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele extrase de logger si le printeaza pe consola&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza intr-un fisier atunci cand apare o eroare.&lt;br /&gt;
 - datele primite vor fi salvate intr-un buffer circular de o dimensiune fixa.&lt;br /&gt;
 - la aparitia mesajului de eroare bufferul va fi copiat intr-un fisier si curatat.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - dimensiunea bufferului&lt;br /&gt;
      - calea catre fisierul de iesire (fisierul va avea in nume: numele modulului care a generat eroarea, cat si un timestamp)&lt;br /&gt;
&lt;br /&gt;
 Sa se scrie un modul care consuma datele produse de logger si le printeaza in fisiere prin rotatie.&lt;br /&gt;
 - configurabil:&lt;br /&gt;
      - nivelul minim al logurilor&lt;br /&gt;
      - numarul de fisiere&lt;br /&gt;
      - dimensiunea maxima pentru un fisier&lt;br /&gt;
      - calea catre fisierul de iesire&lt;br /&gt;
      - cazuri speciale: dimensiune=0, numarul de fisiere=0 =&amp;gt; nelimitat&lt;br /&gt;
      - la fiecare pornire aplicatia va continua scrierea din ultimul fisier editat(verificare timestamp)&lt;br /&gt;
 ex.&lt;br /&gt;
   log level minim = warning =&amp;gt; se vor printa doar mesaje de: warning, error, wtf&lt;br /&gt;
   dimensiune maxima = 5MB =&amp;gt; un fisier de log va avea maxim 5MB, o data ce dimensiunea este atinsa se va trece la un alt fisier. ex. file1.log (5MB) =&amp;gt; trecem la file2.log. cand aceasta va fi plin, trecem la file3.log&lt;br /&gt;
  odata ce numarul maxim de fisiere e atins ex. 3, sarim inapoi la primul fisier si il suprascriem.&lt;br /&gt;
&lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 implementare prototype pattern&lt;br /&gt;
 (tinta e crearea unei metode prin care sa putem sa incarcam dinamic componentele viitoare. initializare statica obiecte.)&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
 &lt;br /&gt;
===integrare===&lt;br /&gt;
 integrare cod din task 1 si task 3 pt a putea initializa alte componente in functie de un fisier text, ie. activarea loggerelor de la task 2&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 implementarea unui dispatcher de mesaje care ofera urmatorele doua functii: publish/subscribe&lt;br /&gt;
 (tinta e sa avem o metoda prin care componentele sa comunice intre ele. parametrii(string si un obiect 'nedefinit'). ie poti folosi pt a inregistra un callback, sau pur si simplu sa activezi un feature.)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 api pt creare timere&lt;br /&gt;
 (acoperit: chrono, lambda, bind)&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=36</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=36"/>
		<updated>2020-08-25T20:19:58Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* config parser */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Sa se scrie o componenta care va permite parsarea unui fisier.&lt;br /&gt;
 - se va crea un Dockerfile care sa permita compilarea si rularea aplicatiei.&lt;br /&gt;
 - se va testa integrarea librariei avand ca date de intrare atat un fisier valid cat si un fisier invalid folosind gtest.&lt;br /&gt;
 - se va exemplifica citirea unui nod&lt;br /&gt;
&lt;br /&gt;
 A se implementa pt:&lt;br /&gt;
  - json&lt;br /&gt;
  - xml&lt;br /&gt;
  - yaml&lt;br /&gt;
 (libjson, libxml, libyaml, ... sau alte librarii)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 implementare de loggere: in fisier, consola, memorie(circular buffer). Fiecare logger va functiona independent, fara a bloca un altul.&lt;br /&gt;
 (tinta e familiarizare cu interfete, mostenire, shared pointers, decorator?)&lt;br /&gt;
 &lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 implementare prototype pattern&lt;br /&gt;
 (tinta e crearea unei metode prin care sa putem sa incarcam dinamic componentele viitoare. initializare statica obiecte.)&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
 &lt;br /&gt;
===integrare===&lt;br /&gt;
 integrare cod din task 1 si task 3 pt a putea initializa alte componente in functie de un fisier text, ie. activarea loggerelor de la task 2&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 implementarea unui dispatcher de mesaje care ofera urmatorele doua functii: publish/subscribe&lt;br /&gt;
 (tinta e sa avem o metoda prin care componentele sa comunice intre ele. parametrii(string si un obiect 'nedefinit'). ie poti folosi pt a inregistra un callback, sau pur si simplu sa activezi un feature.)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 api pt creare timere&lt;br /&gt;
 (acoperit: chrono, lambda, bind)&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Test_driven_development&amp;diff=35</id>
		<title>Test driven development</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Test_driven_development&amp;diff=35"/>
		<updated>2020-08-25T19:10:26Z</updated>

		<summary type="html">&lt;p&gt;Nicu: Created page with &amp;quot;Principiu de baza e ca inainte sa scriem o linie de cod functional, ar trebui sa definim un test.&amp;lt;br /&amp;gt; Orice modificare adusa codului ar trebui sa fie bazata pe o cerinta pe...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Principiu de baza e ca inainte sa scriem o linie de cod functional, ar trebui sa definim un test.&amp;lt;br /&amp;gt;&lt;br /&gt;
Orice modificare adusa codului ar trebui sa fie bazata pe o cerinta pe care sa o putem descrie mai intai printr-un test.&amp;lt;br /&amp;gt;&lt;br /&gt;
Ruland toate testele anterioare dupa fiecare modificare ne asiguram ca nu introducem regresii, deci ar trebui sa pierdem mult mai putin timp facand debug. &amp;lt;br /&amp;gt;&lt;br /&gt;
Dat fiind ca e greu sa satisfaci cerinta cea mai mare(&amp;quot;scrie aplicatia de facut placinte&amp;quot;), lucrul se sparge in cerinte mai mici si de o complexitate mai redusa(&amp;quot;implementeaza clasa x&amp;quot;/&amp;quot;scrie un algoritm de sortare&amp;quot;/...). Deci, prioritizam taskurile scurte in speranta ca in final nu vor exista taskuri complicate, ci doar mici modificari incrementale.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In linii mari:&lt;br /&gt;
* Adaugam un test&lt;br /&gt;
* Rulam toate testele, iar cel nou ar trebui sa pice.&lt;br /&gt;
* Scriem codul sa treaca &lt;br /&gt;
* Rulam toate testele din nou iar toate ar trebui sa treaca.&lt;br /&gt;
* Curatam codul/testele daca e necesar si verificam ca testele trec in continuare.&lt;br /&gt;
* Repetam&lt;br /&gt;
&lt;br /&gt;
Lucruri de tinut cont.&lt;br /&gt;
* Un test case nu ar trebui sa depinda de starea unui test anterior. Fara dependinte intre teste.&lt;br /&gt;
* Testele nu trebuie sa fie foarte complicate si sa testeze absolut toate scenariile&lt;br /&gt;
* Nu-i neaparat sa testam fiecare functie ajutatoare, dar ideal e sa testam toate interfetele publice&lt;br /&gt;
&lt;br /&gt;
==Google Test==&lt;br /&gt;
Pentru a facilita scriere de teste am putea folosi o librarie de la google numita gtest.&lt;br /&gt;
&lt;br /&gt;
Aceasta presupune crearea unei clase ce mosteneste testing::Test, in care putem implementa un set de functii ce vor fi rulate atunci cand pornim/oprim testarea(SetUpTestCase/TearDownTestCase) dar si cand rulam teste individuale(SetUp/TearDown).&lt;br /&gt;
&lt;br /&gt;
Exemplu:&lt;br /&gt;
 #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
 #include &amp;quot;gtest/gtest.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 namespace test&lt;br /&gt;
 {&lt;br /&gt;
   class Super_test: public testing::Test&lt;br /&gt;
   {&lt;br /&gt;
   protected:&lt;br /&gt;
      static void SetUpTestCase()&lt;br /&gt;
      {&lt;br /&gt;
         std::cout &amp;lt;&amp;lt; &amp;quot;Executam &amp;quot; &amp;lt;&amp;lt; __PRETTY_FUNCTION__ &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      }&lt;br /&gt;
 &lt;br /&gt;
      static void TearDownTestCase()&lt;br /&gt;
      {&lt;br /&gt;
         std::cout &amp;lt;&amp;lt; &amp;quot;Executam &amp;quot; &amp;lt;&amp;lt; __PRETTY_FUNCTION__ &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      }&lt;br /&gt;
 &lt;br /&gt;
      virtual void SetUp()&lt;br /&gt;
      {&lt;br /&gt;
         std::cout &amp;lt;&amp;lt; &amp;quot;Executam &amp;quot; &amp;lt;&amp;lt; __PRETTY_FUNCTION__ &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      }&lt;br /&gt;
 &lt;br /&gt;
      virtual void TearDown()&lt;br /&gt;
      {&lt;br /&gt;
         std::cout &amp;lt;&amp;lt; &amp;quot;Executam &amp;quot; &amp;lt;&amp;lt; __PRETTY_FUNCTION__ &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      }&lt;br /&gt;
   };&lt;br /&gt;
 } // namespace test&lt;br /&gt;
&lt;br /&gt;
Presupunand am parcurs cerintele putem scrie primul test folosindu'ne de un set de macrouri pe care le gasim in [https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h gtest.h]&lt;br /&gt;
&lt;br /&gt;
Exemplu:&lt;br /&gt;
 #include &amp;quot;functii_speciale.hpp&amp;quot;&lt;br /&gt;
 #include &amp;quot;super_test.hpp&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 namespace test&lt;br /&gt;
 {&lt;br /&gt;
   TEST_F(Super_test, test_to_pass)&lt;br /&gt;
   {&lt;br /&gt;
      std::cout &amp;lt;&amp;lt; &amp;quot;Executam &amp;quot; &amp;lt;&amp;lt; __PRETTY_FUNCTION__ &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      ASSERT_NO_THROW(functie_goala());&lt;br /&gt;
      EXPECT_EQ(1, 1);&lt;br /&gt;
      EXPECT_TRUE(true);&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   TEST_F(Super_test, test_to_fail)&lt;br /&gt;
   {&lt;br /&gt;
      std::cout &amp;lt;&amp;lt; &amp;quot;Executam &amp;quot; &amp;lt;&amp;lt; __PRETTY_FUNCTION__ &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      EXPECT_FALSE(true) &amp;lt;&amp;lt; &amp;quot;Daca vrem sa logam un mesaj mai descriptiv cand pica ....&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   TEST_F(Super_test, test_to_fail2)&lt;br /&gt;
   {&lt;br /&gt;
      std::cout &amp;lt;&amp;lt; &amp;quot;Executam &amp;quot; &amp;lt;&amp;lt; __PRETTY_FUNCTION__ &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      ASSERT_NO_THROW(functie_ce_arunca());&lt;br /&gt;
   }&lt;br /&gt;
 } // namespace test&lt;br /&gt;
&lt;br /&gt;
TEST_F indica un scenariu de test nou. Putem avea nenumarate scenarii in acelasi fisier.&amp;lt;br /&amp;gt;&lt;br /&gt;
Acesta primeste ca parametru clasa creata anterior si numele testului.&amp;lt;br /&amp;gt;&lt;br /&gt;
In interior descriem scenariul pe care il urmarim. ex. ne asteptam ca &amp;quot;functie_goala()&amp;quot; sa nu arunce o exceptie, sau ca 1==1, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
De notat: parametrii primiti pt EXPECT_EQ(), ca si conventie primul parametrul e valoarea asteptata, iar cel de'al doilea e valoarea reala.&amp;lt;br /&amp;gt;&lt;br /&gt;
Daca testul pica ne putem folosi de operatorul &amp;quot;&amp;lt;&amp;lt;&amp;quot; pt a afisa informatii aditionale. (ex. test_to_fail). Exemplu testezi ceva intr-o bucla si vrei sa stii iteratia la care a picat&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dupa ce am scris testul urmeaza sa facem implementarea propriu-zisa. In teorie testul e bun, dat fiind ca functiile folosite nu au existat anterior, programul nu compileaza :) Deci, le implementam si facem testul sa treaca&lt;br /&gt;
&lt;br /&gt;
Exemplu:&lt;br /&gt;
 namespace test&lt;br /&gt;
 {&lt;br /&gt;
   void functie_ce_arunca()&lt;br /&gt;
   {&lt;br /&gt;
      throw 1;&lt;br /&gt;
   }&lt;br /&gt;
   void functie_goala()&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Evident, tinta e sa scriem teste care trec si nu teste precum: test_to_fail / test_to_fail2&lt;br /&gt;
&lt;br /&gt;
==Build==&lt;br /&gt;
Ca sa putem compila aplicatia de test, trebuie sa linkam cu 3 librarii: gtest_main gtest  si pthread&lt;br /&gt;
&lt;br /&gt;
Evident se poate compila si fara gtest main cat timp adaugati propria voastra functie main:&lt;br /&gt;
 #include &amp;lt;gtest/gtest.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 int main(int argc, char **argv) {&lt;br /&gt;
    ::testing::InitGoogleTest(&amp;amp;argc, argv); &lt;br /&gt;
    return RUN_ALL_TESTS();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Exemplu makefile:&lt;br /&gt;
 OBJ_DIR := obj&lt;br /&gt;
 SRC_FILES := $(wildcard *.cpp)&lt;br /&gt;
 OBJ_FILES := $(patsubst %.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))&lt;br /&gt;
 &lt;br /&gt;
 CPP      := g++&lt;br /&gt;
 LDFLAGS  := -lgtest_main -lgtest -pthread&lt;br /&gt;
 CPPFLAGS := &lt;br /&gt;
 CXXFLAGS := &lt;br /&gt;
 &lt;br /&gt;
 test: $(OBJ_FILES)&lt;br /&gt;
 	$(CPP) $(LDFLAGS) $(INC) -o $@ $^&lt;br /&gt;
 &lt;br /&gt;
 $(OBJ_DIR)/%.o: %.cpp&lt;br /&gt;
 	mkdir -p $(OBJ_DIR)&lt;br /&gt;
 	$(CPP) $(CPPFLAGS) $(INC) $(CXXFLAGS) -c -o $@ $&amp;lt;&lt;br /&gt;
 	&lt;br /&gt;
 .PHONY: clean_test&lt;br /&gt;
 clean_test:&lt;br /&gt;
 	rm -rf $(OBJ_FILES) test&lt;br /&gt;
&lt;br /&gt;
==Run==&lt;br /&gt;
Putem sa rulam direct executabilul rezultat ceea ce ar duce la rularea tuturor testelor:&lt;br /&gt;
&lt;br /&gt;
./test&lt;br /&gt;
 [==========] Running 3 tests from 1 test case.&lt;br /&gt;
 [----------] Global test environment set-up.&lt;br /&gt;
 [----------] 3 tests from Super_test&lt;br /&gt;
 Executam static void test::Super_test::SetUpTestCase()&lt;br /&gt;
 [ RUN      ] Super_test.test_to_pass&lt;br /&gt;
 Executam virtual void test::Super_test::SetUp()&lt;br /&gt;
 Executam virtual void test::Super_test_test_to_pass_Test::TestBody()&lt;br /&gt;
 Executam virtual void test::Super_test::TearDown()&lt;br /&gt;
 [       OK ] Super_test.test_to_pass (0 ms)&lt;br /&gt;
 [ RUN      ] Super_test.test_to_fail&lt;br /&gt;
 Executam virtual void test::Super_test::SetUp()&lt;br /&gt;
 Executam virtual void test::Super_test_test_to_fail_Test::TestBody()&lt;br /&gt;
 test_component.cpp:26: Failure&lt;br /&gt;
 Value of: true&lt;br /&gt;
   Actual: true&lt;br /&gt;
 Expected: false&lt;br /&gt;
 Daca vrem sa logam un mesaj mai descriptiv cand pica ....&lt;br /&gt;
 Executam virtual void test::Super_test::TearDown()&lt;br /&gt;
 [  FAILED  ] Super_test.test_to_fail (0 ms)&lt;br /&gt;
 [ RUN      ] Super_test.test_to_fail2&lt;br /&gt;
 Executam virtual void test::Super_test::SetUp()&lt;br /&gt;
 Executam virtual void test::Super_test_test_to_fail2_Test::TestBody()&lt;br /&gt;
 test_component.cpp:32: Failure&lt;br /&gt;
 Expected: functie_ce_arunca() doesn't throw an exception.&lt;br /&gt;
   Actual: it throws.&lt;br /&gt;
 Executam virtual void test::Super_test::TearDown()&lt;br /&gt;
 [  FAILED  ] Super_test.test_to_fail2 (0 ms)&lt;br /&gt;
 Executam static void test::Super_test::TearDownTestCase()&lt;br /&gt;
 [----------] 3 tests from Super_test (0 ms total)&lt;br /&gt;
 &lt;br /&gt;
 [----------] Global test environment tear-down&lt;br /&gt;
 [==========] 3 tests from 1 test case ran. (0 ms total)&lt;br /&gt;
 [  PASSED  ] 1 test.&lt;br /&gt;
 [  FAILED  ] 2 tests, listed below:&lt;br /&gt;
 [  FAILED  ] Super_test.test_to_fail&lt;br /&gt;
 [  FAILED  ] Super_test.test_to_fail2&lt;br /&gt;
 &lt;br /&gt;
 2 FAILED TESTS&lt;br /&gt;
&lt;br /&gt;
Sau putem rula teste individuale.&lt;br /&gt;
Exemplu: rulam toate testele care se termina in pass.&lt;br /&gt;
&lt;br /&gt;
./test --gtest_filter=*_pass&lt;br /&gt;
 Note: Google Test filter = *_pass&lt;br /&gt;
 [==========] Running 1 test from 1 test case.&lt;br /&gt;
 [----------] Global test environment set-up.&lt;br /&gt;
 [----------] 1 test from Super_test&lt;br /&gt;
 Executam static void test::Super_test::SetUpTestCase()&lt;br /&gt;
 [ RUN      ] Super_test.test_to_pass&lt;br /&gt;
 Executam virtual void test::Super_test::SetUp()&lt;br /&gt;
 Executam virtual void test::Super_test_test_to_pass_Test::TestBody()&lt;br /&gt;
 Executam virtual void test::Super_test::TearDown()&lt;br /&gt;
 [       OK ] Super_test.test_to_pass (0 ms)&lt;br /&gt;
 Executam static void test::Super_test::TearDownTestCase()&lt;br /&gt;
 [----------] 1 test from Super_test (0 ms total)&lt;br /&gt;
 &lt;br /&gt;
 [----------] Global test environment tear-down&lt;br /&gt;
 [==========] 1 test from 1 test case ran. (1 ms total)&lt;br /&gt;
 [  PASSED  ] 1 test.&lt;br /&gt;
&lt;br /&gt;
Pentru parametrii aditionali ce pot fi dati aplicatiei, folositi parametrul help&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu: listarea testelor existente, rularea in bucla, ordinea testelor, etc.&lt;br /&gt;
&lt;br /&gt;
./test --help&lt;br /&gt;
 This program contains tests written using Google Test. You can use the&lt;br /&gt;
 following command line flags to control its behavior:&lt;br /&gt;
 &lt;br /&gt;
 Test Selection:&lt;br /&gt;
  --gtest_list_tests&lt;br /&gt;
      List the names of all tests instead of running them. The name of&lt;br /&gt;
      TEST(Foo, Bar) is &amp;quot;Foo.Bar&amp;quot;.&lt;br /&gt;
  --gtest_filter=POSTIVE_PATTERNS[-NEGATIVE_PATTERNS]&lt;br /&gt;
      Run only the tests whose name matches one of the positive patterns but&lt;br /&gt;
      none of the negative patterns. '?' matches any single character; '*'&lt;br /&gt;
      matches any substring; ':' separates two patterns.&lt;br /&gt;
  --gtest_also_run_disabled_tests&lt;br /&gt;
      Run all disabled tests too.&lt;br /&gt;
 &lt;br /&gt;
 Test Execution:&lt;br /&gt;
  --gtest_repeat=[COUNT]&lt;br /&gt;
      Run the tests repeatedly; use a negative count to repeat forever.&lt;br /&gt;
  --gtest_shuffle&lt;br /&gt;
      Randomize tests' orders on every iteration.&lt;br /&gt;
  --gtest_random_seed=[NUMBER]&lt;br /&gt;
      Random number seed to use for shuffling test orders (between 1 and&lt;br /&gt;
      99999, or 0 to use a seed based on the current time).&lt;br /&gt;
 &lt;br /&gt;
 Test Output:&lt;br /&gt;
  --gtest_color=(yes|no|auto)&lt;br /&gt;
      Enable/disable colored output. The default is auto.&lt;br /&gt;
  --gtest_print_time=0&lt;br /&gt;
      Don't print the elapsed time of each test.&lt;br /&gt;
  --gtest_output=(json|xml)[:DIRECTORY_PATH/|:FILE_PATH]&lt;br /&gt;
      Generate a JSON or XML report in the given directory or with the given&lt;br /&gt;
      file name. FILE_PATH defaults to test_details.xml.&lt;br /&gt;
  --gtest_stream_result_to=HOST:PORT&lt;br /&gt;
      Stream test results to the given server.&lt;br /&gt;
 &lt;br /&gt;
 Assertion Behavior:&lt;br /&gt;
  --gtest_death_test_style=(fast|threadsafe)&lt;br /&gt;
      Set the default death test style.&lt;br /&gt;
  --gtest_break_on_failure&lt;br /&gt;
      Turn assertion failures into debugger break-points.&lt;br /&gt;
  --gtest_throw_on_failure&lt;br /&gt;
      Turn assertion failures into C++ exceptions for use by an external&lt;br /&gt;
      test framework.&lt;br /&gt;
  --gtest_catch_exceptions=0&lt;br /&gt;
      Do not report exceptions as test failures. Instead, allow them&lt;br /&gt;
      to crash the program or throw a pop-up (on Windows).&lt;br /&gt;
 &lt;br /&gt;
 Except for --gtest_list_tests, you can alternatively set the corresponding&lt;br /&gt;
 environment variable of a flag (all letters in upper-case). For example, to&lt;br /&gt;
 disable colored text output, you can either specify --gtest_color=no or set&lt;br /&gt;
 the GTEST_COLOR environment variable to no.&lt;br /&gt;
 &lt;br /&gt;
 For more information, please read the Google Test documentation at&lt;br /&gt;
 https://github.com/google/googletest/. If you find a bug in Google Test&lt;br /&gt;
 (not one in your own code or tests), please report it to&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Linux_Rampup&amp;diff=34</id>
		<title>Linux Rampup</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Linux_Rampup&amp;diff=34"/>
		<updated>2020-08-19T21:17:02Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Dat fiind ca tinta e mai mult C++ training si nu exista o stransa legatura cu Linux, daca am folosi librarii mai mari precum boost/wxwidgets/qt, diferentele dintre os'uri nu prea mai conteaza.&lt;br /&gt;
&lt;br /&gt;
===Idei potentiale===&lt;br /&gt;
* https://bootlin.com/doc/legacy/command-line/unix_linux_introduction.pdf&lt;br /&gt;
## cum e organizat filesystemul&lt;br /&gt;
## permisiuni&lt;br /&gt;
## comenzi uzuale&lt;br /&gt;
## pipe-uri&lt;br /&gt;
## bash&lt;br /&gt;
## daemoni?&lt;br /&gt;
## IPC?&lt;br /&gt;
## simple device driver?&lt;br /&gt;
&lt;br /&gt;
Dar mai interesant si probabil mai util:&lt;br /&gt;
&lt;br /&gt;
* https://www.docker.com/&lt;br /&gt;
## [http://wiki.natea.ro/index.php/Docker cum creem un container]&lt;br /&gt;
## [http://wiki.natea.ro/index.php/Docker cum rulam un container]&lt;br /&gt;
&lt;br /&gt;
* https://www.yoctoproject.org/&lt;br /&gt;
## cum configuram o distributie&lt;br /&gt;
## cum adaugam/actualizam o reteta&lt;br /&gt;
## cum pornim un emulator&lt;br /&gt;
## flashing?&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=33</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=33"/>
		<updated>2020-08-19T21:16:25Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/C%2B%2B_Rampup C++ Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Generic_application Generic application]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Linux_Rampup Linux Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Docker Docker]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=32</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=32"/>
		<updated>2020-08-19T21:15:08Z</updated>

		<summary type="html">&lt;p&gt;Nicu: /* Crearea unui container */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Instalare docker=&lt;br /&gt;
 Windows: https://www.docker.com/get-started&lt;br /&gt;
 Alta distributie: https://docs.docker.com/engine/install/debian/&lt;br /&gt;
&lt;br /&gt;
'''Note:''' docker are nevoie de hyper-v, asa ca e posibil sa creeze un conflict cu ceva ce se bazeaza ca acesta sa fie dezactivat(ex. virtualbox) =&amp;gt; any thoughts of getting around it are appreciated.&lt;br /&gt;
&lt;br /&gt;
=Ganduri zburdalnice pe Linux=&lt;br /&gt;
Ca sa puteti rulati docker ca si utilizator normal:&lt;br /&gt;
  sudo usermod -aG docker ${USER}&lt;br /&gt;
  restart / logout&lt;br /&gt;
&lt;br /&gt;
Ca sa porneasca automat:&lt;br /&gt;
  sudo systemctl enable docker&lt;br /&gt;
  sudo systemctl start docker&lt;br /&gt;
&lt;br /&gt;
=Crearea unui container=&lt;br /&gt;
Pentru crearea unui container ne vom defini un fisier de tip Dockerfile. ex:&lt;br /&gt;
 FROM debian:stretch-slim&lt;br /&gt;
 &lt;br /&gt;
 LABEL &amp;quot;description&amp;quot;=&amp;quot;Docker image for building and running a generic app&amp;quot;&lt;br /&gt;
 LABEL &amp;quot;author&amp;quot;=&amp;quot;nicolae.natea&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 ENV CLEANUP &amp;quot;set -xe &amp;amp;&amp;amp; apt-get autoclean &amp;amp;&amp;amp; apt-get clean &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/*&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Cleanup&lt;br /&gt;
 RUN set -xe &amp;amp;&amp;amp; apt-get update &amp;amp;&amp;amp; apt-get -y upgrade &amp;amp;&amp;amp; ${CLEANUP}&lt;br /&gt;
 &lt;br /&gt;
 RUN apt-get install -y make build-essential g++ cmake curl gdbserver &amp;amp;&amp;amp; ${CLEANUP}&lt;br /&gt;
 &lt;br /&gt;
 # Setting the command to launch&lt;br /&gt;
 CMD [&amp;quot;bash&amp;quot;, &amp;quot;-l&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
In cadrul fisierului descriem:&lt;br /&gt;
* distributia de la care pornim(ie. debian:stretch-slim)&lt;br /&gt;
* putem seta diverse atribute pt container precum descriere/autor&lt;br /&gt;
* putem defini o variabila pe care sa o reutilizam precum CLEANUP&lt;br /&gt;
* rulam niste comenzi ca si cum am fi in interiorul distributiei(ie. actualizare, instalat toolchain)&lt;br /&gt;
* putem copia un fisier extern in interiorul containerului. ex:&lt;br /&gt;
 # Add additional files&lt;br /&gt;
 COPY entrypoint.sh /bin/entrypoint.sh&lt;br /&gt;
* putem schimba permisiuni si seta ca acel fisier sa ruleze la pornirea containerului&lt;br /&gt;
 RUN chmod +x /bin/entrypoint.sh&lt;br /&gt;
 ENTRYPOINT [&amp;quot;/bin/entrypoint.sh&amp;quot;]&lt;br /&gt;
* and much more ...&lt;br /&gt;
&lt;br /&gt;
Pt a crea imaginea vom rula comanda&lt;br /&gt;
 $ docker image build -t nna/generic_builder:latest .&lt;br /&gt;
 unde nna/generic_builder:latest reprezinta un tag prin care identificam imaginea&lt;br /&gt;
 se presupune ca fisierul cu denumirea Dockerfile se afla in directorul curent. altfel poate fi specificat adaugand: -f &amp;quot;&amp;lt;cale&amp;gt;/Dockerfile&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Daca totul decurge ok, putem verifica cum ca imaginea a fost creata ok ruland comanda:&lt;br /&gt;
 $ docker images&lt;br /&gt;
 REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE&lt;br /&gt;
 nna/generic_builder   latest              963fd255c1fd        4 hours ago         391MB&lt;br /&gt;
&lt;br /&gt;
Pornirea unui container poate fi facuta folosind comanda:&lt;br /&gt;
 $ docker run -i -t nna/generic_builder&lt;br /&gt;
&lt;br /&gt;
Parametrii aditionali mai interesanti ce pot fi pasati comenzii run:&lt;br /&gt;
* -h, --hostname string                Container host name&lt;br /&gt;
* -v, --volume list                    Bind mount a volume&lt;br /&gt;
* -w, --workdir string                 Working directory inside the container&lt;br /&gt;
* -e, --env list                       Set environment variables&lt;br /&gt;
* etc... docker run --help&lt;br /&gt;
ie. docker run -i -h builder -e USER_NAME=${USER} -e USER_ID=`id -u ${USER}` -v ${PWD}:${PWD} -w ${PWD} -t nna/generic_builder&lt;br /&gt;
 -v ${PWD}:${PWD} -&amp;gt; mapam directorul curent la directorul cu acelasi nume din cadrul containerului&lt;br /&gt;
 -w ${PWD} -&amp;gt; setam calea curenta ca si cale de start in interiorul containerului&lt;br /&gt;
 -e USER_NAME=${USER} -&amp;gt; setam o variabila de sistem USER_NAME in interiorul containerului cu valoarea userului curent&lt;br /&gt;
 -h=builder -&amp;gt; setam ca hostul sa fie builder&lt;br /&gt;
&lt;br /&gt;
Dupa ce rulati comanda de mai sus veti vedea ca sunteti logati ca si root. un lucru pe care l-am putea face prin entrypoint.sh, ar fi sa folosim valoarile primite prin variabile de sistem pt a schimba utilizatorul curent (groupadd / useradd / su). etc.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' putem sa ne facem containerul public pe docker hub, daca ne creem un utilizator. Pentru aceasta am folosi comanda: '''docker push &amp;lt;nume imagine&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
=Utilizarea unui container existent (gitlab-ce)=&lt;br /&gt;
Putem folosi un container existent pe care sa il downloadam dintr-un repository privat sau cel public.&lt;br /&gt;
&lt;br /&gt;
Am putea sa ne aducem o imagine local(ex. versiunea comunity pentru gitlab) folosind comanda:&lt;br /&gt;
 docker pull gitlab/gitlab-ce:latest&lt;br /&gt;
&lt;br /&gt;
Cu toate astea, e adusa automat local daca nu exista atunci cand rulam comanda cu run:&lt;br /&gt;
 docker run --detach \&lt;br /&gt;
   --hostname localhost \&lt;br /&gt;
   --publish 443:443 --publish 80:80 --publish 22:22 \&lt;br /&gt;
   --name gitlab \&lt;br /&gt;
   --restart always \&lt;br /&gt;
   --volume $HOME/gitlab/config:/etc/gitlab \&lt;br /&gt;
   --volume $HOME/gitlab/logs:/var/log/gitlab \&lt;br /&gt;
   --volume $HOME/gitlab/data:/var/opt/gitlab \&lt;br /&gt;
   gitlab/gitlab-ce:latest&lt;br /&gt;
&lt;br /&gt;
In comanda de mai sus pornim un server de gitlab comunity edition:&lt;br /&gt;
* --detach =&amp;gt; containerul va rula in background&lt;br /&gt;
* --publish &amp;lt;local port&amp;gt;:&amp;lt;container port&amp;gt; =&amp;gt; mapam portul din container la portul local.&lt;br /&gt;
* --restart always =&amp;gt; in cazul in care moare containerul, vrem sa reporneasca automat&lt;br /&gt;
* --volume &amp;lt;cai&amp;gt; =&amp;gt; mapeaza niste cai permanente unde vor fi tinute configuratiile si proiectele&lt;br /&gt;
* --name gitlab =&amp;gt; un nume atribuit containerului. vizibil daca dati comanda: '''docker container list'''&lt;br /&gt;
&lt;br /&gt;
Gitlab nu porneste incredibil de rapid mai ales prima oara, asa ca putem sa ne atasam sa urmarim logurile folosind comanda:&lt;br /&gt;
 docker logs -f gitlab&lt;br /&gt;
&lt;br /&gt;
Dupa vre-un minut/doua putem sa accesam din browser: http://localhost (port 80), https://localhost (port 443), iar 22 e portul pt ssh folosit pentru git&lt;br /&gt;
&lt;br /&gt;
=Further steps=&lt;br /&gt;
Atasez la un container ce ruleaza: '''docker attach ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Salvarea starii curente a unui container intr-o imagine noua '''docker commit ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Listare imagini: '''docker image list'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Stergere imagine: '''docker image rm ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Listare container ce ruleaza: '''docker container list'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Restart container: '''docker restart ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Oprire fortata container: '''docker kill ...'''&amp;lt;br /&amp;gt;&lt;br /&gt;
etc. foarte stufos&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Comanda '''docker --help''' e foarte utila.&amp;lt;br /&amp;gt;&lt;br /&gt;
Deasemenea putem da ca si parametrii help si pt subcomenzi: ex. '''docker run --help'''&lt;br /&gt;
&lt;br /&gt;
=Integrare cu eclipse=&lt;br /&gt;
Instalam eclipse CDT: https://www.eclipse.org/downloads/&lt;br /&gt;
&lt;br /&gt;
Ideal ar fi sa ne instalam cateva extensii in cadrul eclipse din: ''Help -&amp;gt; Install new software''&lt;br /&gt;
* Docker Tooling&lt;br /&gt;
* C/C++ Docker Launch....&lt;br /&gt;
[[File:eclipse_dependencies.gif]]&lt;br /&gt;
&lt;br /&gt;
Dupa asta putem crea un proiect nou:&lt;br /&gt;
 File -&amp;gt; New -&amp;gt; Other -&amp;gt; C++ Project -&amp;gt; Makefile Project -&amp;gt; Hello world -&amp;gt; ....&lt;br /&gt;
Configuram proiectul pentru a folosi containerul anterior creat&lt;br /&gt;
 Click dreapta pe proiectul creat: Properties -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; Container Settings -&amp;gt; Bifam &amp;quot;build inside docker image&amp;quot;&lt;br /&gt;
 Aditional putem indica niste directoare pe care ni le dorim mapate&lt;br /&gt;
 Apply&lt;br /&gt;
Si suntem pregatiti pentru a compila si rula aplicatia in interiorul containerului&amp;lt;br /&amp;gt;&lt;br /&gt;
'''Note:''' Pentru debug se presupune ca aveti gdb pe host(ar trebui sa fie daca ati adaugat caile catre MinGW si l-ati bifat cand ati instalat)&lt;br /&gt;
&lt;br /&gt;
[[File:eclipse_new_project.gif]]&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=31</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=31"/>
		<updated>2020-08-19T21:11:55Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=30</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=30"/>
		<updated>2020-08-19T21:11:32Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=29</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=29"/>
		<updated>2020-08-19T21:08:52Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=28</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=28"/>
		<updated>2020-08-19T20:50:07Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=File:Eclipse_new_project.gif&amp;diff=27</id>
		<title>File:Eclipse new project.gif</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=File:Eclipse_new_project.gif&amp;diff=27"/>
		<updated>2020-08-19T20:20:22Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=File:Eclipse_dependencies.gif&amp;diff=26</id>
		<title>File:Eclipse dependencies.gif</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=File:Eclipse_dependencies.gif&amp;diff=26"/>
		<updated>2020-08-19T20:20:04Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=25</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=25"/>
		<updated>2020-08-19T20:19:50Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=24</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=24"/>
		<updated>2020-08-19T20:08:38Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=23</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=23"/>
		<updated>2020-08-19T20:06:10Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Docker&amp;diff=22</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Docker&amp;diff=22"/>
		<updated>2020-08-19T20:05:24Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Linux_Rampup&amp;diff=21</id>
		<title>Linux Rampup</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Linux_Rampup&amp;diff=21"/>
		<updated>2020-08-18T20:30:45Z</updated>

		<summary type="html">&lt;p&gt;Nicu: Created page with &amp;quot;Dat fiind ca tinta e mai mult C++ training si nu exista o stransa legatura cu Linux, daca am folosi librarii mai mari precum boost/wxwidgets/qt, diferentele dintre os'uri nu p...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Dat fiind ca tinta e mai mult C++ training si nu exista o stransa legatura cu Linux, daca am folosi librarii mai mari precum boost/wxwidgets/qt, diferentele dintre os'uri nu prea mai conteaza.&lt;br /&gt;
&lt;br /&gt;
===Idei potentiale===&lt;br /&gt;
* https://bootlin.com/doc/legacy/command-line/unix_linux_introduction.pdf&lt;br /&gt;
## cum e organizat filesystemul&lt;br /&gt;
## permisiuni&lt;br /&gt;
## comenzi uzuale&lt;br /&gt;
## pipe-uri&lt;br /&gt;
## bash&lt;br /&gt;
## daemoni?&lt;br /&gt;
## IPC?&lt;br /&gt;
## simple device driver?&lt;br /&gt;
&lt;br /&gt;
Dar mai interesant si probabil mai util:&lt;br /&gt;
&lt;br /&gt;
* https://www.docker.com/&lt;br /&gt;
## cum creem un container&lt;br /&gt;
## cum rulam un container&lt;br /&gt;
&lt;br /&gt;
* https://www.yoctoproject.org/&lt;br /&gt;
## cum configuram o distributie&lt;br /&gt;
## cum adaugam/actualizam o reteta&lt;br /&gt;
## cum pornim un emulator&lt;br /&gt;
## flashing?&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=20</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Main_Page&amp;diff=20"/>
		<updated>2020-08-18T20:19:42Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/C%2B%2B_Rampup C++ Rampup]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Generic_application Generic application]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://wiki.natea.ro/index.php/Linux_Rampup Linux Rampup]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=19</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=19"/>
		<updated>2020-08-18T20:17:03Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Am putea implementa o aplicatie simpla pe care sa cadem de comun acord. (ex. multiplayer snake, sudoku, ...)&amp;lt;br /&amp;gt;&lt;br /&gt;
In functie de progres ar trebui sa decidem daca lucram cu totii la aceeasi aplicatie in comun sau individual.&amp;lt;br /&amp;gt;&lt;br /&gt;
Lucru la comun ar accelera terminarea implementarii dar dezavantajul este ca nu am avea destul de multe taskuri in aceleasi arii astfel incat fiecare sa abordeze un anumit subiect. Astfel eu sunt pentru lucru individual si dezbatut solutii, deoarece cred ca notiuniile nu-s extrem de complicate, dar mai importanta e practica.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ca si parte practica, as merge pe ideea de dezvoltare de componente intr-o aplicatie monolitica, unde o componenta contine:&lt;br /&gt;
* surse&lt;br /&gt;
* teste unitare folosind gtest&lt;br /&gt;
* documentatie in stil doxygen, plus un Readme.md&lt;br /&gt;
&lt;br /&gt;
Dat fiind ca am putea merge pe ideea de generic application, am putea implementa un mini-framework care sa ne permita sa facem debug pe aplicatie, iar mai tarziu sa alegem o tema mai precisa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Tasks=&lt;br /&gt;
===config parser===&lt;br /&gt;
 Componenta care sa permita parsarea unui json/xml - in principiu doar link cu libjson si afisat pe consola&lt;br /&gt;
 (tinta ar fi sa avem o metoda standard sa configuram aplicatia dintr-un fisier. eventual o introducere in gtest si definirea 'way of working'-ului.)&lt;br /&gt;
&lt;br /&gt;
===loggere===&lt;br /&gt;
 implementare de loggere: in fisier, consola, memorie(circular buffer). Fiecare logger va functiona independent, fara a bloca un altul.&lt;br /&gt;
 (tinta e familiarizare cu interfete, mostenire, shared pointers, decorator?)&lt;br /&gt;
 &lt;br /&gt;
===metoda initializare componente===&lt;br /&gt;
 implementare prototype pattern&lt;br /&gt;
 (tinta e crearea unei metode prin care sa putem sa incarcam dinamic componentele viitoare. initializare statica obiecte.)&lt;br /&gt;
 Resurse: http://www.cs.sjsu.edu/faculty/pearce/modules/lectures/oop/types/reflection/prototype.htm&lt;br /&gt;
 &lt;br /&gt;
===integrare===&lt;br /&gt;
 integrare cod din task 1 si task 3 pt a putea initializa alte componente in functie de un fisier text, ie. activarea loggerelor de la task 2&lt;br /&gt;
&lt;br /&gt;
===implementarea unui dispatcher===&lt;br /&gt;
 implementarea unui dispatcher de mesaje care ofera urmatorele doua functii: publish/subscribe&lt;br /&gt;
 (tinta e sa avem o metoda prin care componentele sa comunice intre ele. parametrii(string si un obiect 'nedefinit'). ie poti folosi pt a inregistra un callback, sau pur si simplu sa activezi un feature.)&lt;br /&gt;
&lt;br /&gt;
===timere===&lt;br /&gt;
 api pt creare timere&lt;br /&gt;
 (acoperit: chrono, lambda, bind)&lt;br /&gt;
&lt;br /&gt;
===choose an app===&lt;br /&gt;
 start dezvoltare componente folosind api-ul anterior&lt;br /&gt;
 I. componenta ce deschide un socket si primeste comenzi pe care le transmite mai departe folosind mecanismul de la pasul 5.&lt;br /&gt;
 (acoperit: boost:asio, rest, cgi?)&lt;br /&gt;
 II. implementarea unor componente ce pot persista date: 1. in fisier, 2, intr-o baza de date.&lt;br /&gt;
 (acoperit: sql)&lt;br /&gt;
 III. componenta care sa ne permita sa citim o variabila din memorie data fiind o adresa.&lt;br /&gt;
 (acoperit: objdump)&lt;br /&gt;
 IV. componenta ce deschide un stream (ne putem imagina o aplicatie de remote desktop sau vizualizat un filmulet)&lt;br /&gt;
 (acoperit: gstreamear)&lt;br /&gt;
 V. componenta de autentificare pe baza de token&lt;br /&gt;
 ....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vedere de ansamblu=&lt;br /&gt;
Vom folosi prototype pattern pt a crea copii de obiecte si a putea activa dinamic diverse trasaturi suportate de aplicatia noastra fara a adauga modificari in cod. Trasaturile vor fi suportate automat fara a adauga cod explicit de initializare intr-o functie comuna, prin simpla includere a surselor in procesul de compilare.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sa presupunem ca am avea un fisier de configurare:&lt;br /&gt;
 {&lt;br /&gt;
    &amp;quot;logging&amp;quot;: {&lt;br /&gt;
       &amp;quot;enabled&amp;quot;: {&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;},&lt;br /&gt;
       &amp;quot;level&amp;quot;: DEBUG&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;components&amp;quot; : {&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;screen&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;converter&amp;quot;: {&lt;br /&gt;
           &amp;quot;filter&amp;quot;: &amp;quot;bw&amp;quot;,&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;JPG_FRAME_IN&amp;quot;,&lt;br /&gt;
           &amp;quot;dst-msg-id&amp;quot;: &amp;quot;JPG_FRAME_OUT&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;streamer&amp;quot;: {&lt;br /&gt;
           &amp;quot;source&amp;quot;: &amp;quot;message&amp;quot;,&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;,&lt;br /&gt;
           &amp;quot;dest&amp;quot;: &amp;quot;network&amp;quot;,&lt;br /&gt;
           &amp;quot;dest-port&amp;quot;: 8080&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;viewer&amp;quot;: {&lt;br /&gt;
           &amp;quot;src-msg-id&amp;quot;: &amp;quot;H264_FRAME_OUT&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Chiar daca aplicatia noastra suporta mai multe componente, conform fisierului de configurare se vor activa 2 loggere(&amp;quot;console&amp;quot;, &amp;quot;error&amp;quot;) si inca 3 componente distincte. O componenta de tip 'streamer' care conform fisierului va face o captura de ecran si o va transmite mai departe in cadrul aplicatiei prin intermediul dispatcherului, la o componenta de tip 'converter', care va aplica un filtru si va lansa un mesaj ce va fi interceptat atat de o alta componenta de tip streamer(care va transmite in retea rezultatul), cat si de o componenta de tip viewer care ar putea sa-i afiseze utilizatorului rezultatul transmis.&amp;lt;br /&amp;gt;&lt;br /&gt;
Exemplu e putin exagerat, dar ideea este ca ceea ce o sa faca aplicatia poate fi configurat dintr-un fisier text. Putem avea aplicatii multiple care consuma aceleasi mesaje dar fac lucruri total diferite.&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=18</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=18"/>
		<updated>2020-08-18T20:10:58Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=17</id>
		<title>Generic application</title>
		<link rel="alternate" type="text/html" href="http://wiki.natea.ro/index.php?title=Generic_application&amp;diff=17"/>
		<updated>2020-08-18T20:06:22Z</updated>

		<summary type="html">&lt;p&gt;Nicu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nicu</name></author>
		
	</entry>
</feed>