树莓派官方只维护了基于debian的32位arm版本Raspbian,并没有官方支持的arm64位版本。从树莓派3B开始就已经使用了64位CPU,但是现在已经差不多两年过去了,官方似乎也还并没有要支持64位的意思,这真是一件蛋疼的事情!!!
本身我自己也一直想在pi上面跑64位系统版本,且在树莓派实验室网站也有一篇介绍在pi3B上跑64位系统会比32位系统有近30倍性能提升的文章,这就更加加强了我要跑64位系统的想法。但是找遍网络也没有现成可用的,即使有是其它爱好者自己移植的,例如只有64位内核,rootfs和各种用户态组件都还是使用树莓派官方支持的32位等等......,实际上这样的移植并不是真正的64位系统,只是有一个64位内核,而用户态全都跑在32位模式。唯一一个官方支持pi64位的系统suse linux也只支持3B,并不支持3B+,3B+启动不了suse linux的64位镜像,这种现状不是我想要的,没有办法,只能自己走上折腾之路。
我个人很喜欢debian,且自己在家里和公司里的电脑都是安装debian作为主力系统使用的,所以目光自然就盯上了debian系统。debian没有让我失望,其官方是支持arm64版本的,只是没有官方支持树莓派。既然我们的pi使用的是64柆CPU,是不是也有可能让pi启动debian官方的arm64版本呢?理论上应该是可以的,且我要实现它。所以就定了这个目标,向着目标前进了。
debian的官方arm64版本:debian-9.4.0-arm64-DVD-1.iso
经过多天的研究和探索,终于让debian官方的arm64版本成功在pi上启动(由于debian官方内核不能直接挂载pi上的rootfs,还没来得及研究原因,直接上了自己的内核,所以除内核是自己编译的之外,其它组件都是debian官方的arm64版本,其它一些iso安装文件中没有的软件也都是从debian的国内源通过apt-get安装的),且网络等重要部件工作正常,可以正常ssh到树莓派,如下是运行展示:
1、版本信息
jiangxianxu@debianOnRpi:~$ uname -a
Linux debianOnRpi 4.14.44-v8 #3 SMP PREEMPT Thu May 31 20:50:49 CST 2018 aarch64 GNU/Linux
jiangxianxu@debianOnRpi:~$ cat /proc/version
Linux version 4.14.44-v8 (jiangxianxu@debian) (gcc version 6.3.0 20170516 (Debian 6.3.0-18)) #3 SMP PREEMPT Thu May 31 20:50:49 CST 2018
jiangxianxu@debianOnRpi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch
jiangxianxu@debianOnRpi:~$
2、重要部件信息:
jiangxianxu@debianOnRpi:~$ lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Model: 4
CPU max MHz: 1400.0000
CPU min MHz: 600.0000
BogoMIPS: 38.40
Flags: fp asimd evtstrm crc32 cpuid
jiangxianxu@debianOnRpi:~$ lsusb
Bus 001 Device 004: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jiangxianxu@debianOnRpi:~$ sudo ifconfig -a
enxb827eba1dddd: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:a1:dd:dd txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.110 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::ba27:ebff:fef4:8888 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:f4:88:88 txqueuelen 1000 (Ethernet)
RX packets 3259 bytes 411999 (402.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 686 bytes 93694 (91.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
jiangxianxu@debianOnRpi:~$
3、pi工作信息:
jiangxianxu@debianOnRpi:~$ who
jiangxianxu pts/0 2018-06-02 15:12 (192.168.0.104)
jiangxianxu@debianOnRpi:~$
jiangxianxu@debianOnRpi:~$ free -h
total used free shared buff/cache available
Mem: 918M 33M 654M 11M 230M 858M
Swap: 0B 0B 0B
jiangxianxu@debianOnRpi:~$
jiangxianxu@debianOnRpi:~$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 1.40 GHz
available frequency steps: 600 MHz, 1.40 GHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
current policy: frequency should be within 600 MHz and 1.40 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 600 MHz.
cpufreq stats: 600 MHz:99.99%, 1.40 GHz:0.01% (214)
analyzing CPU 1:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 1.40 GHz
available frequency steps: 600 MHz, 1.40 GHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
current policy: frequency should be within 600 MHz and 1.40 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 600 MHz.
cpufreq stats: 600 MHz:99.99%, 1.40 GHz:0.01% (214)
analyzing CPU 2:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 1.40 GHz
available frequency steps: 600 MHz, 1.40 GHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
current policy: frequency should be within 600 MHz and 1.40 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 600 MHz.
cpufreq stats: 600 MHz:99.99%, 1.40 GHz:0.01% (214)
analyzing CPU 3:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 1.40 GHz
available frequency steps: 600 MHz, 1.40 GHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
current policy: frequency should be within 600 MHz and 1.40 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 600 MHz.
cpufreq stats: 600 MHz:99.99%, 1.40 GHz:0.01% (214)
jiangxianxu@debianOnRpi:~$
4、软件安装信息:
jiangxianxu@debianOnRpi:~$ sudo apt-get update
Ign:1 http://mirrors.163.com/debian stretch InRelease
Get:2 http://mirrors.163.com/debian stretch-updates InRelease [91.0 kB]
Get:3 http://mirrors.163.com/debian stretch-backports InRelease [91.8 kB]
Get:4 http://mirrors.163.com/debian-security stretch/updates InRelease [94.3 kB]
Hit:5 http://mirrors.163.com/debian stretch Release
Get:6 http://mirrors.163.com/debian stretch-backports/main Sources.diff/Index [27.8 kB]
Get:7 http://mirrors.163.com/debian stretch-backports/main arm64 Packages.diff/Index [27.8 kB]
Get:8 http://mirrors.163.com/debian stretch-backports/main Sources 2018-06-02-0809.09.pdiff [971 B]
Get:8 http://mirrors.163.com/debian stretch-backports/main Sources 2018-06-02-0809.09.pdiff [971 B]
Get:9 http://mirrors.163.com/debian stretch-backports/main arm64 Packages 2018-06-02-0809.09.pdiff [316 B]
Get:9 http://mirrors.163.com/debian stretch-backports/main arm64 Packages 2018-06-02-0809.09.pdiff [316 B]
Get:10 http://mirrors.163.com/debian-security stretch/updates/main Sources [141 kB]
Get:12 http://mirrors.163.com/debian-security stretch/updates/main arm64 Packages [337 kB]
Get:13 http://mirrors.163.com/debian-security stretch/updates/main Translation-en [166 kB]
Fetched 979 kB in 2s (415 kB/s)
Reading package lists... Done
jiangxianxu@debianOnRpi:~$ sudo apt-get install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
gcc-multilib autoconf automake libtool gdb gcc-doc
The following NEW packages will be installed:
gcc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/5,204 B of archives.
After this operation, 44.0 kB of additional disk space will be used.
Selecting previously unselected package gcc.
(Reading database ... 36132 files and directories currently installed.)
Preparing to unpack .../gcc_4%3a6.3.0-4_arm64.deb ...
Unpacking gcc (4:6.3.0-4) ...
Setting up gcc (4:6.3.0-4) ...
Processing triggers for man-db (2.7.6.1-2) ...
jiangxianxu@debianOnRpi:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/6/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-arm64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-arm64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-arm64 --with-arch-directory=aarch64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-multiarch --enable-fix-cortex-a53-843419 --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
jiangxianxu@debianOnRpi:~$
5、工具软件文件属性:
jiangxianxu@debianOnRpi:~$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc
jiangxianxu@debianOnRpi:~$ ll /usr/bin/gcc
lrwxrwxrwx 1 root root 5 Apr 8 2017 /usr/bin/gcc -> gcc-6
jiangxianxu@debianOnRpi:~$ ll /usr/bin/gcc-6
lrwxrwxrwx 1 root root 23 Feb 14 05:53 /usr/bin/gcc-6 -> aarch64-linux-gnu-gcc-6
jiangxianxu@debianOnRpi:~$ file /usr/bin/aarch64-linux-gnu-gcc-6
/usr/bin/aarch64-linux-gnu-gcc-6: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=96a21a6c0df6db50089eac16958b5f299f921a01, stripped
jiangxianxu@debianOnRpi:~$
jiangxianxu@debianOnRpi:~$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz
jiangxianxu@debianOnRpi:~$ ll /bin/ls
-rwxr-xr-x 1 root root 122456 Feb 22 2017 /bin/ls
jiangxianxu@debianOnRpi:~$ file /bin/ls
/bin/ls: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=a242161239cb1f4ea9b8a7455013295e5473e3ec, stripped
jiangxianxu@debianOnRpi:~$
jiangxianxu@debianOnRpi:~$ whereis cp
cp: /bin/cp /usr/share/man/man1/cp.1.gz
jiangxianxu@debianOnRpi:~$ ll /bin/cp
-rwxr-xr-x 1 root root 114056 Feb 22 2017 /bin/cp
jiangxianxu@debianOnRpi:~$ file /bin/cp
/bin/cp: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=ef3e4c136aa0d0eccb6fda173d32e9c796463ae3, stripped
jiangxianxu@debianOnRpi:~$
到此就是全部的64位系统展示,全文完!
PS:镜像文件和安装教程已经分享于另一篇博文中:
https://blog.csdn.net/u013451404/article/details/80710136