Stage 1:试图加入arm64软件包

笔者默认您清楚这些指令背后的意义以及其可能造成的后果,并默认您已备份重要资料

  1. sudo dpkg --add-archietcture arm64
  2. sudo apt update

尝试在树莓派上执行上述两条指令,结果如下(笔者的Raspbian已升级至Stretch):

  1. Get: https://mirrors.ustc.edu.cn/raspbian/raspbian stretch InRelease [15.0 kB]
  2. Get: https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease [22.9 kB]
  3. Get: https://mirrors.ustc.edu.cn/raspbian/raspbian stretch/main armhf Packages [11.7 MB]
  4. Get: https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie/main armhf Packages [163 kB]
  5. Fetched 11.9 MB in 1min 7s ( kB/s)
  6. Reading package lists... Done
  7. Building dependency tree
  8. Reading state information... Done
  9. packages can be upgraded. Run 'apt list --upgradable' to see them.
  10. N: Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/raspbian/raspbian stretch InRelease' doesn't support architecture 'arm64'
  11. N: Skipping acquire of configured file 'rpi/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/raspbian/raspbian stretch InRelease' doesn't support architecture 'arm64'
  12. N: Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'
  13. N: Skipping acquire of configured file 'non-free/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'
  14. N: Skipping acquire of configured file 'contrib/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'
  15. N: Skipping acquire of configured file 'ui/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'

易得:Raspbian里并没有arm64的软件包——至少没有索引文件……

笔者遂修改sources.list:

  1. deb https://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main rpi
  2. deb https://mirrors.ustc.edu.cn/debian/debian/ stretch main

并执行:

  1. wget https://mirrors.ustc.edu.cn/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2017.5_all.deb
  2. sudo dpkg -i debian-archive-keyring_2017.5_all.deb
  3. sudo apt update

得:

  1. Hit: https://mirrors.ustc.edu.cn/raspbian/raspbian stretch InRelease
  2. Hit: https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease
  3. Get: https://mirrors.ustc.edu.cn/debian stretch/main arm64 Packages [6,936 kB]
  4. Get: https://mirrors.ustc.edu.cn/debian stretch/main armhf Packages [6,925 kB]
  5. Get: https://mirrors.ustc.edu.cn/debian stretch/main Translation-en [5,395 kB]
  6. Fetched 19.3 MB in 1min 30s ( kB/s)
  7. Reading package lists... Done
  8. Building dependency tree
  9. Reading state information... Done
  10. packages can be upgraded. Run 'apt list --upgradable' to see them.
  11. N: Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/raspbian/raspbian stretch InRelease' doesn't support architecture 'arm64'
  12. N: Skipping acquire of configured file 'rpi/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/raspbian/raspbian stretch InRelease' doesn't support architecture 'arm64'
  13. N: Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'
  14. N: Skipping acquire of configured file 'non-free/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'
  15. N: Skipping acquire of configured file 'contrib/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'
  16. N: Skipping acquire of configured file 'ui/binary-arm64/Packages' as repository 'https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease' doesn't support architecture 'arm64'

似乎是成功了……

然而,尝试选择安装一个arm64软件包,都会遇到不可描述的依赖问题:

  1. pi@raspberry:~ $ sudo apt install libc6:arm64 libgcc1:arm64
  2. Reading package lists... Done
  3. Building dependency tree
  4. Reading state information... Done
  5. Some packages could not be installed. This may mean that you have
  6. requested an impossible situation or if you are using the unstable
  7. distribution that some required packages have not yet been created
  8. or been moved out of Incoming.
  9. The following information may help to resolve the situation:
  10.  
  11. The following packages have unmet dependencies:
  12. bluez : Depends: libc6 (>= 2.15) but it is not going to be installed
  13. Depends: libdbus-- (>= 1.1.) but it is not going to be installed
  14. Depends: libglib2.- (>= 2.28.) but it is not going to be installed
  15. Depends: libreadline6 (>= 6.0) but it is not going to be installed
  16. Depends: libudev1 (>= ) but it is not going to be installed
  17. Depends: init-system-helpers (>= 1.18~) but it is not going to be installed
  18. Depends: kmod
  19. Depends: udev (>= -)
  20. Depends: dbus
  21. libgcc1:arm64 : Depends: gcc--base:arm64 (= 6.3.-) but it is not going to be installed
  22. E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

Stage 2:尝试在32位环境中执行64位程序

首先,口胡编写一个C程序,存为test64.c:

  1. #include <time.h>
  2. #include <stdio.h>
  3.  
  4. long long fastpow_m(long long base,long long power,long long k)
  5. {
  6. long long result = ;
  7. while (power!=)
  8. {
  9. if (power% == )result = (result*base)%k;
  10. base = (base*base)%k;
  11. power /= ;
  12. }
  13. return result;
  14. }
  15.  
  16. int main()
  17. {
  18. long long b,p,faq;
  19. long t1,t2;
  20. scanf("%lld %lld %lld",&b,&p,&faq);
  21. printf("%lld %lld\n",b,p,faq);
  22. t1 = clock();
  23. printf("result :%lld\n",fastpow_m(b,p,faq));
  24. t2 = clock();
  25. printf("fastpow_m(): %f s.\n",((double)(t2-t1)/(double)CLOCKS_PER_SEC));
  26.  
  27. t1 = clock();
  28. long long r = ;
  29. for (int i=;i<=p;i++)r*=b,r = r%faq;
  30. printf("result :%lld\n",r);
  31. t2 = clock();
  32. printf("normal: %f s.\n",((double)(t2-t1)/(double)CLOCKS_PER_SEC));
  33. return ;
  34. }

(参加过NOI/NOIP/ACM之类竞赛的人一眼就能看出:这是一个模意义下的二分快速幂计算程序:))

安装交叉编译工具链并编译:

  1. sudo apt install gcc-aarch64-linux-gnu
    aarch64-linux-gnu-gcc fastpow.c -static -o /tmp/test64
    file /tmp/test64
    /tmp/test64

得:

  1. /tmp/test64: ELF -bit LSB executable, ARM aarch64, version (SYSV), statically linked, for GNU/Linux 3.7., BuildID[sha1]=a8009a666be247cfdf0b6d7827a8099dee36f1ba, not stripped
  2.  
  3. -bash: /tmp/test64: cannot execute binary file: Exec format error

看样子还是不行,我的程序白口胡写了……唉……

Stage 3:编译64位内核:

偶然间发现一篇旧的文章,阐述了自行编译内核的方法,笔者遂依葫芦画瓢编译内核。

至于编译内核用的工具链?

  1. sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

然后……

  1. git clone https://github.com/raspberrypi/linux.git
    #4.12解决了VCHI和WiFi问题
    git checkout rpi-4.12.y
  2.  
  3. cd linux
  1. #带##的是注释掉的原文指令
    ## make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

  2. make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcmrpi3_defconfig
  1. # 调整配置
    # 详见 https://www.cnblogs.com/UMRNInside/p/7197656.html
    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
  1.  
  2. ## make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  3.  
  4. make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j $(nproc)

然后是就是漫长的等待(git clone 会产生1.54GiB的流量,消耗2G以上的磁盘空间;至于编译过程……我想大家都懂得。)

工具链来源(可选):

  1. sudo apt install gcc-aarch64-linux-gnu

接下来:

  1. #设SD卡根分区位于/mnt/ext4,boot分区位于/mnt/boot
  2. cp arch/arm/boot/Image mnt/fat32/kernel8.img
  3.  
  4. make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=/mnt/ext4 modules
  5. make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=/mnt/ext4 modules_install
  6. mv /mnt/boot/bcm2710-rpi--b.dtb bcm2710-rpi--b.dtb_32
  7.  
  8. cp arch/arm64/boot/dts/broadcom/bcm2710-rpi--b.dtb /mnt/boot

试着启动树莓派,一次成功,板载无线网卡以AP模式正常工作。

此时系统大部分组件仍为32位版本,RPi.GPIO无法正常使用,且无法使用硬浮点指令集(使用aarch64-linux-gnu-)。

尝试向树莓派3B引入Drbian 9 arm64-PART 1的更多相关文章

  1. 树莓派3B+上运行.Net Core项目

    最近买了个树莓派3B+,准备把自己写的一个.Net Core爬虫挂在上面跑 买之前没有想到树莓派因为是今年新出的,导致驱动以及系统啥的都不是很完善,导致走了很多弯路,早知道买树莓派3就不用那么多折腾了 ...

  2. 树莓派3b+ Ubuntu 16.04 MATA系统 ssh远程登陆后修改主机名、用户密码和用户名

    写在前面: 刚刚开始写博客,记录下自己的学习过程,备忘. 最近在使用树莓派做智能小车的开发,使用的是树莓派3b+,安装的是Ubuntu 16.04 MATA 系统,安装系统后需要修改主机名,登陆密码以 ...

  3. 树莓派3b安装Nginx和php7和百度语音合成模块

    1.安装sox系统mp3音频播放模块(项目需要) sudo apt-get install lame sudo apt-get install sox sudo apt-get install lib ...

  4. [记录]学习树莓派3B接DHT11和LCD1602和修改树莓派时区

    前提 树莓派系统安装好 apache web 服务器,如未安装,可在树莓派内执行sudo apt-get install apache2 进行安装apache 也可以通过命令获取GPIO信息: gpi ...

  5. Linux实现树莓派3B的国密SM9算法交叉编译——(二)miracl库的测试与静态库的生成

    先参考这篇文章 Linux实现树莓派3B的国密SM9算法交叉编译——(一)环境部署.简单测试与eclipse工程项目测试 部署好环境,并简单测试交叉编译环境是否安装成功,最后实现在Eclipse上进行 ...

  6. 树莓派3B+之Raspbian系统的安装

    概述 因为之前一段时间在研究物联网的原因,所以对树莓派这个东西早就有所耳闻.在我的印象里,树莓派几乎无所不能,它可以用来学编程. 搞物联网. 做服务器,甚至还能用它来进行渗透测试.终于,没禁的住诱惑, ...

  7. 树莓派3B/3B+/4B 刷机装系统烧录镜像教程

    树莓派3B/3B+/4B 刷机装系统烧录镜像教程 树莓派 背景故事 刚拿到树莓派的第一件事,应该就是要装系统了,那么应该怎么操作呢?下面就给大家介绍一下吧. 硬件准备 树莓派:3B/3B+/4B,本教 ...

  8. 树莓派3B上手一二

    树莓派3B上手一二 早些时间心血来潮买过一个树莓派,但是当时只是玩一玩,买来按照网上的教程摆弄了一下就闲置了.最近毕业设计,做时序数据分析的相关的工作,刚好想起能够用到树莓派+Node-RED来生成模 ...

  9. 树莓派3B搭建NODE-RED运行环境并构建数据流

    树莓派3B搭建NODE-RED运行环境并构建数据流 树莓派搭建Node-RED环境 树莓派自2015年开始是默认就带NODE-RED的,但是如今已是2018年:)自带的版本已经很老了,可通过下面的命令 ...

随机推荐

  1. 天方夜谈·数据结构·Queue

    "我在想Y的时候不能想X....." 什么叫做Queue(队列)?"队列是项的集合,对于每一项x和y,如果x在y之前离开对头,那么x一定在y之前进入队列--Sesh·Ve ...

  2. 安卓和iOS移动APP开发设计应该考虑哪些问题

    应该考虑哪些问题 现在用移动设备上网的用户越来越多,企业也可以从移动APP端挖掘潜在用户,想要设计好一款移动APP,我们需要考虑哪几个问题呢? 首先 我们应该先确认清楚企业的移动互联网战略目标是什么? ...

  3. python基本运算

    环境:python3.x a,b = 60,164 一.算数运算符 操作符 描述 例子 + 加法 a+b = 224 - 减法 a-b = -104 * 乘法 a*b = 9840 / 除(保留小数位 ...

  4. 时间序列预测之--ARIMA模型

    什么是 ARIMA模型 ARIMA模型的全称叫做自回归移动平均模型,全称是(ARIMA, Autoregressive Integrated Moving Average Model).也记作ARIM ...

  5. Java AOP (2) runtime weaving 【Java 切面编程 (2) 运行时织入】

    接上一篇 Java AOP (1) compile time weaving [Java 切面编程 (1) 编译期织入] Dynamic proxy   动态代理 Befor talking abou ...

  6. Servlet,过滤器,监听器,拦截器的区别

    1.过滤器 Servlet中的过滤器Filter是实现了javax.servlet.Filter接口的服务器端程序,主要的用途是过滤字符编码.做一些业务逻辑判断等.其工作原理是,只要你在web.xml ...

  7. spring boot入门(一)自己动手搭建spring boot

    spring boot官方文档  http://docs.spring.io/spring-boot/docs/1.2.3.RELEASE/reference/html/index.html 此篇文章 ...

  8. MyBatis之级联——一对一关系

    在学数据库概论的时候会听到这么几个词:数据库的关系分为一对一.一对多.多对多.对于在学校里学的知识已经忘得差不多了,在这里简单的提一下数据库的关系.此篇是介绍MyBatis是如何实现数据库中一对一关系 ...

  9. 一次基于Vue.Js用户体验的优化

    .mytitle { background: #2B6695; color: white; font-family: "微软雅黑", "宋体", "黑 ...

  10. 《Android进阶》之第五篇 Fragment 的使用

    http://blog.csdn.net/lmj623565791/article/details/37970961 1.Fragment的产生与介绍 Android运行在各种各样的设备中,有小屏幕的 ...