Buildroot编译hisi平台根文件系统

article/2025/11/7 18:51:33

Buildroot编译hisi平台根文件系统

文章目录

      • 1. 下载Buildroot源码
      • 2. Menuconfig配置
      • 3. 编译Buildroot
        • 3.1 手动下载软件包
        • 3.2 kernel header 报错
        • 3.3 `arm-hisiv300-linux-gcc-ar:cannot find plugin liblto_plugin.so`
        • 3.4 `/media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft/libm.so: file not recognized: Is a directory`
        • 3.5 `/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin/../lib/gcc/arm-hisiv300-linux-uclibcgnueabi/4.8.3/../../../../arm-hisiv300-linux-uclibcgnueabi/bin/ld: cannot find libc.so.0`
        • 3.6 `fallocate.c:(.text.fallocate_main+0xa0): undefined reference to 'posix_fallocate'`
        • 3.7 其它错误
      • 4. 烧录测试

记录一次Buildroot构建根文件系统的经历。使用buildroot构建imx6ull平台的根文件系统,参考整点原子的教程,过程十分顺利,换成hisi倒是遇到很多问题,这里做个记录。

1. 下载Buildroot源码

进入Buildroot官网下载。这里直接下载最新版本的长期支持的release源码,版本是2022.02.8

复制到docker编译环境的共享文件夹中,然后解压。docker环境中已经安装了arm-hisiv300-linux 编译工具链。由于我使用的docker容器是ubuntu18,因此建议直接下载最新的Buildroot,因为使用老版本,可能会遇到更多的编译问题,最好是换个老点的系统。为了不更换系统,这里直接使用最新版本的Buildroot。

$ docker start hisi 
$ docker exec -it -u duapple hisi /bin/bash
duapple@92fa1c7e1a00:/media/data/hisi/buildroot-2022.02.8$ ls 
CHANGES  Config.in         DEVELOPERS  Makefile.legacy  arch   boot     docs  linux    support  toolchain
COPYING  Config.in.legacy  Makefile    README           board  configs  fs    package  system   utils

2. Menuconfig配置

一般来说,会先从config 中寻找支持的芯片板卡默认配置文件。将其辅助到buildroot根目录,并命名为.config,这样就能使用某个芯片的默认配置了。但是新版的Buildroot源码中已经没有hisi的默认配置了。为了知道怎么配置架构,在网上找到了曾经适配好hisi平台的Buildroot源码,使用sudo make menuconfig 查看了它的默认配置,主要配置Target optionsToolchainSystem configurationFilesystem images

由于不是Buildroot构建KernelUboot ,所以不需要配置Kernel和Bootloaders。这里也不构建交叉编译工具链,直接使用外部工具链即hisi的交叉编译工具链。

注意,不要使用该源码的.config,不能通过复制该.config 到我们下载的Buildroot源码目录。由于该源码是15年的,比较久远了,配置文件可能存在一些兼容性问题,会导致配置无法保存生效。因此打开该源码的menuconfig,在新源码中进行相应的配置即可。如果是版本较劲的Buildroot源码,可以直接使用。该源码的config 目录下有hi3518e_defconfig 文件,可以作为我们的参考配置。

配置Target options

在这里插入图片描述

配置Toolchain

这里使用外部工具链。工具链gcc版本可以通过arm-hisiv300-linux-gcc -v进行查看。与参考的Buildroot里面并不一致。

在这里插入图片描述

配置System configuration

这里需要配置mdev,否则/dev下不会自动生成设备,无法进入console。另外还可以配置欢迎语与登陆密码。

在这里插入图片描述

配置Filesystem images

这里选两个常用文件系统格式配置,jffs2和squashfs。注意这里我使用的hisi的flash的jffs2块大小是64k,因此需要配置64kb。jffs2支持写入,squashfs能够做到最大压缩。

在这里插入图片描述

取消Kernel编译

在这里插入图片描述

取消Uboot编译

在这里插入图片描述

配置完成后退出并保存配置。可以先复制一份配置好的到configs目录备份。

cp .config configs/hi3518e_defconfig

3. 编译Buildroot

编译工具链和Kernel会有很多问题,因此前面选择不编译工具链和Kernel。直接使用Hisi提供的能够直接编译成功的Kernel。但是依然还需要解决一些问题。

执行编译:

sudo make 

之后Buildroot会开始根据我们的配置下载软件包进行编译。软件包下载过程,可能会遇到下不动的软件包,我们直接在输出日志中找到链接,手动下载到dl目录下。然后重新执行sudo make 。可以使用proxychains代理wget,或者直接使用浏览器下载。

接下来慢慢等待第一个编译问题。

3.1 手动下载软件包

首先就出现了host-fakeroot 软件包下载不动,下载到84%就停住了。这里直接终止编译,手动下载软件包,再重新编译。

在这里插入图片描述

cd dl 
sudo wget https://snapshot.debian.org/archive/debian/20210907T092512Z/pool/main/f/fakeroot/fakeroot_1.26.orig.tar.gz

在这里插入图片描述

重新编译:

cd ../
sudo make 

另外,如果有其它软件包下载不动,也是通过手动下载的方式解决。

3.2 kernel header 报错

>>> toolchain-external-custom  Extracting
>>> toolchain-external-custom  Patching
>>> toolchain-external-custom  Configuring
Incorrect selection of kernel headers: expected 3.4.x, got 3.5.x
make: *** [package/pkg-generic.mk:283: /media/data/hisi/buildroot-2022.02.8/output/build/toolchain-external-custom/.stamp_configured] Error 1

报上面的错,根据旧Buildroot的配置,头文件版本我们配置的3.4.x,这里提示识别到的是3.5.x。因此在menuconfig中,修改其为3.5.x 。同样的,gcc版本,前面也是修改过的,以我们的实际版为准。

修改后,保存,并备份.config ,重新编译。

3.3 arm-hisiv300-linux-gcc-ar:cannot find plugin liblto_plugin.so

参考:https://developer.aliyun.com/ask/130445

修改arm-hisiv300-linux-gcc-ar软链接到arm-hisiv300-linux-ar

sudo apt install lib32z1-dev
cd output/host/bin
sudo ln -sf /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin/arm-hisiv300-linux-ar arm-hisiv300-linux-gcc-ar

3.4 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft/libm.so: file not recognized: Is a directory

进入这个/media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft/目录。可以看到文件动态库的链接都被链接到目录上了。因此报错libm.so是一个目录,并不是一个动态库。

在这里插入图片描述

解决办法是将hisi工具链中的动态库复制到这个目录,重新生成这些软链接。

先进入hisi交叉编译工具链目录,然后查找这些动态库。

duapple@92fa1c7e1a00:/media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_
arm9_soft$ cd /opt/hisi-linux/x86-arm/arm-hisiv300-linux/
duapple@92fa1c7e1a00:/opt/hisi-linux/x86-arm/arm-hisiv300-linux$ find . -name libm.so
./target/usr/lib/a9_softfp_vfp/libm.so
./target/usr/lib/a7_softfp_neon-vfpv4/libm.so
./target/usr/lib/libm.so
./target/usr/lib/a9_vfpv3_neon/libm.so
./target/usr/lib/a9_hard_neon/libm.so
./target/usr/lib/armv5te_arm9_soft/libm.so
./target/usr/lib/a9_soft/libm.so
./target/usr/lib/armv5te_arm9_vfp/libm.so
./target/usr/lib/a9_softfp_vfpv3-d16/libm.so
./target/usr/lib/a7_softfp_vfpv4/libm.so
./target/usr/lib/a7_hard_neon-vfpv4/libm.so
./target/usr/lib/a7_soft/libm.so

上面报错的目录是arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_ arm9_soft,因此在我们查找到的结果中,找到对应的目录文件,应该./target/usr/lib/armv5te_arm9_soft/libm.so ,复制到上面报错的目录。但是由于这个文件是软链接,我们需要复制实际链接到的文件libm.so.0

lrwxrwxrwx  1 root root      36 Feb 24  2016 libm.so -> ../../../armv5te_arm9_soft/libm.so.0

../../../armv5te_arm9_soft/目录下,复制完成后,重新生成报错目录下的软链接。

sudo cp ./target/armv5te_arm9_soft/libm.so.0 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
cd /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo rm libm.so
sudo ln -s libm.so.0 libm.so

重新生成软链接成功:

lrwxrwxrwx 1 root root       9 Jan  1 20:01 libm.so -> libm.so.0
-rwxr-xr-x 1 root root   69147 Jan  1 19:59 libm.so.0

同样的,将其它链接到目录的动态库链接以同样的方式重新生成。

cd /opt/hisi-linux/x86-arm/arm-hisiv300-linux/
sudo cp target/armv5te_arm9_soft/libcrypt.so.0 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo cp target/armv5te_arm9_soft/libdl.so.0 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo cp target/armv5te_arm9_soft/libnsl.so.0 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo cp target/armv5te_arm9_soft/libresolv.so.0 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo cp target/armv5te_arm9_soft/librt.so.0 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo cp target/armv5te_arm9_soft/libthread_db.so.1 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo cp target/armv5te_arm9_soft/libutil.so.0 /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
cd /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft
sudo rm libcrypt.so 
sudo ln -s libcrypt.so.0 libcrypt.so
sudo rm libdl.so
sudo ln -s libdl.so.0 libdl.so
sudo rm libnsl.so
sudo ln -s libnsl.so.0 libnsl.so
sudo rm libresolv.so
sudo ln -s libresolv.so.0 libresolv.so
sudo rm librt.so
sudo ln -s librt.so.0 librt.so
sudo rm libthread_db.so
sudo ln -s libthread_db.so.1 libthread_db.so
sudo rm libutil.so
sudo ln -s libutil.so.0 libutil.so

修改后,全部动态库链接都正常了,再次尝试重新编译。

在这里插入图片描述

3.5 /opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin/../lib/gcc/arm-hisiv300-linux-uclibcgnueabi/4.8.3/../../../../arm-hisiv300-linux-uclibcgnueabi/bin/ld: cannot find libc.so.0

参考上面的解决方式,在工具链目录找到对应的libc.so.0,复制到对应的目录下。为了防止找不到其它的库,直接将工具链target/armv5te_arm9_soft 目录下的所有文件复制过去。

sudo cp -d target/armv5te_arm9_soft/*  /media/data/hisi/buildroot-2022.02.8/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/armv5te_arm9_soft

3.6 fallocate.c:(.text.fallocate_main+0xa0): undefined reference to 'posix_fallocate'

参考:https://blog.csdn.net/qq_44045338/article/details/109368225。

在busybox中关闭该模块。

sudo make busybox-menuconfig

在这里插入图片描述

保存并退出,然后重新编译。

3.7 其它错误

在打印下面的内容后,根文件系统已经编译完成了,生成了我们需要的镜像文件。

在这里插入图片描述

>>>   Generating filesystem image rootfs.jffs2
>>>   Generating filesystem image rootfs.squashfs
>>>   Generating filesystem image rootfs.tar

镜像文件路径output/images

duapple@92fa1c7e1a00:/media/data/hisi/buildroot-2022.02.8/output/images$ ls -lh 
total 3.9M
-rw-r--r-- 1 root root 995K Jan  1 20:30 rootfs.jffs2
-rw-r--r-- 1 root root 632K Jan  1 20:30 rootfs.squashfs
-rw-r--r-- 1 root root 2.3M Jan  1 20:31 rootfs.tar

注意,还有一些错误是编译期间不会暴露出来的,但是等到烧录根文件系统后,会导致启动报错。因为之前我已经解决了,因此可以直接进行修改。

先解压看看我们的rootfs文件夹及文件是否正常:

sudo mkdir rootfs 
sudo tar -xvf rootfs.tar -C rootfs

主要看两个地方,因为我使用buildroot2020.2版本编译,复制交叉编译工具链的mk执行会报错,由于解决不了,我在mk中忽略了该错误,最后会导致生成的根文件系统中缺少系统动态库,启动脚本缺少S10mdev。然后手动复制交叉编译工具链的动态库到output/target 目录中去,操作和前面的复制动态库一致,再复制package/busybox/S10mdev 脚本到output/target/etc/init.d/

由于最终打包的根文件系统目录是output/target,因此我们需要添加到根文件系统的文件都是可以直接放到这个目录对应位置的。

检查rootfs目录中的etc/init.d/S10mdevlibusr/lib ,动态库路径是否有必须的动态库,没有就直接把工具链对应架构版本的所有的动态库都复制到lib 中。

但是我在当前版本(buildroot-2022.02.8)中,没有遇到这个问题。

4. 烧录测试

搭建tftp服务器

配置好tftp服务器。将rootfs.jffs2rootfs.squashfs 复制到tftp服务器目录。

cp rootfs.jffs2 rootfs.squashfs /media/data/tftp/

配置uboot网络

启动hisi的开发板,启动过程键入任意键进入到uboot中。配置uboot的网络和虚拟机再同一网段。

setenv serverip 192.168.10.100
setenv ipaddr 192.168.10.101
setenv ethaddr 12:23:34:45:56:67
setenv netmask 255.255.255.0
setenv gatewayip 192.168.10.1
ping 192.168.10.100

烧录jffs2根文件系统

mw.b 82000000 ff C00000; tftp 0x82000000 rootfs.jffs2; sf probe 0; sf erase 400000 C00000; sf write 82000000 400000 C00000

在这里插入图片描述

设置启动参数

需要设置jffs2根文件系统的启动参数并保存:

setenv bootargs 'mem=64M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),3M(kernel),12M(rootfs)'
setenv bootcmd 'sf probe 0;sf read 0x82000000 0x100000 0x300000;bootm 0x82000000'
sa

重启系统

hisilicon # reset

果然,还是报错了。

TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
VFS: Mounted root (jffs2 filesystem) on device 31:2.
Freeing init memory: 140K
usb 1-1: new high-speed USB device number 2 using hiusb-ehci
/sbin/init: can't load library 'libc.so.0'
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00001000

缺少libc.so.o,说明根文件系统还是缺少某些必要的动态库。这里再按照上面所说的方法,复制一下动态库到output/target/lib 中去。这里由于我的target/usr/lib 目录是空的,因此我还是把所有的库放到这个目录,以和output/target/lib/ 中存在的目录做一个区分。如果是init linuxrc 相关的kernel启动错误,也可能是由于缺少必要的动态库导致的。

duapple@92fa1c7e1a00:/opt/hisi-linux/x86-arm/arm-hisiv300-linux$ sudo cp -d target/armv5te_arm9_soft/* /media/data/hisi/buildroot-2022.02.8/output/target/usr/lib/duapple@92fa1c7e1a00:/opt/hisi-linux/x86-arm/arm-hisiv300-linux$ sudo cp -d arm-hisiv300-linux-uclibcgnueabi/lib/armv5te_arm9_soft/* /media/data/hisi/buildroot-2022.02.8/output/target/usr/lib

重新编译,重新烧录。

启动成功✿✿ヽ(°▽°)ノ✿

在这里插入图片描述

烧录squashfs根文件系统

操作步骤和烧录jffs2根文件系统保持一致。但是需要修改bootargs为squashfs对应的。

mw.b 82000000 ff C00000; tftp 0x82000000 rootfs.squashfs; sf probe 0; sf erase 400000 C00000; sf write 82000000 400000 C00000
setenv bootargs 'mem=64M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=squashfs mtdparts=hi_sfc:1M(boot),3M(kernel),12M(rootfs)'
setenv bootcmd 'sf probe 0;sf read 0x82000000 0x100000 0x300000;bootm 0x82000000'
sa

重启系统:

reset

报错:

devpts: called with bogus options
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
Starting syslogd: OK
Starting klogd: OK
Running sysctl: /etc/init.d/S02sysctl: line 37: can't create /dev/null: Read-only file system
usb 1-1.2: new high-speed USB device number 3 using hiusb-ehci
OK
Starting mdev... OK
mmc1: error -84 whilst initialising SD card
mmc1: new high speed SDHC card at address 5048
mmcblk0: mmc1:5048 SD32G 29.7 GiBmmcblk0: p1 p2
modprobe: can't change directory to '/lib/modules': No such file or directory
Starting network: OK
can't open /dev/console: No such file or directory
can't open /dev/console: No such file or directory
can't open /dev/console: No such file or directory
can't open /dev/console: No such file or directory
can't open /dev/console: No such file or directory

由于squashfs是只读文件系统,mdev创建不了这些设备,因此手动创建。

cd output/target/dev
sudo mknod console c 5 1 
sudo mknod ttyAMA0 c 204 64
sudo mknod null c 1 3
sudo chmod 666 console ttyAMA0 null 

重新编译打包文件系统,再烧录,启动成功:

在这里插入图片描述


http://chatgpt.dhexx.cn/article/rFOAMZoA.shtml

相关文章

yolov5转hisi的nnie(c and c++)

yolov5转hisi的nnie(c and c) 总述一. 训练前修改网络二. 导出模型三. 后处理1. c版2. 基于hisi SDK的纯c版(后续更新) 总述 刚躺了坑,记录一下,目的是将yolov5(6.1)转成海思可以推理的wk文件,…

HISI_3516_vi

主要的解释还是看这些大牛的,我这里只是想自己整理一遍:海思3518E开发笔记2.5——海思VI(video input)模块详解_Spark!的博客-CSDN博客_海思wdr目录海思video input模块架构介绍海思video input模块功能介绍结构体说明…

hisi Camera 开发--HiMPP媒体处理软件开发基本概念

1. HIMPP平台架构简介 海思提供的媒体处理软件平台(Media Process Platform,简称 MPP),可支持应用软件快速开发。该平台对应用软件屏蔽了芯片相关的复杂的底层处理,并对应用软件直接提供 MPI(MPP Program Interface)接口完成相应功能。该平台支持应用软件快速开发以下功能:输入…

Hisiphp

最近有个项目要用到后台,就选用了hisiphp这个框架,框架使用的是thinkphp5.1。现在将里面的应用记录下来,为了以后方便使用。 1,首先要开启,系统-系统开发-开发模式 2,进入系统--系统扩展--模块管理--设计新…

海思芯片介绍

1.芯片介绍 芯片SOC里集成了众多控制芯片,比如负责深度学习的NNIE硬核,负责图像处理的IVE硬核,视频编解码单元H265/H264Codec,以及图像处理单元ISP等 为了减少用户对于硬件的直接操作,海思为用户封装了许多对于硬件的操…

hisi平台异常重启问题分析

Hisi平台开发之异常重启问题分析 目录 1. 问题描述...................................................................................................................... 3 2. 问题跟踪排查......................................................................…

【HISI系列】之开发板调试基本知识

1. HISI 根文件系统简介 Linux 的目录结构的最顶层是一个被称为“ / ”的根目录。系统加载 Linux 内核之后,就会挂载一个设备到根目录上。存在于这个设备中的文件系统被称为根文件系统。所有的系统命令、系统配置以及其他文件系统的挂载点都位于这个根文件系统中。 …

HTTP Digest接入方式鉴权认证流程

HTTP Digest接入方式鉴权认证流程 一、摘要认证原理 摘要认证与基础认证的工作原理很相似,用户先发出一个没有认证证书的请求,Web服务器回复一个带有WWW-Authenticate头的响应,指明访问所请求的资源需要证书。但是和基础认证发送以Base 64编…

C++ libcurl Digest Auth

C libcurl Digest Auth postman操作如下: 附认证原理如下: MD5 md5; string HA1 md5("username:realm:password"); string HA2 md5("method:uri"); string response md5("HA1:nouce:nc:cnonce:qop:HA2"); 这里…

mysql sql语句digest收集与展示

1.前言 mysql慢查询,已经有现成的成熟的方案收集展示了:pt-query-digest结合box公司的anemometer,没用过的移步:《mysql慢查询可视化》(本章内容需要提前了解anemometer)。 但DBA们一定还遇到过这样的问题…

HTTP Digest authentication

什么是摘要认证 摘要认证( Digest authentication)是一个简单的认证机制,最初是为HTTP协议开发的,因而也常叫做HTTP摘要,在RFC2617中描述。其身份验证机制很简单,它采用杂凑式(hash&#xff09…

配置Apache Digest认证

Apache常见的用户认证可以分为下面三种: 基于IP,子网的访问控制(ACL)基本用户验证(Basic Authentication)消息摘要式身份验证(Digest Authentication) 消息摘要式身份验证(Digest Authentication) Digest Authentication在基本身份验证上面扩展了安全…

http Digest认证计算方法整理

摘要认证及实现HTTP digest authentication - 简书 HTTP Basic和Digest认证介绍与计算 - 诸子流 - 博客园 不要不知道上面说的URI是什么意思啊 图解HTTP 第 8 章 确认访问用户身份的认证 - 简书8.1 何为认证 为了弄清究竟是谁在访问服务器,就得让对方的客户端自报家…

业务维度digest日志的记录与监控方案

需求 ​   为了满足从业务整体的维度 实现监控和链路复原,我们希望对于一个业务接口,记录一行请求日志,并通过某个 Unique Id(如UserId、OrderId)将多行日志关联起来,最终产出一批和业务强相关的数据&am…

java发起Digest Auth请求

常规认证方式 上代码&#xff1a; 需要的Maven <dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5</version></dependency><dependency><groupId>org.…

认证学习3 - Digest摘要认证讲解、代码实现、演示

文章目录 Digest摘要认证 - 密文讲解&#xff08;Digest摘要认证&#xff09;实现&#xff08;Digest认证&#xff09;代码&#xff08;Digest认证&#xff09;代码&#xff08;Digest认证-客户端&#xff09;演示&#xff08;Digest认证-postman&#xff09; 认证大全&#xf…

HTTP的认证方式之DIGEST 认证(摘要认证)

核心步骤&#xff1a; 步骤 1&#xff1a; 请求需认证的资源时&#xff0c;服务器会随着状态码 401Authorization Required&#xff0c;返回带WWW-Authenticate 首部字段的响应。该字段内包含质问响应方式认证所需的临时质询码&#xff08;随机数&#xff0c;nonce&#xff09;…

Digest Auth 摘要认证

Digest Auth 摘要认证 1.非常规方式 转载&#xff1a;https://blog.csdn.net/qq_25391785/article/details/86595529 public static void postMethod(String url, String query) {try {CredentialsProvider credsProvider new BasicCredentialsProvider();credsProvider.setC…

digest鉴权

“摘要”式认证&#xff08; Digest authentication&#xff09;是一个简单的认证机制&#xff0c;最初是为HTTP协议开发的&#xff0c;因而也常叫做HTTP摘要&#xff0c;在RFC2671中描述。其身份验证机制很简单&#xff0c;它采用杂凑式&#xff08;hash&#xff09;加密方法&…

消息摘要(Digest),数字签名(Signature),数字证书(Certificate)是什么?

1. 消息摘要&#xff08;Digest&#xff09; 1. 什么是消息摘要&#xff1f; 对一份数据&#xff0c;进行一个单向的 Hash 函数&#xff0c;生成一个固定长度的 Hash 值&#xff0c;这个值就是这份数据的摘要&#xff0c;也称为指纹。 2. 摘要算法 常见的摘要算法有 MD5、SHA…