Remaining linux notes and linux notes

Source: Internet
Author: User

Remaining linux notes and linux notes

1. Set the Network Environment
1) set the host network environment
# Ifconfig eth1 192.168.16.111

2) set the development board network environment
> Pri
> Setenv ipaddr 192.168.16.233
> Setenv serverip 192.168.16.111
> Setenv gatewayip 192.168.16.1
> Ping 192.168.16.111
> Saveenv

2. download files through TFTP
> Tftp 0x40000000 aaa.txt

3. Use tftp to burn your u-boot
1) download the file to the Development Board
# Cp u-boot.bin/tftpboot/put compiled u-boot in the directory of the host tftp Server
> Tftp 0x40000000 u-boot.bin download u-boot to target machine

2) run the u-boot command to burn the Flash file (clean and then write)
> Nand erase 0x0 0x60000 erased flash and wiped 0x60000 size from 0 address
> Nand write 0x40000000 0x0x60000 write the files in the memory 0x40000000 address to the Flash 0x0 address, and write the size of 0x60000.

4. Load the kernel
1) produce uImage
Arch/arm/boot/zImage original Kernel
Create uImage, u-boot/mkimage, and zImage
# Copy compiled u-boot/tools/mkimage to/usr/bin
# Execute make uImage in the kernel source code directory

2) install the kernel
# Cp arch/arm/boot/uImage/tftpboot
The starting address for TFTP to download the kernel image uImage to DRAM 1: 0x40000000:
> Tftp 0x40000000 uImage
Start the kernel
> Bootm


3) harden the kernel
> Tftp 0x40000000 uImage
& Gt; nand erase 0x600000 0x500000
> Nand write 0x40000000 0x600000 0x500000

U-boot startup parameters
> Setenv bootcmd 'nand read 0x40000000 0x600000 0x500000; bootm 0x40000000'

5. Mount the File System
1) Build an NFS server. For details, see Section 2.3 on building a development environment.

2) restart the NFS server
Service portmap restart
/Etc/init. d/nfs-kernel-server restart

6. Configure the startup parameters of the Development Board
1) set the u-boot startup command
> Setenv bootcmd tftp 40000000 uImage \; bootm \;

2) Set kernel startup parameters to remotely mount the root file system on the host using NFS.
> Setenv bootargs 'console = ttySAC0, 115200 root =/dev/nfs rw nfsroot = 192.168.1.130:/nfs/mini_rootfs ip = 192.168.16.200: 192.168.1.130: 192.168.1.1: 255.255.255.0: eth0: off init =/linuxrc'

-----------------------------------------

Set the kernel io Interface:

Set the GPIO direction. If the output is the same, set the level:
Gpio_direction_input (S5PV210_GPJ2 (0 ));
Gpio_direction_output (S5PV210_GPJ2 (0), 0 );

Obtain the level of the Input Pin:
Gpio_set_value (S5PV210_GPJ2 (0), data );
Gpio_get_value (S5PV210_GPJ2 (0 ));

Use of gpio in binary Kernel
1. test whether the gpio port is valid: int gpio_is_valid (int number );

2. Apply for a gpio port. Of course, the pinmux configured for the gpio port must be displayed before the application.
Int gpio_request (unsigned gpio, const char * label)

3. Marking gpio usage includes Input and Output
/* If the call succeeds, zero failure is returned, and a negative error value is returned */
Int gpio_direction_input (unsigned gpio );
Int gpio_direction_output (unsigned gpio, int value );

4. Obtain the gpio pin value and set the gpio pin value (for output)
Int gpio_get_value (unsigned gpio );
Void gpio_set_value (unsigned gpio, int value );

5. Use gpio as the Interrupt Port
Int gpio_to_irq (unsigned gpio );
The returned value is the interrupt number that can be passed to request_irq () and free_irq ()
The kernel calls this function to convert the gpio port to an interrupt, and there are similar methods in the user space.

6 export the gpio port to the user space
Int gpio_export (unsigned gpio, bool direction_may_change );
The kernel can clearly manage the export of gpio ports applied by gpio_request,
The direction_may_change parameter indicates whether the user program can modify the gpio direction.
The direction_may_change parameter is true.
/* Cancel export of GPIO */
Void gpio_unexport ();

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.