Stage 1:使用debootstrap制作64位组件
尽管内核工作于64位模式,但系统大多数组件仍旧处于32位模式下。
我们的目标是引入Debian 9 arm64,自然会想到使用debootstrap。
在树莓派上,给一张SD卡分两个区:
- 一个在前面,大小100M左右,使用
mkfs.vfat
,类型为W95 FAT32 - 一个占用后面所有的空间,视
/boot/cmdline.txt
中rootfstype
的设置选择分区格式
然后(在树莓派上)开干:sudo debootstrap --verbose --arch=arm64 stretch . https://mirrors.ustc.edu.cn/debian/
编辑sources.list
:
deb http://mirrors.ustc.edu.cn/debian/ stretch main
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/ jessie main non-free contrib
apt.conf
:APT::Default-Release "stretch";
Chroot和之前的准备工作:
sudo mount -t proc proc proc
sudo mount -t sysfs sysfs sys
sudo mount -o bind /dev dev
sudo chroot .
视具体情况安装软件包。
apt install hostapd wpasupplicant udhcpd screen dnsmasq sudo openssh-server firmware-brcm80211 ...
- firmware-brcm80211:使系统识别树莓派3板载网卡
- hostapd,udhcpd,dnsmasq:启动AP必备
- wpasupplicant:用于连接Wifi热点
- openssh-server:SSH服务器
- sudo,screen:这两个想必大家都听说过吧……
退出Chroot环境,复制配置文件及其它核心组件,例如:
/boot
/lib/modules
/etc/passwd
/etc/shadow
/etc/sudoers
/etc/hostapd
/etc/default
/etc/udhcpd.conf
/etc/udev/
/etc/dnsmasq.conf
...
成功启动。
但是有烦人的提示(如果没有就无视掉吧……):ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
解决方案显而易见:
sudo mv /etc/ld.so.preload /etc/ld.so.preload.bak
sudo touch /etc/ld.so.preload
如果你使用了一张新的SD卡,记得编辑/etc/fstab!
Stage 2:站稳脚跟
*执行apt-get update
,提示:
Ign:1 https://mirrors.ustc.edu.cn/debian stretch InRelease
Get:2 https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease [22.9 kB]
Hit:2 https://mirrors.ustc.edu.cn/archive.raspberrypi.org jessie InRelease
Get:3 https://mirrors.ustc.edu.cn/debian stretch Release [113 kB]
Hit:3 https://mirrors.ustc.edu.cn/debian stretch Release
Can't locate Storable.pm in @INC (you may need to install the Storable module) (@INC contains: /etc/perl /usr/local/lib/aarch64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/aarch64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/aarch64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/aarch64-linux-gnu/perl-base) at /usr/bin/apt-show-versions line 37.
BEGIN failed--compilation aborted at /usr/bin/apt-show-versions line 37.
Reading package lists... Done
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'
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'
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'
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'
E: Problem executing scripts APT::Update::Post-Invoke-Success 'test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i'
E: Sub-process returned an error code
笔者尝试执行sudo apt-get install apt-show-versions
,问题解决。
小结
路曼曼其修远兮,吾将上下而求索。
目前整个系统仅仅只是能用,还有许多不完美的地方。
更新
4.12的内核可以使树莓派工作得更好,ACT灯和VCHI将正常工作。