This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM62L:AM62L 安全启动、Keywriter-lite

Guru**** 2893150 points

Other Parts Discussed in Thread: AM62L

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1641521/am62l-am62l-secure-boot-keywriter-lite

器件型号: AM62L

旧案例:https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1619993/am62l-enable-secure-boot-in-am62l

您好、
回到最后一个线程、

我在编写 BIN 文件时遇到问题。 请查看以下日志。

NOTICE:  bl1_plat_arch_setup arch setup 
NOTICE:  Booting Trusted Firmware
NOTICE:  BL1: v2.12.0(release):11.02.08-dirty
NOTICE:  BL1: Built : 19:27:42, Dec  4 2025
NOTICE:  BL1: dram_class: 11
NOTICE:  lpddr4: post start - PI training status=0x27c0a000 
NOTICE:  bl1_platform_setup DDR init done
NOTICE:  k3_bl1_handoff ENTERING WFI - end of bl1
NOTICE:  BL31: v2.12.0(release):11.02.08-dirty
NOTICE:  BL31: Built : 19:27:42, Dec  4 2025
NOTICE:  SYSFW ABI: 4.0 (firmware rev 0x000b '11.2.5-v11.02.05a (Fancy Rat)')
get_device_type a0a
ERROR:   Agent 0 Protocol 0x10 Message 0x7: not supported

U-Boot SPL 2025.01-00766-g7493977a537f-dirty (Dec 03 2025 - 15:20:36 +0000)
SPL initial stack usage: 1984 bytes
Trying to boot from MMC1
ERROR:   Agent 0 Protocol 0x10 Message 0x7: not supported


U-Boot 2025.01-00766-g7493977a537f-dirty (Dec 03 2025 - 15:20:36 +0000)

SoC:   AM62LX SR1.1 HS-FS
Model: Texas Instruments AM62L3 Evaluation Module
DRAM:  1 GiB
ERROR:   Agent 0 Protocol 0x10 Message 0x7: not supported
Core:  85 devices, 32 uclasses, devicetree: separate
MMC:   mmc@fa10000: 0, mmc@fa00000: 1
Loading Environment from MMC... Reading from MMC(0)... OK
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
Net:   Could not get PHY for mdio@f00: addr 0
am65_cpsw_nuss_port ethernet@8000000port@1: phy_connect() failed
Could not get PHY for mdio@f00: addr 1
am65_cpsw_nuss_port ethernet@8000000port@2: phy_connect() failed
No ethernet found.

Hit any key to stop autoboot:  0 
=> 
=> mw 0x82000000 0 0x400
=> ext2load mmc 0:1 0x82000000 /root/keywrlite.bin
636 bytes read in 1 ms (621.1 KiB/s)
=> dcache flush
=> md 0x82000000
82000000: 00000001 00009045 02209012 00000100  ....E..... .....
82000010: 00000000 00000000 00000000 00004a7e  ............~J..
82000020: a5a5a55a 00000000 00000000 00000000  Z...............
82000030: 00001234 a5a5a55a b002601f b7b0d97c  4...Z....`..|...
82000040: a89c7dc4 7be5aad1 a184878e 2b6b632f  .}.....{..../ck+
82000050: 987d0d76 97188fa1 f2d0df60 b10c2b3e  v.}.....`...>+..
82000060: c7edc70e 3dacedc6 e0efdf9b ff3fdced  .......=......?.
82000070: 87ade97f 7d529551 00000000 00000000  ....Q.R}........
82000080: 00009ffc a5a5a55a b002601f b7b0d97c  ....Z....`..|...
82000090: a89c7dc4 7be5aad1 a184878e 2b6b632f  .}.....{..../ck+
820000a0: 987d0d76 97188fa1 f2d0df60 b10c2b3e  v.}.....`...>+..
820000b0: c7edc70e 3dacedc6 e0efdf9b ff3fdced  .......=......?.
820000c0: 87ade97f 7d529551 00000000 00000000  ....Q.R}........
820000d0: 00005678 a5a5a55a 00000001 00000000  xV..Z...........
820000e0: 00000000 000062c8 a5a5a55a 00000001  .....b..Z.......
820000f0: 00000000 00000000 00008bad a5a5a55a  ............Z...
=> gpio set gpio@600000_72
gpio: pin gpio@600000_72 (gpio 72) value is 1
   Warning: value of pin is still 0
=> fuse writebuff -y 0x82000000
Programming fuses using a structured buffer in memory starting at addr 0x82000000
NOTICE:  Writebuff version info: 0x1
ERROR:   Failed to get response (-19)
ERROR:   Transfer send failed (-19)
ERROR:   Keywriter Lite Failed: (-19)
SMC call failed: Error code -1
ERROR
=>

谢谢、

达尔米克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:

    您是如何创建 Keywriter blob 的? 您还能分享 TIFS 跟踪吗?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Prashant、


    我们已经从 security-utils 实用程序创建了 keywrite.bin、并附加了参考 keywrlite.c。

    // Uncomment and modify the following definitions as per the compiler used
    // typedef char uint8_t;
    // typedef unsigned short uint16_t;
    // typedef unsigned int uint32_t;
    // typedef unsigned long uint64_t;
    
    struct uboot_header {
        uint32_t version_info;
        uint32_t fuse_mode;
    } __attribute__((packed));
            
    struct keywriter_lite_header {
        uint16_t magic;
        uint16_t size;
        uint8_t abi_major;
        uint8_t abi_minor;
        uint16_t reserved0;
        uint32_t cmd_id;
        uint32_t reserved1[2];
    } __attribute__((packed));
            
    struct mpk_opts {
        uint32_t field_header;
        uint32_t action_flags;
        uint16_t options;
        uint16_t reserved_field;
        uint32_t reserved[2];
    } __attribute__((packed));
            
    struct mpkh {
        uint32_t field_header;
        uint32_t action_flags;
        uint8_t mpkh[64];
        uint32_t reserved[2];
    } __attribute__((packed));
            
    struct key_cnt {
        uint32_t field_header;
        uint32_t action_flags;
        uint32_t count;
        uint32_t reserved[2];
    } __attribute__((packed));
            
    struct key_rev {
        uint32_t field_header;
        uint32_t action_flags;
        uint32_t revision;
        uint32_t reserved[2];
    } __attribute__((packed));
            
    struct sbl_revision {
        uint32_t field_header;
        uint32_t action_flags;
        uint64_t swrev;
        uint32_t reserved[3];
    } __attribute__((packed));
            
    struct sysfw_revision {
        uint32_t field_header;
        uint32_t action_flags;
        uint64_t swrev;
        uint32_t reserved[3];
    } __attribute__((packed));
            
    struct brdcfg_revision {
        uint32_t field_header;
        uint32_t action_flags;
        uint64_t swrev;
        uint32_t reserved[4];
    } __attribute__((packed));
            
    struct msv {
        uint32_t field_header;
        uint32_t action_flags;
        uint32_t msv;
        uint32_t reserved[2];
    } __attribute__((packed));
            
    struct jtag_disable {
        uint32_t field_header;
        uint32_t action_flags;
        uint32_t jtag_disable;
        uint32_t reserved[2];
    } __attribute__((packed));
            
    struct boot_mode {
        uint32_t field_header;
        uint32_t action_flags;
        uint32_t fuse_id;
        uint32_t boot_mode;
        uint32_t reserved[2];
    } __attribute__((packed));
            
    struct ext_otp {
        uint32_t field_header;
        uint32_t action_flags;
        uint16_t ext_otp_size;
        uint16_t ext_otp_index;
        uint8_t ext_otp_rpwp[16];
        uint8_t ext_otp[128];
        uint32_t reserved[4];
    } __attribute__((packed));
            
    struct checksum {
        uint8_t hash[64];
    } __attribute__((packed));
            
    struct keywrlite_blob {
        struct uboot_header ubheader;
        struct keywriter_lite_header header;
        struct mpk_opts mpkopts;
        struct mpkh smpkh;
        struct mpkh bmpkh;
        struct key_cnt keycnt;
        struct key_rev keyrev;
        struct sbl_revision sblswrev;
        struct sysfw_revision sysfwswrev;
        struct brdcfg_revision brdcfgswrev;
        struct msv msv;
        struct jtag_disable jtagdisable;
        struct boot_mode bootmode;
        struct ext_otp extotp;
        struct checksum chksum;
    }__attribute__((packed));
    
    struct keywrlite_blob blob = {
        .ubheader =
            {
                .version_info = 0x1,
                .fuse_mode = 0x9045,
            }
            ,
        .header =
            {
                .magic = 0x9012,
                .size = 544,
                .abi_major = 0,
                .abi_minor = 1,
                .reserved0 = 0,
                .cmd_id = 0,
                .reserved1 = {0x0, 0x0},
            }
            ,
        .mpkopts =
            {
                .field_header = 0x4a7e,
                .action_flags = 0xa5a5a55a,
                .options = 0x0,
                .reserved_field = 0x0,
                .reserved = {0x0, 0x0},
            }
            ,
        .smpkh =
            {
                .field_header = 0x1234,
                .action_flags = 0xa5a5a55a,
                .mpkh = {0x1f, 0x60, 0x2, 0xb0, 0x7c, 0xd9, 0xb0, 0xb7, 0xc4, 0x7d, 0x9c, 0xa8, 0xd1, 0xaa, 0xe5, 0x7b, 0x8e, 0x87, 0x84, 0xa1, 0x2f, 0x63, 0x6b, 0x2b, 0x76, 0xd, 0x7d, 0x98, 0xa1, 0x8f, 0x18, 0x97, 0x60, 0xdf, 0xd0, 0xf2, 0x3e, 0x2b, 0xc, 0xb1, 0xe, 0xc7, 0xed, 0xc7, 0xc6, 0xed, 0xac, 0x3d, 0x9b, 0xdf, 0xef, 0xe0, 0xed, 0xdc, 0x3f, 0xff, 0x7f, 0xe9, 0xad, 0x87, 0x51, 0x95, 0x52, 0x7d},
                .reserved = {0x0, 0x0},
            }
            ,
        .bmpkh =
            {
                .field_header = 0x9ffc,
                .action_flags = 0xa5a5a55a,
                .mpkh = {0x1f, 0x60, 0x2, 0xb0, 0x7c, 0xd9, 0xb0, 0xb7, 0xc4, 0x7d, 0x9c, 0xa8, 0xd1, 0xaa, 0xe5, 0x7b, 0x8e, 0x87, 0x84, 0xa1, 0x2f, 0x63, 0x6b, 0x2b, 0x76, 0xd, 0x7d, 0x98, 0xa1, 0x8f, 0x18, 0x97, 0x60, 0xdf, 0xd0, 0xf2, 0x3e, 0x2b, 0xc, 0xb1, 0xe, 0xc7, 0xed, 0xc7, 0xc6, 0xed, 0xac, 0x3d, 0x9b, 0xdf, 0xef, 0xe0, 0xed, 0xdc, 0x3f, 0xff, 0x7f, 0xe9, 0xad, 0x87, 0x51, 0x95, 0x52, 0x7d},
                .reserved = {0x0, 0x0},
            }
            ,
        .keycnt =
            {
                .field_header = 0x5678,
                .action_flags = 0xa5a5a55a,
                .count = 1,
                .reserved = {0x0, 0x0},
            }
            ,
        .keyrev =
            {
                .field_header = 0x62c8,
                .action_flags = 0xa5a5a55a,
                .revision = 1,
                .reserved = {0x0, 0x0},
            }
            ,
        .sblswrev =
            {
                .field_header = 0x8bad,
                .action_flags = 0xa5a5a55a,
                .swrev = 1,
                .reserved = {0x0, 0x0, 0x0},
            }
            ,
        .sysfwswrev =
            {
                .field_header = 0x45a9,
                .action_flags = 0xa5a5a55a,
                .swrev = 1,
                .reserved = {0x0, 0x0, 0x0},
            }
            ,
        .brdcfgswrev =
            {
                .field_header = 0x98dc,
                .action_flags = 0xa5a5a55a,
                .swrev = 1,
                .reserved = {0x0, 0x0, 0x0, 0x0},
            }
            ,
        .msv =
            {
                .field_header = 0x1337,
                .action_flags = 0xa5a5a55a,
                .msv = 0x0,
                .reserved = {0x0, 0x0},
            }
            ,
        .jtagdisable =
            {
                .field_header = 0x7421,
                .action_flags = 0xa5a5a55a,
                .jtag_disable = 0xf,
                .reserved = {0x0, 0x0},
            }
            ,
        .bootmode =
            {
                .field_header = 0xa1b2,
                .action_flags = 0xa5a5a55a,
                .fuse_id = 1,
                .boot_mode = 0x0,
                .reserved = {0x0, 0x0},
            }
            ,
        .extotp =
            {
                .field_header = 0xd0e5,
                .action_flags = 0xa5a5a55a,
                .ext_otp_size = 1,
                .ext_otp_index = 0,
                .ext_otp_rpwp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
                .ext_otp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
                .reserved = {0x0, 0x0, 0x0, 0x0},
            }
            ,
        .chksum =
            {
                .hash = {0x33, 0x62, 0x83, 0xdb, 0xf1, 0xb, 0xfa, 0x91, 0x16, 0x29, 0xb9, 0x62, 0x49, 0xc9, 0x44, 0x44, 0xa7, 0xc, 0x94, 0x5a, 0x89, 0xee, 0x30, 0x3e, 0x24, 0x95, 0xe2, 0x29, 0xca, 0x27, 0x6c, 0xf6, 0x2d, 0xf3, 0xf5, 0x9e, 0x25, 0x89, 0xa5, 0xcb, 0x62, 0x65, 0xc4, 0xbf, 0xf9, 0xcb, 0x16, 0x43, 0x4f, 0x3c, 0x78, 0x49, 0x18, 0xe3, 0x8d, 0xa6, 0xd1, 0x87, 0x4a, 0xde, 0xa1, 0x75, 0x22, 0x8c},
            }
            ,
    
    };
     

    我已对 board/ti/am62lx/board-cfg.yaml 文件进行了以下修改、以启用 sysfw 布线。

    trace_dst_enables :0x01
    trace_src_enables:0x1F

    u-boot 日志中没有更改

    =>保险丝 writebuff -y 0x82000000
    使用存储器中从地址 0x82000000 开始的结构化缓冲器对保险丝进行编程
    注意: Writebuff 版本信息:0x1
    错误:  未能获得响应(–19)
    错误:  传输发送失败(–19)
    错误  :Keywriter Lite 失败:(–19)
    SMC 调用失败:错误代码–1
    两种方法
    =>  

    我们使用的是 11.02.08.02 SDK 版本、因为旧版本存在内核启动问题(请参阅旧主题)、如果需要更多信息、敬请告知。

    谢谢、

    达尔米克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:

    u-boot 日志
    无更改

    TIFS 布线位于此处描述的 UART 端口上、即 AM62L 的 WKUP_UART0

    https://software-dl.ti.com/tisci/esd/latest/4_trace/trace.html#trace-uart-allocation

    请从此 UART 捕获日志并共享这些日志。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    此外、在密钥编程之前、如何确认 VPP 仅为 1.8V?

    此外、我在 C 文件中看到、您对 SMPK/BMPKH 使用相同的哈希值、并将 KEYCNT 编程为 1。 请在编程前检查您的配置。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我们有 TP、可以探测电压、然后得到 1.8V 电压。

    如果未设置 BKPHS、则工具不会一次性创建容器。 那么、您能否提出我们可以得到的一个、


    1) 将现有的 KEYCNT 更改为 2。

    2) 更改为命令 id 为 multi-short、并且仅设置 SMPK、KEYCNT 和 KEYREV。

    谢谢、
    达尔米克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    此外、我还看到、在 C 文件中、您对 SMPK/BMPKH 使用了相同的哈希值、并且仅将 KEYCNT 编程为 1。 请在编程前检查您的配置。

    此证书不存在问题。 您可能希望检查配置、只是为了您的信息。 理想情况下、应该同时对 SMPKH/BMPKH 进行编程并将 KEYCNT 设置为 2。

    给定两个不同的密钥 (SMPK 和 BMPK)、您可以像生成 SMPKH 一样生成 BMPKH。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [quote userid=“573102“ url=“~/support/processors-group/processors/f/processors-forum/1641521/am62l-am62l-secure-boot-keywriter-lite/6331720 通过 security-utils 实用程序创建了 keywrite.bin

    您能否使用“多触发“模式仅对 SMPKH/BMPKH、KEYCNT 和 KEYREV 进行编程并禁用任何其他字段?

    keywrlite:编程 JTAG 禁用
    [U32] JTAG 禁用:0xF
    错误:未指定覆盖
    DEBUG_RESPONSE:0x44000000
    错误:JTAG 禁用失败

    从这些日志中可以看出、之前使用的“一次性“证书对 JTAG 禁用字段进行了编程、这意味着在将器件转换为 HSSE 后、您将无法将调试器连接到任何内核。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我感谢分析、并将使用多次触发进行确认。

    但是、由于我未能在新电路板上执行安全启动且该电路板处于 FS 状态、因此是否会出现另一个问题或者单稳态无法正常工作?

    谢谢、

    达尔米克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    当 SMPKH、BMPKH、KEYCNT 和 KEYREV 设置为多次触发状态时、我们在刷写时收到错误。

    查找日志、

    0x4003007
             0x4400B25
                      0x20800000
                                0x20800001
                                          0x4003007
                                                   0x4400B25
                                                            keywrlite: type keywriter lite
                                                                                          keywrlite: check cmd id
                                                                                                                 Op Success
                                                                                                                           keywrlite: checksum passed


    谢谢、

    达尔米克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    当 SMPKH、BMPKH、KEYCNT 和 KEYREV 设置为多次触发时、我们在刷写时收到错误。

    我在日志中看不到任何错误。 您是否捕获了完整日志?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的、这就是终端的全部功能。

    如果可以通过任何方法启用更多调试日志、请提供我要执行的步骤建议。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    已注意。

    => fuse writebuff -y 0x82000000
    使用存储器中从地址 0x82000000 开始的结构化缓冲器对保险丝进行编程
    注意: Writebuff 版本信息:0x1
    错误:  未能获得响应(–19)
    错误:  传输发送失败(–19)
    错误  :Keywriter Lite 失败:(–19)
    SMC 调用失败:错误代码–1
    错误[/报价]

    您是否仍收到此多镜头证书的此错误?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我有几个问题、您能解决一下吗?

    1.根据该工具,我们可以在启用写保护之前对该字段进行许多更改。 这是正确的解释吗? 如果是、我们在尝试第二次更新该文件时看到错误。

    2.该工具的写保护、读保护和覆盖功能如何工作?

    3、由于我们已经将 KEYREV 设置为 1、因此当我们需要选择 BMPKH 时、必须将其更改为 2、前提是不会有问题。 但现在我们无法再次设置 1。

    谢谢、

    达尔米克  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [quote userid=“573102“ url=“~/support/processors-group/processors/f/processors-forum/1641521/am62l-am62l-secure-boot-keywriter-lite/6332809 根据该工具、我们可以在启用写保护之前对字段进行许多更改。 这是正确的解释吗? 如果是、我们在第二次尝试更新该文件时看到错误。

    不确定。 该字段可被覆盖、但只有在对最新值进行编程时不会导致位从 1 翻转至 0 时才会覆盖、因为电子保险丝位只能从 0 翻转一次至 1。

    [quote userid=“573102“ url=“~/support/processors-group/processors/f/processors-forum/1641521/am62l-am62l-secure-boot-keywriter-lite/6332809 该工具的写保护、读保护和覆盖功能如何工作?

    WP/RP(如果启用)会设置特定字段的标志、从而防止该字段分别进行写入或读取。

    [quote userid=“573102“ url=“~/support/processors-group/processors/f/processors-forum/1641521/am62l-am62l-secure-boot-keywriter-lite/6332809 由于我们已将 KEYREV 设置为 1、因此当我们需要选择 BMPKH 时、必须将其更改为 2、

    KEYREV 更改为 2 是不可逆转的。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    此处提供更多说明:

    software-dl.ti.com/.../key_writer_lite.html

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    接下来、我们将尝试保护文件系统的安全、因为我们在下面的链接中  

    https://software-dl.ti.com/processor-sdk-linux/esd/AM62LX/11_02_08_02/exports/docs/linux/Foundational_Components / System_Security / Auth_boot.html

    目前、我们有 P1 (rootfs)、 P2 (rootfs ) 和 P3 (datafs) eMMC 分区方案、并且电路板上仅提供 USB DFU 和 eMMC 引导模式。

    请找到下面的日志,使用,我们已经创建了.hash 文件,并将其放在 P3 分区,因为我们没有额外的分区。

    root@am62lxx-evm:~# mkdir /old_mnt
    root@am62lxx-evm:~# mount /dev/mmcblk0p1 /old_mnt                                                                                                                                                                  
    [   55.388613] EXT4-fs (mmcblk0p1): mounted filesystem f7067c97-aee1-4ea1-b5fd-7b68ecc8a599 r/w with ordered data mode. Quota mode: none.
    root@am62lxx-evm:~# cryptsetup luksFormat /dev/mmcblk0p2 --key-file=/home/pass_key --batch-mode                                                                                                                    
    root@am62lxx-evm:~# cryptsetup luksOpen /dev/mmcblk0p2 crypt_root --key-file=/home/pass_key                                                                                                                        
    root@am62lxx-evm:~# cryptsetup -v status crypt_root
    /dev/mapper/crypt_root is active.
      type:    LUKS1
      cipher:  aes-xts-plain64
      keysize: 512 bits
      key location: dm-crypt
      device:  /dev/mmcblk0p2
      sector size:  512
      offset:  4096 sectors
      size:    4190208 sectors
      mode:    read/write
    Command successful.
    root@am62lxx-evm:~# cryptsetup luksDump /dev/mmcblk0p2                                                                                                                                                             
    LUKS header information for /dev/mmcblk0p2
    
    Version:        1
    Cipher name:    aes
    Cipher mode:    xts-plain64
    Hash spec:      sha256
    Payload offset: 4096
    MK bits:        512
    MK digest:      17 db 68 29 a4 2c 4c 2d d9 aa 24 70 47 12 d3 d2 79 d2 ec 61 
    MK salt:        0c eb ac 18 aa 6c 28 4b e4 c5 8f d1 fa 5b 21 3f 
                    51 1e cd a4 67 ca 02 6b 90 17 32 01 4c 28 0c 3d 
    MK iterations:  22692
    UUID:           111847ab-cfc5-4a69-a90a-0fead7bd0535
    
    Key Slot 0: ENABLED
            Iterations:             363080
            Salt:                   0e 64 e4 d8 28 ae e0 ea 97 b9 b5 f6 46 45 4a c1 
                                    92 b4 82 d9 26 09 d0 86 71 51 e1 69 d0 55 19 5c 
            Key material offset:    8
            AF stripes:             4000
    Key Slot 1: DISABLED
    Key Slot 2: DISABLED
    Key Slot 3: DISABLED
    Key Slot 4: DISABLED
    Key Slot 5: DISABLED
    Key Slot 6: DISABLED
    Key Slot 7: DISABLED
    root@am62lxx-evm:~# mkfs.ext4 /dev/mapper/crypt_root
    mke2fs 1.47.0 (5-Feb-2023)
    Creating filesystem with 523776 4k blocks and 131072 inodes
    Filesystem UUID: 972ef60e-7583-4c14-8da6-0debfe244cfd
    Superblock backups stored on blocks: 
            32768, 98304, 163840, 229376, 294912
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done 
    
    root@am62lxx-evm:~# mkfs.ext4 /dev/mapper/crypt_root
    mke2fs 1.47.0 (5-Feb-2023)
    /dev/mapper/crypt_root contains a ext4 file system
            created on Thu May 29 18:50:02 2025
    Proceed anyway? (y,N) y
    Creating filesystem with 523776 4k blocks and 131072 inodes
    Filesystem UUID: 2abe3070-b79f-4c82-b90c-7d4be9bbe5f7
    Superblock backups stored on blocks: 
            32768, 98304, 163840, 229376, 294912
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done 
    
    root@am62lxx-evm:~# mount /dev/mapper/crypt_root /mnt
    [  123.516522] EXT4-fs (dm-0): mounted filesystem 2abe3070-b79f-4c82-b90c-7d4be9bbe5f7 r/w with ordered data mode. Quota mode: none.
    root@am62lxx-evm:~# cp -ar /old_mnt/. /mnt
    root@am62lxx-evm:~# sync
    root@am62lxx-evm:~# umount /mnt
    [  200.706389] EXT4-fs (dm-0): unmounting filesystem 2abe3070-b79f-4c82-b90c-7d4be9bbe5f7.
    root@am62lxx-evm:~# veritysetup format /dev/mapper/crypt_root ver.hash      
    VERITY header information for ver.hash
    UUID:                   c57eee25-6ae2-4060-ae64-5f5e62c7b28d
    Hash type:              1
    Data blocks:            523776
    Data block size:        4096
    Hash blocks:            4125
    Hash block size:        4096
    Hash algorithm:         sha256
    Salt:                   cd9db64878c65fa8ae09b0b59095f903ab781482fe7d9f9d63cbca3a7cac6888
    Root hash:              85a11d07a423552a34ddb3196f11110f8967c74d46dc07da35553e97af9c32f5
    Hash device size:       16900096 [bytes]
    root@am62lxx-evm:~# 

    我们还为引导修改 initramfs 的 init 文件、

    # Fix ownership
    chown root:root /bin/mount.util-linux
    
    # Mount virtual filesystems
    mount -t devtmpfs none /dev
    mount -t proc none /proc
    mount -t sysfs none /sys
    
    # Mount partition containing verity.hash
    mkdir -p /verity
    mount /dev/mmcblk0p3 /verity
    
    # Open encrypted rootfs
    cryptsetup luksOpen \
        --key-file=/home/pass_key \
        /dev/mmcblk0p2 \
        crypt_root
    
    # Open dm-verity mapping
    veritysetup open \
        /dev/mapper/crypt_root \
        verity_root \
        --root-hash-file /verity/ver.hash \
        85a11d07a423552a34ddb3196f11110f8967c74d46dc07da35553e97af9c32f5
    
    # Mount verified rootfs
    mount -o ro /dev/mapper/verity_root /mnt
    
    # Optional cleanup
    umount /verity
    
    # Switch to verified rootfs
    exec switch_root /mnt /sbin/init


    从它引导时、内核会出现紧急情况、您可以在以下日志中看到
    [    1.791770] am65-cpsw-nuss 8000000.ethernet: initializing am65 cpsw nuss version 0x6BA00103, cpsw version 0x6BA80103 Ports: 3 quirks:00000006
    [    1.804668] am65-cpsw-nuss 8000000.ethernet: /bus@f0000/ethernet@8000000/ethernet-ports/port@1 read phy-mode err -22
    [    1.815403] am65-cpsw-nuss 8000000.ethernet: probe with driver am65-cpsw-nuss failed with error -22
    [    1.831633] mmc0: CQHCI version 5.10
    [    1.831692] input: gpio-keys as /devices/platform/gpio-keys/input/input0
    [    1.838232] mmc2: CQHCI version 5.10
    [    1.842866] clk: Disabling unused clocks
    [    1.856074] PM: genpd: Disabling unused power domains
    [    1.861625] ALSA device list:
    [    1.864647]   No soundcards found.
    [    1.868142] Warning: unable to open an initial console.
    [    1.889455] mmc0: SDHCI controller on fa10000.mmc [fa10000.mmc] using ADMA 64-bit
    [    1.904031] mmc2: SDHCI controller on fa20000.mmc [fa20000.mmc] using ADMA 64-bit
    [    1.916888] sdhci-am654 fa20000.mmc: card claims to support voltages below defined range
    [    1.932581] Freeing unused kernel memory: 28672K
    [    1.937453] Run /init as init process
    [    1.946523] mmc2: new high speed SDIO card at address 0001
    [    1.949956] mmc0: new HS200 MMC card at address 0001
    [    1.958805] mmcblk0: mmc0:0001 IS008G 7.30 GiB
    [    1.967358]  mmcblk0: p1 p2 p3
    [    1.971425] mmcblk0boot0: mmc0:0001 IS008G 4.00 MiB
    [    1.977938] mmcblk0boot1: mmc0:0001 IS008G 4.00 MiB
    [    1.984332] mmcblk0rpmb: mmc0:0001 IS008G 4.00 MiB, chardev (239:0)
    [    7.126453] EXT4-fs (mmcblk0p3): mounted filesystem cba1d45b-891e-48c6-b739-af652390f887 r/w with ordered data mode. Quota mode: none.
    [    9.300359] EXT4-fs (mmcblk0p3): unmounting filesystem cba1d45b-891e-48c6-b739-af652390f887.
    [    9.319321] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
    [    9.326995] CPU: 0 UID: 0 PID: 1 Comm: switch_root Not tainted 6.12.57-havnam #1
    [    9.334383] Hardware name: Texas Instruments AM62L3 Evaluation Module (DT)
    [    9.341242] Call trace:
    [    9.343678]  dump_backtrace+0x90/0xe8
    [    9.347348]  show_stack+0x18/0x24
    [    9.350657]  dump_stack_lvl+0x34/0x8c
    [    9.354314]  dump_stack+0x18/0x24
    [    9.357621]  panic+0x390/0x3a4
    [    9.360672]  do_exit+0x824/0x8f8
    [    9.363894]  do_group_exit+0x34/0x90
    [    9.367462]  pid_child_should_wake+0x0/0x60
    [    9.371636]  invoke_syscall+0x48/0x10c
    [    9.375379]  el0_svc_common.constprop.0+0x40/0xe0
    [    9.380074]  do_el0_svc+0x1c/0x28
    [    9.383382]  el0_svc+0x28/0x98
    [    9.386431]  el0t_64_sync_handler+0x120/0x12c
    [    9.390780]  el0t_64_sync+0x190/0x194
    [    9.394436] SMP: stopping secondary CPUs
    [    9.398355] Kernel Offset: disabled
    [    9.401832] CPU features: 0x00,00000080,00200000,4200420b
    [    9.407219] Memory Limit: none
    [    9.410267] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100 ]---
    

    是否需要更新任何步骤?

    谢谢、

    达尔米克

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    请为最新查询创建一个单独的线程、该线程与本线程中讨论的原始查询不同、以便主题专家解决该问题。

    请告诉我、本主题中讨论的问题已解决、以便我可以关闭主题。

    谢谢!