You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过U-boot传递Linux内核lsm参数?

在Arch Linux ARM中通过U-Boot配置LSM内核参数失败的排查与解决

问题详情

我在Arch Linux ARM系统中尝试设置LSM内核参数:

lsm=landlock,lockdown,yama,integrity,apparmor,bpf

该系统的启动参数需在/boot/boot.txt中配置,文件原始内容如下:

# After modifying, run ./mkscr

# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:2 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /Image; then
  if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then
    if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then
      booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
    else
      booti ${kernel_addr_r} - ${fdt_addr_r};
    fi;
  fi;
fi

根据U-Boot文档,bootargs是传递给操作系统的命令行参数,我尝试修改bootargs行如下:

...
setenv bootargs lsm=landlock,lockdown,yama,integrity,apparmor,bpf console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"
...

运行./mkscr并重启后,执行cat /sys/kernel/security/lsm仍输出:

capability,landlock,yama

我还尝试了兼容格式security=lsm=以及kernel.lsm,结果完全一致。由于Arch及ArchLinuxARM Wiki对该引导加载器的说明有限,且我是U-Boot配置新手,不清楚问题所在。请问如何通过该加载器设置lsm内核参数?我忽略了什么关键点?


内容的提问来源于stack exchange,提问作者zar3bski

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.11 23:12:40