Create Your Own Pi Distro

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
340
Reaction score
367
Credits
11,754
Many people may want to tweak their own version of a Linux Operating System (OS) but are unsure how to do it. Some may think it is too hard to do. If you have a Raspberry Pi and a few free hours to play around with it then you may want to try this out.

Let’s make our own Raspberry Pi distro!

Getting Ready

To start is fairly simple. You will, of course, need a Raspberry Pi and an empty SD Card which will boot the Pi.

NOTE: Not all SD cards will boot a Raspberry Pi. The SD Card must be a Class 6 or higher. With the cost going down I suggest a Class 10 with a size of at least 8 GB.

Download the Raspbian Lite file found at https://downloads.raspberrypi.org/raspbian_lite_latest. Store the Raspbian Lite file on your hard drive and then extract it within the same folder.

Yo also need to download the NOOBS file found at https://downloads.raspberrypi.org/NOOBS_latest. Store the NOOBS file on your hard drive in an easily accessible folder.

Once you have the SD Card, NOOBS and the Raspbian Lite file we can start on getting everything we need on the SD Card.

Use GParted or a similar program to find the location of the SD Card. Open a Terminal in the folder where Raspbian Lite is located. If needed change directories to the proper folder. Use the ‘dd’ command to place the image (.img) file to the SD Card. A sample command is as follows:

dd bs=1MB status=progress if=2017-01-11-raspbian-jessie-lite.img of=/dev/sdb

The command takes the image file in the local folder and copies it to the SD Card located in /dev/sdb. If your SD Card is labeled differently then change ‘/dev/sdb’ as needed.

Once the copy is completed place the SD Card in your Raspberry Pi and get all devices hooked up then power the Pi on. Let the system boot. It may take awhile to manage the partition on the SD Card. Once the system boots you will be taken to a text-based login prompt.

Use the Username ‘pi’ and the Password ‘raspberry’. You should then be logged into the terminal and given a command prompt.

The next step is to start some minor configuration changes and then install a Graphical User Interface (GUI).

Starting Configurations

The main thing to do when starting the system is to update everything that is now the base install. To perform the update perform the following three commands:

sudo apt-get update
sudo apt-get upgrade
sudo reboot


The ‘upgrade’ may take some time and once it is done the ‘reboot’ will restart the Raspberry Pi to allow all of the upgrades to take affect.

Once you have logged back onto the Pi we need to change the Root password. To change the password use the following command:

sudo passwd

Since the existing password is blank then you will only be prompted to enter the new password and then retype it. For this example I used the password ‘panda’.

My next step is to install a GUI so things are much easier to manage than typing everything. For my distro I will use Lightweight X11 Desktop Environment (LXDE). To install it you need to perform the following:

sudo apt-get install lxde
sudo apt-get install xorg


After the installation is completed you need to type ‘startx’ in the Terminal to start the GUI. After the GUI started I had a question asked about Clipit but I answered ‘No’ to not start it.

Once the GUI starts you need to open a Terminal and start the Raspberry Pi Configuration Tool. Use the command ‘sudo raspi-config’ to start it. Change your localization settings such as keyboard, language, etc. After making the changes you will be asked about rebooting the system. Reboot the system to allow all of your changes to take affect.

Once the GUI restarts right-click on the Desktop and select an option similar to ‘Desktop Preferences’. Once opened find the option to change the Wallpaper and click the option to do so. A box should open which shows the default location of the Wallpaper files. Go to the folder and remove the existing images and replace them with ones which go along with your theme. I placed five images of Pandas into the folder at ‘/etc/Wallpaper’. Make sure you set the current Wallpaper to one of your new images.

NOTE: If you have a problem with the Wallpaper files open the file manager with Root privileges. For example, with LXDE the file manager is ‘pcmanfm’. The command would be ‘sudo pcmanfm’.

I always prefer Debian Systems with ‘gparted’ and ‘synaptic’. To add these perform the following commands in a Terminal:

sudo apt-get install gparted
sudo apt-get install synaptic


Once Synaptic is installed you can use it to remove and add programs necessary for your distro.

The next thing to do is to modify the Desktop as you need such as adding and removing icons to the Desktop or an application bar.

The next step is to open the Web Browser and set the default Home page. Clear the History and make any other changes you like before closing the Browser.

Make any changes you need to the system and be sure to undo any settings you may not want to remain. For example, try to use the Ethernet connection and not the WiFi if your router requires a password. You may not want the password to be included in the image created.

Creating An Image

Now that everything is to your liking, you are ready to create the image file. Close all applications and open a Terminal. In the Terminal go to the root folder with the command ‘cd /’.

Use the command ‘ls’ to get a listing of the folders as shown in Figure 1.

Figure 01.jpg

FIGURE 1

You will need to use the command ‘sudo tar -cpfv root.tar <folders> --exclude=proc/* --exclude=sys/* --exclude=dev/pts/*’. The ‘<folders>’ is a list of of the folders you got with the command ‘ls’. Make sure to not include the ‘lost+found’ folder. With the example of Figure 1 the command would be as follows:

sudo tar -cpvf /bin /boot /cdrom /dev /etc /home /initrd.img /lib /lib64 /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var /vmlinuz --exclude=proc/* --exclude=sys/* --exclude=dev/pts/*

The process could take awhile depending on how many applications you removed or installed. Once this process is completed then you need to run the next two commands to back up the Boot folder:

cd /boot
sudo tar -cpvf boot.tar *


Once these processes have completed you need to power off the Raspberry Pi. Remove the SD Card from the Pi and connect it to a desktop system. Copy off the two files ‘root.tar’ and ‘boot.tar’. Remember that the ‘boot.tar’ file will be in the /boot folder or the Boot partition, if one exists. Place the two files in an easily accessible folder. Open a Terminal and change to the folder where the two files are located.

Enter the following two commands to compress the two files as needed by the boot loader program:

xz -9 -e root.tar
xz -9 -e boot.tar


The files will be compressed and you should have two new files ‘root.tar.xz’ and ‘boot.tar.xz’. The larger the ‘root.tar’ the longer the process will take on the file.

Create The Boot Loader

Unzip the NOOBS file and extract it into a folder to be used as your ‘Staging’ image. Once the files have been extracted open the ‘os’ folder. There should be a single folder here called ‘Raspbian’. Rename the folder to that of your distro. I will use ‘PandaPi’. Inside my PandaPi folder is a ‘root.tar.xz’ and ‘boot.tar.xz’ which you will replace with the two you made previously.

You can also create a PNG file with a 40x40 pixel image to be used on the installation screen. The PNG file should have the same name as your folder. Mine would be named ‘PandaPi.png’.

The next thing to do is to edit the ‘os.json’ file. The original file is shown in Figure 2 and the edited version is in Figure 3.

Figure 02.jpg

FIGURE 2

Figure 03.jpg

FIGURE 3

Make these changes as noted specific to your distro.

The next step is to look into the folder ‘slides_vga’. Here the individual images will need to be edited according to your distro. These images will be 640x440 pixels. The images are displayed during the install process. The images are displayed in alphabetical order and displayed over and over until the installation is completed. If you want to see what they look like download PandaPi and open it with an archive program to look at the VGA slides.

Compress all of the folders and files back into a ZIP file to have one similar to the NOOBS file. To install it you format an SD Card as FAT16. The size of the partition will be 4 GB, the maximum for a FAT16 partition. Extract the ZIP file to the FAT16 partition. Place the SD Card into the Raspberry Pi and boot it up. You will have an option to install your distro.

NOTE: You can download my PandaPi from http://depositfiles.com/files/5t6z2a6q5.

One note about PandaPi. It seems the LXDE Desktop Interface causes an issue with the Ethernet and Wifi devices obtaining an IP address through DHCP. If you cannot get a connection to the network then go to a Terminal and type ‘sudo dhcpcd’. After entering the root password the network should be found. If anyone can find a solution for this please comment below and I can incorporate the fix into the PandaPi installer.

If you download and try PandaPi then remember the usernames and password:

User: pi Password: panda

User: root Password: raspberry

Enjoy your new distro!
 
Last edited:

Members online


Latest posts

Top