0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

如何在树莓派4上安装 openwrt?

jf_70714899 来源:jf_70714899 作者:jf_70714899 2023-06-07 10:25 次阅读

openwrt

安装

At the PC:
#unzip the Image

gzip -d openwrt-21.02.0-bcm27xx-bcm2708-rpi-squashfs-factory.img.gz
# insert SD-card and check the name, alternatively check dmesg
lsblk
# copy the Image 1:1 to the SD-card
sudo dd if=openwrt-21.02.0-bcm27xx-bcm2708-rpi-squashfs-factory.img of=/dev/mmcblk0 bs=1M conv=fsync

扩展文件系统

SSH INTO THE RASPBERRY PI:

opkg install kmod-usb-storage kmod-usb-ohci kmod-usb-uhci e2fsprogs fdisk resize2fs
fdisk /dev/mmcblk0

(also see the less finicky way by @SemperEnim below):

To make it clear what I entered, here the complete session of fdisk. Please note how the first sector remains unaltered:
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/mmcblk0: 14.99 GiB, 16096690176 bytes, 31438848 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: 0x5452574f

Device         Boot  Start    End Sectors  Size Id Type
/dev/mmcblk0p1 *      8192 139263  131072   64M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      147456 360447  212992  104M 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-31438847, default 2048): 147456
Last sector, +/-sectors or +/-size{K,M,G,T,P} (147456-31438847, default 31438847): 

Created a new partition 2 of type 'Linux' and of size 14.9 GiB.
Partition #2 contains a squashfs signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): p

Disk /dev/mmcblk0: 14.99 GiB, 16096690176 bytes, 31438848 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: 0x5452574f

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *      8192   139263   131072   64M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      147456 31438847 31291392 14.9G 83 Linux

Command (m for help): w
The partition table has been altered.
Syncing disks.

REBOOT AND LOG IN AGAIN

The device usage and sizes are now as follows (my SD-card is 16 GB in size). The size needs still needs to be adjusted:

df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.3M      4.3M         0 100% /rom
tmpfs                   217.9M     52.0K    217.9M   0% /tmp
/dev/loop0               92.7M      2.6M     83.1M   3% /overlay
overlayfs:/overlay       92.7M      2.6M     83.1M   3% /
/dev/mmcblk0p1           63.9M     17.3M     46.6M  27% /boot
tmpfs                   512.0K         0    512.0K   0% /dev

Actually this was easier than expected, simply use resize2fs:

opkg update && opkg install resize2fs

resize2fs /dev/loop0

resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/loop0 is mounted on /overlay; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 120
The filesystem on /dev/loop0 is now 15641408 (1k) blocks long.

AND NOW DF -H RETURNS THE ADJUSTED SIZE:

df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.3M      4.3M         0 100% /rom
tmpfs                   217.9M     56.0K    217.9M   0% /tmp
/dev/loop0               14.5G      3.1M     13.9G   0% /overlay
overlayfs:/overlay       14.5G      3.1M     13.9G   0% /
/dev/mmcblk0p1           63.9M     17.3M     46.6M  27% /boot
tmpfs                   512.0K         0    512.0K   0% /dev

WX:上海晶珩电子

审核编辑黄宇

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • OpenWrt
    +关注

    关注

    10

    文章

    130

    浏览量

    39301
  • 树莓派
    +关注

    关注

    116

    文章

    1707

    浏览量

    105618
收藏 人收藏

    评论

    相关推荐

    「EDATEC」如何在树莓4安装64位操作系统

    本文将帮助您在树莓 4 安装树莓 64 位操作
    的头像 发表于 03-31 17:11 2884次阅读
    「EDATEC」如<b class='flag-5'>何在</b><b class='flag-5'>树莓</b><b class='flag-5'>派</b><b class='flag-5'>4</b><b class='flag-5'>上</b><b class='flag-5'>安装</b>64位操作系统

    树莓如何安装和启动

    btw.我的显示器是VGA接口的,所以用的是HDMI转VGA安装树莓1.先将安装好系统的SD卡插入树莓
    发表于 06-30 23:18

    何在win系统下安装树莓的系统到SD卡

    何在win系统下安装树莓的系统到SD卡准备工作:1.最好最准备一张4G以上的SD卡,最好是
    发表于 06-30 23:34

    树莓3如何刷OpenWrt

    树莓3如何刷OpenWrt
    发表于 11-09 06:43

    树莓学习之树莓4B的安装与配置资料下载

    树莓学习之树莓4B的安装与配置前期准备开启SSH及配置无线连接
    发表于 07-02 07:56

    树莓4B安装及使用

    实验一树莓4B安装及使用目录实验一 树莓4B
    发表于 12-13 06:12

    树莓设置基本流程(

    第一步,在win系统下安装树莓的系统到SD卡 第二步,安装和启动树莓 第三步,如何设置
    发表于 11-30 11:03 17次下载

    树莓_库函数安装教程

    树莓_库函数安装教程,树莓嵌入式拔高篇,非常适合新手学习
    发表于 01-14 15:12 32次下载

    树莓的种类_树莓安装教程

    树莓(Raspberry Pi)是尺寸仅有信用卡大小的一个小型电脑,您可以将树莓连接电视、显示器、键盘鼠标等设备使用。目前,树莓
    发表于 11-27 22:01 5388次阅读

    树莓3硬件配置_树莓3都能装什么系统_树莓3系统安装教程

    树莓3一直颇受电子发烧友的青睐,这篇文章主要讨论的就是树莓3的硬件配置、树莓3都能装什么系
    发表于 12-08 14:36 2.6w次阅读

    树莓3系统安装介绍_Noobs进行树莓3系统安装_Noobs进行树莓3系统恢复

    这篇文章主要和大家一起来讨论一下关于树莓3的系统安装是什么,基于Noobs的树莓3的系统安装
    发表于 12-08 15:02 5962次阅读
    <b class='flag-5'>树莓</b><b class='flag-5'>派</b>3系统<b class='flag-5'>安装</b>介绍_Noobs进行<b class='flag-5'>树莓</b><b class='flag-5'>派</b>3系统<b class='flag-5'>安装</b>_Noobs进行<b class='flag-5'>树莓</b><b class='flag-5'>派</b>3系统恢复

    使用树莓设计智能小车教程之如何进行树莓模块安装资料免费下载

      本文档的主要内容详细介绍的是使用树莓设计智能小车教程之如何进行树莓模块安装资料免费下载。
    发表于 06-24 08:00 21次下载

    树莓3和树莓4的原理图免费下载

    本文档的主要内容详细介绍的是树莓3和树莓4的原理图免费下载。
    发表于 01-07 10:23 92次下载
    <b class='flag-5'>树莓</b><b class='flag-5'>派</b>3和<b class='flag-5'>树莓</b><b class='flag-5'>派</b><b class='flag-5'>4</b>的原理图免费下载

    树莓3和树莓4的原理图免费下载

    本文档的主要内容详细介绍的是树莓3和树莓4的原理图免费下载。
    发表于 01-07 10:23 223次下载
    <b class='flag-5'>树莓</b><b class='flag-5'>派</b>3和<b class='flag-5'>树莓</b><b class='flag-5'>派</b><b class='flag-5'>4</b>的原理图免费下载

    树莓树莓4B新手篇:安装官网Raspbian Buster系统及基础配置

    目录1、前言2、树莓4B有什么特色?3、树莓新手准备4、烧录Raspbian Buster系
    发表于 11-06 18:21 26次下载
    【<b class='flag-5'>树莓</b><b class='flag-5'>派</b>】<b class='flag-5'>树莓</b><b class='flag-5'>派</b><b class='flag-5'>4</b>B新手篇:<b class='flag-5'>安装</b>官网Raspbian Buster系统及基础配置