KCN

用来放零碎东西的

  • 主页
所有文章 友链 关于我

KCN

用来放零碎东西的

  • 主页

64位Raspberry OS

2020-06-25
字数统计: 855字   |   阅读时长≈ 4分

  Raspberry OS在5月28号发布了64位OS的beta版本可以供Pi3和Pi4的设备使用。之前做的树莓派网络启动更换OS非常简单,只需要把Boot镜像和文件系统镜像更换了就行。

准备NFS镜像

  1. 下载镜像文件并解压,得到2020-05-27-raspios-buster-arm64.img。链接:2020.5.27 beta版下载地址

  2. 在nfs服务器上挂载img文件里面的boot和root分区

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    # mkdir -p /mnt/boot /mnt/arm64
    # fdisk -l 2020-05-27-raspios-buster-arm64.img
    Disk 2020-05-27-raspios-buster-arm64.img: 3.5 GiB, 3711959040 bytes, 7249920 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x99cc74d8

    Device Boot Start End Sectors Size Id Type
    2020-05-27-raspios-buster-arm64.img1 8192 532479 524288 256M c W95 FAT32 (LBA)
    2020-05-27-raspios-buster-arm64.img2 532480 7249919 6717440 3.2G 83 Linux
    # mount -o loop,offset=4194304 /volume1/nfs/2020-05-27-raspios-buster-arm64.img /mnt/boot
    # mount -o loop,offset=272629760 /volume1/nfs/2020-05-27-raspios-buster-arm64.img /mnt/arm64/
    root@DS1515:/volume1/nfs#

    mount的offset是根据分区的StartSector size。比如boot分区是8192512=4194304,root分区是532480*512=272629760

  3. 将boot和root分区拷贝到nfs和tftproot。

    1
    2
    3
    # mkdir /volume1/nfs/tftproot/newroot/ /volume1/nfs/rpi4b-arm64
    # rsync -xa --progress /mnt/boot/ /volume1/nfs/tftproot/newroot/
    # rsync -xa --progress /mnt/arm64/ /volume1/nfs/rpi4b-arm64/

更改启动配置

  1. 打开ssh

    1
    # touch /volume1/nfs/tftproot/newroot/ssh
  2. 从nfsroot启动

    1
    # echo "console=serial0,115200 console=tty1 rw root=/dev/nfs nfsroot=192.168.2.45:/volume1/nfs/rpi4b-arm64,v3,tcp ip=dhcp elevator=deadline rootwait" > /volume1/nfs/tftproot/57360526/cmdline.txt

    也可以使用静态IP取代dhcp

    1
    2
    # cat /volume1/nfs/tftproot/57360526/cmdline.txt
    console=serial0,115200 console=tty1 rw root=/dev/nfs nfsroot=192.168.2.45:/volume1/nfs/rpi4b-arm64,v3,tcp ip=192.168.2.11:::255.255.255.0:rpi:eth0:off elevator=deadline rootwait

    ip的参数看kernel的文档

    1
    ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>:<ntp0-ip>

将之前的系统文件复制到新系统

  1. 需要同步的文件的列表.因为新系统,没有太多需要同步的

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    # cat sync_sys.files
    + /
    + /etc/
    + /etc/passwd
    + /etc/fstab
    + /etc/shadow
    + /etc/group
    + /etc/gshadow
    + /etc/sudoers
    + /etc/localtime
    + /etc/ssh/
    + /etc/ssh/**
    + /home/
    + /home/**
    - *
  2. 同步文件

    1
    # rsync --progress -xa --include-from sync-sys.files /volume1/nfs/rpi4b-8g/ /volume1/nfs/rpi4b-arm64/

重新启动

  1. 更换tftproot的启动目录。树莓派缺省是通过tftp服务器上的/{序列号}/目录启动,将新的目录替代原来的

    1
    2
    # mv /volume1/nfs/tftproot/57360526 /volume1/nfs/tftproot/32bit
    # mv /volume1/nfs/tftproot/newroot /volume1/nfs/tftproot/57360526
  2. 重新启动搞定
    看看系统已经是aarch64了。

    1
    2
    3
    4
    # uname -a
    Linux raspberrypi 5.4.42-v8+ #1319 SMP PREEMPT Wed May 20 14:18:56 BST 2020 aarch64 GNU/Linux
    # file /bin/bash
    /bin/bash: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=b11533bde88bb45ef2891fbf3ad86c1869ed3a41, stripped
  3. 镜像源,目前国内的镜像源还没有同步raspberry arm64的包,清华raspbian镜像目录只有armhf的。所以只能改debian buster的arm64镜像。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # cat /etc/apt/sources.list
    deb http://mirrors.tuna.tsinghua.edu.cn/debian buster main non-free contrib
    deb http://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free
    deb http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free
    #deb http://deb.debian.org/debian buster main contrib non-free
    #deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
    #deb http://deb.debian.org/debian buster-updates main contrib non-free
    # Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
    #deb-src http://deb.debian.org/debian buster main contrib non-free
    #deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free
    #deb-src http://deb.debian.org/debian buster-updates main contrib non-free

    /etc/apt/sources.list.d/raspi.list保持不动。

  • 本文作者: KCN
  • 本文链接: https://www.kcn.me/2020/06/25/Raspberry-upgrade-64bit/
  • 版权声明: 未经允许,请勿转载

扫一扫,分享到微信

Catalina Fusion Drive
Raspberry pi无盘网络启动(network booting)
© 2015-2023 KCN
GitHub:hexo-theme-yilia-plus by Litten
  • 所有文章
  • 友链
  • 关于我

tag:

  • vmware
  • cisco 家里网络

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia-plus根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • 水木社区
  • kxn的主页
水木社区的KCN
以前搜狐的高级技术副总裁
狐狸金服的CTO
爱技术爱生活的技术人