Tuesday, January 14, 2014

Download and transfer the source code of Raspberry Pi

In the steps, the source code of Raspberry Pi in GitHub (linux and firmware) are downloaded to a host PC running Ubuntu, then copy to Raspberry Pi.



  • - In Host PC side -
    Because the source code of Raspberry Pi is too large, and too long time to download, it will be done in another host pc.

    - Create git directory to hold the files.
    $ mkdir git
    $ cd git

    - git clone the source code.
    $ git clone https://github.com/raspberrypi/linux
    $ git clone https://github.com/raspberrypi/firmware

    It take long time to finish.
  • - In Host PC side -, after downloaded:
    - Compress and copy to Pi, under /home/pi.
    tar -cvf linux.tar.gz --exclude .git linux
    scp linux.tar.gz pi@raspberrypi:/home/pi
  • - In Pi side -, switch to /home/pi directory
    tar -xvf linux.tar.gz
    cd linux
    zcat /proc/config.gz > .config
    make oldconfig
    make modules_prepare
  • - In host PC side -, host PC: copy Module.symvers to pi's linux directory.
    scp firmware/extra/Module.symvers pi@raspberrypi:/home/pi/linux
  • - In Pi side -, move linux directory to /usr/src/kernels/$(uname -r)
    $ sudo mkdir /usr/src/kernels
    cd ~
    sudo mv linux /usr/src/kernels/$(uname -r)
    cd /lib/modules/$(uname -r)

    make links for build and source
    sudo ln -s /usr/src/kernels/$(uname -r) build
    sudo ln -s /usr/src/kernels/$(uname -r) source

No comments: