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

    文章

    117

    浏览量

    38876
  • 树莓派
    +关注

    关注

    113

    文章

    1639

    浏览量

    104743
收藏 人收藏

    评论

    相关推荐

    树莓如何安装和启动

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

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

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

    树莓分享之系统安装

    网给出了卡通的图,也给出了树莓相关的产品,我们也看到了树莓推出的最新的产品,RaspberryPi Zero一款售价更为便宜的树莓
    发表于 12-19 01:05

    树莓网络控制的船

    ,IN2,IN3,IN4。第三步:设置树莓先确认树莓安装了Raspbian,把USB WiF
    发表于 01-20 15:24

    树莓安装DIN导轨

    ` 本帖最后由 348081236 于 2016-2-18 10:33 编辑 为树莓安装DIN导轨(其实是装在壳子啦),在很多方面都有应用。这里大家看看装的过程。反正我装了一个
    发表于 02-18 10:31

    树莓安装官方系统

    只提供电脑板,无内存、电源、键盘、机箱或连线。树莓可接的外设树莓安装Linux系统必备1.充电宝(可以输出2A电流)2.读卡器3.内存卡
    发表于 04-29 18:36

    树莓基础功能设置

    树莓基础功能设置 目录1、重置root密码,树莓开启root2、树莓配置‘ll’命令3、
    发表于 03-02 09:10

    树莓智能车AlphaBot系列教程

    教程4:遥控树莓智能车AlphaBot教程5:红外循迹 ...树莓智能车AlphaBot教程7:mjpg-streamer 网络 ...
    发表于 05-15 15:39

    树莓3如何刷OpenWrt

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

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

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

    树莓4B有什么特色

    目录1、前言2、树莓4B有什么特色?3、树莓新手准备4、烧录Raspbian Buster系
    发表于 11-11 07:40

    树莓4B安装及使用

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

    怎样去设计一个基于树莓4B的智能小车

    可以参考我以前的文章《 树莓4B 极简安装教程(通俗易懂)》,这里只讲怎么安装小车1、笔记本电脑一台2、网线一根3、typec 电源线和插
    发表于 01-12 06:55

    在arm的云服务器外树莓4安装kata-container

    是更为经济的选择。这里需要注意的是kata只能跑在pi4,因为kata需要gic的支持,而目前只有pi4支持gic。1、准备工作:一台树莓
    发表于 07-12 16:02

    树莓3树莓4原理图分享

    提供了树莓3、树莓3B、树莓4版本的原理图
    发表于 09-27 07:58