Raspberry Pi Installation configuration (zero start) B +

Source: Internet
Author: User
Tags printf syslog git clone tightvnc automake

0. Power supply is micro USB (Android power connector)

1. Download the operating system from the official website and write the memory card with Win32diskimager.

2. Locate the IP and set the static IP under the router:

Command: sudo vi/etc/network/interfaces

Switch

Auto Lo

Iface Lo inet Loopback


Iface eth0 inet Static

Address 192.168.1.88
Netmask 255.255.255.0
Gateway 192.168.1.1


Allow-hotplug Wlan0
Iface Wlan0 inet Manual
Wpa-roam/etc/wpa_supplicant/wpa_supplicant.conf

3. Computer network cable direct connection, computer installation putty

Debian User name: Pi Password: Raspberry

4. Install VNC server on the Raspberry Pi and install the VNC client on the computer. Default Port 5901.

sudo apt-get update


sudo apt-get install tightvncserver

//Set Resolution

vncserver:1-geometry 1024x728-depth

//--------------------------------------------------------------------------------------------------------

5. Program Self-Starting

The /etc/rc.local needs to be set up from start.

tightvncserver Self-Starting error method one:

The online method of starting VNC Server automatically, but because of laziness, the script does not write Init Info, resulting in the update of the startup item, such as LSB Tags and other missing warnings. The necessary information is now supplemented as complete below.

First write the following to/etc/init.d/tightvncserver


#!/bin/sh
# # # BEGIN INIT INFO
# Provides:tightvncserver
# Required-start: $syslog $remote _fs $network
# required-stop: $syslog $remote _fs $network
# Default-start:2 3 4 5
# default-stop:0 1 6
# short-description:starts VNC Server on system start.
# description:starts Tight VNC Server. Script written by James Swineson.
# # # END INIT INFO

#/etc/init.d/tightvncserver
Vncuser= ' pi '
Case "$" in
Start
Su $VNCUSER-C '/usr/bin/tightvncserver:1 '
echo "Starting TightVNC Server for $VNCUSER"
;;
Stop
Pkill Xtightvnc
echo "TightVNC Server stopped"
;;
*)
echo "Usage:/etc/init.d/tightvncserver {start|stop}"
Exit 1
;;
Esac
Exit 0

Then run:

sudo chmod 755/etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults

Restart to see the effect. It's also easy to cancel the boot boot, just one line of code:

sudo update-rc.d-f tightvncserver Remove

Method Two:
Join in the/etc/rc.local
Su-c '/usr/bin/tightvncserver:1 '
Direct write:/usr/bin/tightvncserver:1 will fail



6. Cross-compilation environment
First, download the latest compilation Toolkit

git clone git://github.com/raspberrypi/tools.git

You can see the Tools folder in the current directory when you are finished.

to install the compile-chain tool into the/opt folder , root permission is required.

CD Tools
Cp-r arm-bcm2708/opt

Configure default path, add compiler tool path, environment variable set in ~/.BASHRC

Export Path=/opt/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin: $PATH

Configure compilation parameters.

Export cflags= "-o2-pipe-mcpu=arm1176jzf-s-mfpu=vfp-mfloat-abi=hard-w"

This cross-compilation environment is configured to complete


7. Installation using Automake

Dependent files can be installed in the following order:

1.pkg-config
2.m4
3.autoconf
4.libtool
5.automake

Note: Install after decompression of the current environment, do not copy the installed folder to another environment installation (otherwise there may be an inexplicable error).

generate the ins and outs of Makefile

First go to the project directory, run a series of commands in this directory, create and modify several files, you can generate a makefile file that conforms to the platform, the operation process is as follows:

1) Run the AutoScan command

2) Rename the Configure.scan file to configure.in and modify the configure.in file

eg

Ac_init ([main], [1.0], [xxx@136.com]) Modify

Am_init_automake (main,1.0) add
Ac_output ([Makefile]) Modify

3) Create a new makefile.am file in the project directory//and create a new makefile.am file in the core and shell directories

Utomake_options=foreign
Bin_programs=dom
DOM_SOURCES=MAIN.C dom.c soapc.c stdsoap2.c

Also include the. h file

4) Create new news, README, ChangeLog, authors files in the project directory

5) Run the aclocal command

6) Run the Autoheader command

7) Run the autoconf command

8) Run the AUTOMAKE-A command

Make Dist can be packaged

9) Run the./confiugre script
Transferred from: http://www.ibm.com/developerworks/cn/linux/l-makefile/

7. Configuring LIGHTTPD + CGI Programming
Content in lighttpd.conf:
Server.document-root = "/webroot/"
Include "conf.d/fastcgi.conf"
Server.modules + = ("mod_cgi")
Mimetype.assign = (". png" = "image/png",//without this, the browser may not parse the content, allowing the user to save or open
". jpg" = "image/jpeg",
". jpeg" = "image/jpeg",
". html" = "text/html",
". txt" = "text/plain")
Server.port = 80
Cgi.assign = (". CGI" = "" ")

CGI instances:
(1).

<body>

<form action= "/cgi-bin/mult.cgi" >
<P> calculate the product of two numbers, please enter two multipliers.
<input name= "M" size= "5" >
<input name= "n" size= "5" ><BR>
<input type= "Submit" values= "Submission" >
</form>

</body>

2. Write the CGI source code (assuming the file name is mult.c)

#include <stdio.h>
#include <stdlib.h>

int main (void)
{
Char *data;
Long M,n;

printf ("%s\n\n", "content-type:text/html;charset=gb2312");
printf ("<TITLE> multiplication results </TITLE>");
printf ("<H3> multiplication results </H3>");

    data = getenv ("query_string");//Get Parameters from form--two multipliers M and N
    if (data = NULL)
        printf ("<P> error. Data is not being entered or a problem with data transmission ");
    Else if (sscanf (data, "M=%ld&n=%ld", &m,&n)!=2)
         printf ("<P> error. The input data is illegal. A number must be entered in the form. "); The product of
    else
        printf ("<p>%ld and%ld" is:%ld. ", m,n,m*n);
    return 0;
} gcc mult.c -o mult.cgi

3. Turn on lighttpd 
lighttpd-d-f/webroot/lighttpd.conf

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.