Open main menu

Wiki-Orange Pi β

Changes

Orange Pi I96

8,935 bytes added, 16:31, 21 June 2022
no edit summary
  /dev/sdc is the mounted number on system of SD card.
* Nand update
There will be corespondent image on the directory of */trunk/out/target/product/etu**/ after compilation. Update the image into system with NAND update tool. About the details steps you could refer to How to update Android Nand in the manual.<br><br>=== '''Compile Linux source Code''' ===<br> Linux source code of Orange Pi i96 has been updated to github, you could download from github. Compile Linux would require you work under Linux environment. We would recommend you use Ubuntu 16.04 of Linux PC.<br>* Download Linux source code You could download Linux source code from github:<br>[https://github.com/OrangePiLibra/OrangePi <span style="color:#42a0e5;">https://github.com/OrangePiLibra/OrangePi</span>]<br> You could also use git command to update:<br>  git clone https://github.com/OrangePiLibra/OrangePi.git* Compile source codeUse the following command to enter into source code directory:<br>  cd */OrangePi<br>Execute the following script:<br>  ./Build_OrangePi.sh<br>Input root password:<div style="padding-left:200px;">[[文件:Orange-pi-i96-img37.png|600px]]</div><br>After root password recognize successful, enter inter main interface and use Enter key. <div style="padding-left:200px;">[[文件:Orange-pi-i96-img38.png|600px]]</div><br>Select “Build system with kernel/uboot/rootfs” on main functional interface and use Enter key.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img39.png|600px]]</div><br>And then select “OrangePi I96” with Enter key to update source code.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img40.png|600px]]</div><br> It would take around 40minutes to update source code and corresponding scripts. After updated the source code, there will be generated a directory of OrangePi_i96. This directory contains both Linux source code and scripts:<div style="padding-left:200px;">[[文件:Orange-pi-i96-img41.png|600px]]</div><br>* Compile Linux<br>Execute the following command after enter into directory of OrangePiRDA: ./build.sh<br> The script is is an automatic script, you could select a corresponding board which you want to compile, here is “OrangePi I96”.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img42.png|600px]]</div><br> If it is the first time you run the script, the system would install development tool automatic to make sure the network is connecting.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img43.png|600px]]</div><br>After installed tool, enter root password and use Enter key.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img44.png|600px]]</div><br>You will enter into the main interface after entering password, select what you are going to do:<div style="padding-left:200px;">[[文件:Orange-pi-i96-img45.png|600px]]</div><br>This version is only support the above three options. After selecting the corresponding option, the system would compile automatically.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img46.png|600px]]</div><br>There will be prompt the location of kernel image and module after compilation.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img47.png|600px]]</div><br>* Update Linux Kernel and module After finished the above compilation steps, you could update the new kernel and module into the board to run it. Before this, you could refer to the charter about Linux image writing section to write a Linux distro into SD card. After written image, insert SD card into PC and till now it would recognize there are two partitions, one is boot partition with file of uboot, kernel and Ramdisk. The other partition is rootfs partion which contains root file system.<br> There is already marked the location of generated kernel, you only need to copy the generated zImage into first partition of SD card and replace zImage inside. Till now the kernel has been updated.<br> And there is already marked the location of new generated module, the second SD card partition is Rootfs partition, you need to have root permission to delete the directory of rootfs/lib/modules/3.xxx with following command:<br> sudo rm -rf */rootfs/lib/modules/3.xxx<br>Copy the new generated module into rootfs partition you need to use the following command:<br>sudo cp -rf */OrangePiRDA/output/lib/modules/3.xxx */rootfs/lib/modules/ sync<br>After all above steps, kernel and module update have been finished.<br>You could insert SD card into Orange pi, and make the jumper like the following, after booting, it would enter into Linux.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img48.png|600px]]</div><br>== '''Orange Pi Driver development''' ==<br> In order to help developers more familiar with Orange Pi, this instruction will make a brief illustration on device driver module and application program. <br><br>Hardware: Orange Pi development board*1, Card reader*1, TF card*1, power supply*1<div style="padding-left:200px;">[[文件:Orange-pi-i96-img49.png|600px]]</div><br>=== '''Device driver and application programming''' ===<br>'''1)Application Program (app.c)'''<br><br><div style="padding-left:200px;">[[文件:Orange-pi-i96-img50.png|600px]]</div><br>'''2)Driver Program (OrangePi_misc.c)'''<br><br><div style="padding-left:200px;">[[文件:Orange-pi-i96-img51.png|600px]]</div><br><div style="padding-left:200px;">[[文件:Orange-pi-i96-img52.png|600px]]</div><br>=== '''Compile device driver''' ===<br>Copy the OrangePi_misc.c to the */trunk/kernel/driver/misc:<br>Enter to */trunk/kernel/driver/misc<br>Modify Makefile on currently file, shown as following:<div style="padding-left:200px;">[[文件:Orange-pi-i96-img53.png|800px]]</div><br>There is Kconfig on the same sibling folders with Makefile. Each Kconfig respectively describes the the source directory file related kernel configuration menu. In the kernel configuration making menuconfig, it read from the Kconfig config menu and the user configuration saved to the config. In the kernel compile, the main Makefile by calling this.Config could know the user's configuration of the kernel.<br>Kconfig is corresponding to the kernel configuration menu. Add a new driver to the kernel source code, you can modify the Kconfig to increase the configuration menu for your drive, so you can choose whether the menuconfig driver was compiled or not.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img54.png|800px]]</div><br>Back to the source code directory /OrangePi_i96<br>$ ./build.sh<br>Please refer to last section about Linux source code compilation.<br>Update the new generated module file into Linux system.<br>It will generated a corresponding .ko file which is generated from the previous compilation of OrangePi_misc.c.<br>Insert U disk (please note the SD card should have written image) if the SD card is mounted to the directory system of /dev/sdc, then SD card will mount to rootfs, which is /dev/sdc7, and mounted to rootfs partition automatic.<div style="padding-left:200px;">[[文件:Orange-pi-i96-img55.png|800px]]</div><br>=== '''Compiling method of application''' ===<br>Check whether there is the cross compiler, if not, then download and install it.$ arm-linux-gnueabihf-gcc -v<div style="padding-left:200px;">[[文件:Orange-pi-i96-img56.png|800px]]</div><br>While compiling the application, you will fill that you need the cross compiler arm-linux-gnueabihf-gcc, download and install it.<div>[[文件:Orange-pi-i96-img57.png|800px]]</div><br>Unzip the downloaded file and enter the the directory<div>[[文件:Orange-pi-i96-img58.png|800px]]</div><br>Check the information after entering bin directory<div>[[文件:Orange-pi-i96-img59.png|800px]]</div><br>pwd hows the path and export it into the whole project<div>[[文件:Orange-pi-i96-img60.png|800px]]</div><br>$ ll /etc/environment shows that the file can only read, need to modify permissions <br>$ chmod 755 /etc/environment<div>[[文件:Orange-pi-i96-img61.png|800px]]</div><br>Add the path to the whole environment variable<br><div>[[文件:Orange-pi-i96-img62.png|800px]]</div><br>Compile the application with cross compiler<br><br>$ arm-linux-gnueabihf-gcc app.c –o aq<br>There will be an ap application generated in the directory, copy it to the development board file system(on the rootfs directory of /home/orangepi/)<br>$ cp aq /media/*/home/orangepi/<br><br>=== '''Running driver and application''' ===<br>Removed the SD card and inserted it into the development board and power on.<br>You need to switch to root users and load module driver module to the development board first.<br>$ insmod /lib/modules/orangepi.ko<div>[[文件:Orange-pi-i96-img63.png|800px]]</div><br>$ lsmod To check whether it is loaded<div>[[文件:Orange-pi-i96-img64.png|800px]]</div><br>$ ll /dev/orangepimisc( Miscellaneous equipment automatically generated device files, the specific look at the driver code)<div>[[文件:Orange-pi-i96-img65.png|800px]]</div><br>Executive application (note the use of the application, check the code for specify)<br>$ ./aq /dev/orangepimisc<br><br>