Difference: RaspberryPiDescription (3 vs. 4)

Revision 42017-09-26 - uli

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

The Raspberry Pi

Introduction

Line: 22 to 22
 Normally the OS is installed on a micro SD card and boot from there. Version 3 of the board however also allows to boot from a USB stick, which has easier access.

Bringing up Raspbian

Changed:
<
<
The operating system can be downloaded here which gives you a zip file. Once uncompressed you get an image file (2017-07-05-raspbian-jessie.img at the time of writing) which you can copy to the micro SD card or a memory stick using dd. To enable USB or network boot mode you must prepare the machine however as described here.
>
>
The operating system can be downloaded here which gives you a zip file. Once uncompressed (use the unzip command to do this and be patient because it can take several minutes to unpack) you get an image file (2017-07-05-raspbian-jessie.img at the time of writing) which you can copy to the micro SD card or a memory stick using dd. To enable USB or network boot mode you must prepare the machine however as described here .
 
Changed:
<
<
Once you have prepared the card, downloaded and unpacked the OS you can copy it to the SD card or USB stick. Make sure to find out which device corresponds to your SD card (/dev/mmcblk0p1 ?) or you USB stick (/dev/sdX where X is your device letter. Make damned sure you know the device letter without doubt because otherwise you may overwrite your hard disk and your PC will not boot any more!)
>
>
Once you have prepared the card, downloaded and unpacked the OS you can copy it to the SD card or USB stick. Make sure to find out which device corresponds to your SD card (/dev/mmcblk0p1 ?) or you USB stick (/dev/sdX where X is your device letter).

Make damned sure you know the device letter without doubt because otherwise you may overwrite your hard disk and your PC will not boot any more!)

One way to find out the device letter is this: Before inserting the SD card into yout PC SD card slot, type ls /dev/sd*, which will give you the names of all hard disk partitions installed on your system. Then insert the SD card into the reader and redo the same command. The disk you have added is the one you want to use.

  Copy the OS image to the SD card or USB stick with:
Changed:
<
<
dd bs=4M if=2017-07-05-raspbian-jessie.img of=/dev/sdX status=progress conv=fsync
>
>
sudo dd bs=4M if=2017-07-05-raspbian-jessie.img of=/dev/sdX status=progress conv=fsync

This may take a while. Eject the SD card (right click on its icon in the task bar and select eject, then re-insert it and make sure you can see 2 partitions. The first one is named "boot" and you may want to rename the second one to "root" with the command:

sudo tune2fs -L root /dev/sdX2 (replace the X with your disk letter again).

Once done, eject the SD card again and install the device in your Raspberry Pi and boot.

You can also unpack the Raspbian file system by loop mounting it onto your Linux system.

 
Changed:
<
<
This may take a while. Once done, install the device in your Raspberry Pi and boot.
>
>
Before doing this, create 2 directories: /media/loop1 and /media/loop2.
 
Changed:
<
<
You can also unpack the Raspbian file system by loop mounting it onto your Linux system. Since there are 2 partitions in the image in addition to the boot loader, you must specify the offset of each file system (boot and root) when mounting them. You can find out these offsets with fdisk -l imageName.img.
>
>
Since there are 2 partitions in the image in addition to the boot loader, you must specify the offset of each file system (boot and root) when mounting them. You can find out these offsets with fdisk -l imageName.img.
 
Changed:
<
<
Multiplying the start sector offset by 512 (size of a sector) gives you the offset needed for the mount command.
>
>
Multiplying the start sector offset by 512 (size of a sector) gives you the offset needed for the mount command. In case of the boot partition this is 8192*512 = 4194304. The W95 FAT32 file system is the boot partition and the Linux file system is the root partition.
  raspberryFileSystem.png
Changed:
<
<
You can then copy the contents of /media/loop into a directory you call boot and do the same thing for the root file system.
>
>
You can then copy the contents of /media/loop into a directory you call boot and do the same thing for the root file system
 
Changed:
<
<
For copying I use:
>
>
For copying you must first cd to /media/loop1, then I use:
 
Changed:
<
<
tar cvpf - * | (cd /opt/ucc/micros/raspberry/raspbian-stretch-2017-09-07/b(r)oot; tar xvf -)
>
>
tar cvpf - * | (cd /opt/ucc/micros/raspberry/raspbian-stretch-2017-09-07/b(r)oot; tar xvf -) This rather complex looking tar command does the actual copy, keeping the file permissions and ownership intact. In fact it created a tar archive file which is again un-tared in the destination directory /opt/ucc/micros/raspberry/raspbian-stretch-2017-09-07/boot in case of the boot file system.
  (use either boot or root).

Setting up the system

Once Raspbian is up and running you will have a user pi with password raspberry to log in. This user has the UID 1000 and GID 1000. Unfortunately on my PC Ubuntu system these are the UID and GID of user uli, my main user name. This causes trouble when we want to easily log in through ssh or copy files with scp. I therefore modified the UID and GID for user pi to be 1001 to free 1000 for user uli.

Changed:
<
<
I created a new user uli, added him to the sudoers list (usermod -a -G sudo uli) such that I can easily become super user. Then I modified the UID and GID or pi and uli as described here. Make sure that the user and group ownership of the home directories are also correct (chmod -R uli:uli /home/uli).
>
>
I created a new user uli, added him to the sudoers list (usermod -a -G sudo uli) such that I can easily become super user. Then I modified the UID and GID of pi and uli as described here. Make sure that the user and group ownership of the home directories are also correct (chmod -R uli:uli /home/uli).
  Once all this is correctly set up you will have to run raspi-config as super user and enable
  • ssh

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback