Install fedora23-installing Fedora on Raspberry Pi 2 model B or Raspberry pi 3 in Raspberry Pi 2 generation B/3 generation

Source: Internet
Author: User

This article is primarily used to document the installation process so that you can review it later.

Previous runs on my Raspberry Pi have been Raspbian installed through noob, but I prefer to use Fedora as a development and usage environment, and software packages on Raspbian are often slow to update. Because Raspberry Pi chips are armv6 or earlier, they can only run the arm architecture of Raspbian or Fedora 18 and earlier, prior to the listing of the 2 generation B model. The chip architecture of the Raspberry Pi 2 generation B is armv7, and the Raspberry Pi 3 generation chip architecture is ARMV8, both of which are capable of running the arm architecture of Fedora 23, while only running Raspbian is difficult to fully perform hardware performance, so by looking up data, Finally, the official Fedora documentation was found. First on the 16G memory card to verify the success, today on the 64G SD card again, by the way to record each step, in case you and other people reference.

0. Preparatory work
Download the Fedora Arm image and raspberry dedicated firmware (boot and kernel):
A. Fedora ARM official [https://arm.fedoraproject.org/]
B. Raspberry PI special firmware [https://github.com/raspberrypi/firmware/archive/master.zip]
After downloading, unzip to a convenient directory to spare.

1. Create a disk partition structure
Because the official document only describes the use of Fdisk, so lazy, only refer to the official document steps, as to whether the other tools are feasible, temporarily do not study. If you are interested, you can try it.
Because most operations require root user rights, if you feel often sudo trouble, you can switch directly to the root user su.
First you need to determine the device path of the disk, using a USB card reader may be the path is/DEV/SDB, while using the computer built-in card reader, the path of the SD card may be/dev/mmcblk0, self-determined according to the situation.
Run after determining the device path # fdisk /dev/sdb (this is the path on my Computer)
Enter interactive mode after carriage return, p print the partition information of the current operation disk, d Delete, delete the existing partition.
Then I'm going to create the partition: According to the official document, boot partition 128Mb is enough, because the 2 generation B type of memory is 1G, so the swap partition to 1G, then there is about 58G free space, to the system 16G above the available space, if intended as a development workstation, Pack a lot of packages, you can leave some more, the rest of the space as a user partition.
Then enter N to create a new partition, enter after the prompt, input p can create a primary partition, enter E can create an extended partition, we want to create a primary partition, and then according to the prompt to enter 1 to create the first partition, and then enter two times a return, skip sector option, in the last Enter +128m in the sector option to indicate the size of the partition to be divided. You can refer to the following information on the screen:

Fdisk> Command (M forHelp): N
Partition type
P Primary (0Primary0Extended4 Free)
E Extended (container forLogical partitions)
Select (default p): P
Partition Number (1-4, default1):1
First Sector ( +-31422463, default +):
Last sector, +sectors or +size{k,m,g,t,p} ( +-31422463, default31422463): +128m

Created a new partition1of type'Linux'and of size -Mib.

When you see created a new partition 1 of type ' Linux ' and of the size of the MiB. The information indicates that the partition was created successfully.
As we have just suggested, we can see that the partition type you just created is "Linux", and the Raspberry Pi requires the boot partition to be FAT32, so you also need to enter the T command to convert the partition type. Input l query All types of code, you can find that the code of W95 FAT32 is B, so enter B, this will display a message similar to the following:

Fdisk> Command (M forHelp): T
Selected partition1
Partition type (type L to list all types): b
Changed type of partition'Linux'To'W95 FAT32'.


Then repeat the above steps to create the swap partition and the system partition. Note When you create a new partition and modify the partition type, the number of the selected partition needs to grow. According to the official documentation, the partition type of the swap partition should be the "Linux Swap/solaris" type, with the corresponding number 82. System partitions and user partitions do not need to modify the partition type.
As a result, the creation of the disk partition structure is basically done, execute the P command to view the results, confirm the error after executing the W command to write to the memory card. If you are prompted to restart or reconnect the reader, restart or reconnect before performing the next step.

2. Format the SD card partition you just created
If the partition is successful, you should see SDB and the newly created 4 partitions in the/dev/directory: SDB1,SDB2,SDB3,SDB4. If you are using a built-in card reader, it may be mmcblk0 and the corresponding 4 partitions: MMCBLK0P1,MMCBLK0P2,MMCBLK0P3,MMCBLK0P4.
Format the specified partition in FAT32 format by mkfs.vfat+ the partition device path. Format the specified partition in swap format by mkswap+ the partition device path. Format the specified partition in EXT4 format by mkfs.ext4+ the partition device path.

3. Mount Fedora ARM 23 system image and SD card partition, copy image file
If the image is not unpacked, you can# unxz Fedora-Server-armhfp-23-10-sda.raw.xzCommand decompression.
To create a temporary mount point:# mkdir /tmp/img/
To create a loop device:# losetup --partscan --find --show Fedora-Server-armhfp-23-10-sda.raw /dev/loop0
Mount the root partition of the loop device to a temporary mount point:# mount -r /dev/loop0p3 /tmp/img/
Here, it is common to note that the first partition in a Linux system image is the boot partition, corresponding to the/boot/path. The second partition is a swap partition, which can be ignored, and the third partition is the root partition, corresponding/. Because we do not intend to use native boot and kernal, the first partition is not mounted. The official note is that the kernal released with Fedora does not currently support all the features of the Raspberry Pi chip, so it is best to use the dedicated kernel firmware of the Raspberry Pi.
And then mount our SD card system root partition:
# mkdir /tmp/rpi/
# mount /dev/mmcblk0p3 /tmp/rpi/
Mount the SD card boot partition:
# mkdir /tmp/rpi/boot/
# mount /dev/mmcblk0p1 /tmp/rpi/boot/
Mount SD card Home partition:
# mkdir /tmp/rpi/home/
# mount /dev/mmcblk0p4 /tmp/rpi/home/
Then, copy the files from the mirrored root partition to the root partition of the SD:# cp -rpv /tmp/img/* /tmp/rpi/
You can perform sync to confirm cache synchronization.
Finally, remove the mount of the image file:
# umount /tmp/img
# losetup -d /dev/loop0


4. Copy the Raspberry Pi special firmware
If the firmware has not been unpacked, it can be # unzip raspberry-firmware.zip extracted by command.
Then copy the files you need using the following command:
# cp -r firmware-master/boot/* /tmp/rpi/boot/
# cp -r firmware-master/modules/* /tmp/rpi/lib/modules/
Then create a file named Cmdline.txt under the SD card boot partition, which is used to pass parameters to the kernel. The contents of the document are as follows:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait
Note here, because this file is for the Raspberry Pi machine, SD card after inserting the Raspberry Pi, the SD card device path should be/dev/mmcblk0, the root partition device path is/DEV/MMCBLK0P3, so should be fixed write this content, It is no longer the device path on the computer when preparing the SD card.
Then create a file named Config.txt under the/boot partition, this step is optional, I first try not to establish this file, the system can start normally. If you want to create this file, the file reads as follows:

Hdmi_force_hotplug=1
Config_hdmi_boost=4
Overscan_left=24
Overscan_right=24
Overscan_top=16
Overscan_bottom=16
Disable_overscan=0
core_freq=250
sdram_freq=400
Over_voltage=0

5. Set the contents of the Fstab file
It is important to note that the Fstab file on the SD card is changed, not on your computer, and if you change the error, your computer will not start, so you need to be very careful.
# blkid | grep sdbthe command queries the UUID of each partition of the SDB disk first, and if it is a built-in reader, the disk name may be replaced with mmcblk0
Then use the common editor to open the/tmp/rpi/etc/fstab file, this file is used in the boot time, the changes need to be more rigorous. First, the swap partition is placed on the last row, and the row count is not enough to copy one row. The first line must be the root partition, which is the third system partition we divide. Down must be a tree structure, we put the boot partition on the second row, the user partition on the third row, update the UUID, path and partition format information respectively. Save after confirmation is correct.

6. Remove the SD card mount

#Umount/tmp/rpi/boot/
#Umount/tmp/rpi/home/
#Umount/tmp/rpi/

Finally, you can perform sync to confirm cache synchronization.

7. Insert the SD card into the Raspberry Pi and initialize it
After power on the normal situation should display the initialization wizard, you can choose 1~4 for the specified action, such as setting the time zone, language, set the root password, create a new administrator account, and so on. Reboot after completion.
After reboot, execute the following command to remove unused Fedora official kernel and update the system:

# DNF Remove Kernel Kernel-core kernel-modules
# DNF Update

8. Install the Raspberry Pi firmware update package
The # dnf install binutils git installation dependency component is performed first.
Then execute the following command to install Rpi-update:

# curl-l-o/usr/bin/rpi-update https://raw.githubusercontent.com/hexxeh/rpi-update/master/rpi-update
#chmod+x/usr/bin/rpi-update

The final execution # rpi-update allows for a dedicated firmware upgrade.

Resources:

1. Raspberry Pi Document on Fedora official wiki [http://fedoraproject.org/wiki/Raspberry_Pi]

Install fedora23-installing Fedora on Raspberry Pi 2 model B or Raspberry pi 3 in Raspberry Pi 2 generation B/3 generation

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.