今天把典藏已經很久的 Raspberry Pi 3 拿出來把玩,當然要配上 Linux distrobution 中最潮的 Arch Linux 才行囉 (極潮的還有 gentoo、LFS,可惜沒用過)。
不過,看著 Arch Linux ARM 官方的 Installation,心先涼了一半:
Note: The current installation uses the 32-bit Raspberry Pi 2 armv7h root filesystem. This will be changing eventually to use our AArch64 repository to take full advantage of the ARMv8 Cortex-A53 cores. If you want an AArch64 system, consider the ODROID-C2.
好,沒有關係,效能沒有辦法完全解放沒有關係,畢竟在 Cortex-M 上翻滾那麼久,一點點的效能損失不算什麼。
接著就是安裝教學:
- Start fdisk to partition the SD card:
1fdisk /dev/sdX - At the fdisk prompt, delete old partitions and create a new one:
- Type o. This will clear out any partitions on the drive.
- Type p to list partitions. There should be no partitions left.
- Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector.
- Type t, then c to set the first partition to type W95 FAT32 (LBA).
- Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
- Write the partition table and exit by typing w.
- Create and mount the FAT filesystem:
123mkfs.vfat /dev/sdX1mkdir bootmount /dev/sdX1 boot - Create and mount the ext4 filesystem:
123mkfs.ext4 /dev/sdX2mkdir rootmount /dev/sdX2 root - Download and extract the root filesystem (as root, not via sudo):
123wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gzbsdtar –xpf ArchLinuxARM–rpi–2–latest.tar.gz –C rootsync - Move boot files to the first partition:
1mv root/boot/* boot - Unmount the two partitions:
1umount boot root - Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power.
- Use the serial console or SSH to the IP address given to the board by your router.
- Login as the default user alarm with the password alarm.
- The default root password is root.
我咧,看到第五步傻眼,首先換成 root,用 wget 下載安裝檔,接著解壓縮到 root,這我都可以理解,第3個 sync
是怎麼回事……無法理解。
第一次跑 sync 跑5秒還沒跑完,我就把 shell 關掉直接繼續下面的步驟,拿到 rpi3 上就不動了、不動了、不動了。
回頭去找真男人問 sync 是什麼 (https://linux.die.net/man/2/sync),告訴我是:
sync, syncfs – commit buffer cache to disk
Description
sync() causes all buffered modifications to file metadata and data to be written to the underlying file systems.
syncfs() is like sync(), but synchronizes just the file system containing file referred to by the open file descriptor fd.
原來是要把上一步驟解壓縮的動作完全從 cache 移動到 disk 啊。難怪上次會失敗,因為根本還沒移動完成。
接著照著下面步驟走就會成功囉。
Leave a Reply