LinuxはU-Boot再配置されたFDT(highmemから)にアクセスできません。

LinuxはU-Boot再配置されたFDT(highmemから)にアクセスできません。

私たちはARMベースの組み込みシステムでU-Bootのカスタムバージョンを実行しており、デバイスツリーBlobでLinux 4.3をロードしようとしています。システムには1 GBのRAMがあり、そのうちの上位128 MBは永続ストレージ用に予約されています。私はtftpを使ってカーネルとDTBをいくつかのメモリ位置(カーネル:0x02000000、DTB:0x02400000)にコピーしました。だから電話しましたbootm 0x2000000 - 0x2400000

DTB は、使用可能な U-Boot メモリの最後にある 0x37b60000 (仮想: 0xf7b60000) に再配置されます。 Linuxがアドレスにアクセスできないため、起動できません。これはhighmem / lowmemに問題があるようです。わかりません。 lowmemは760MB(仮想0xef800000)で終わります。 highmemは必要に応じて動的にマッピングする必要はありませんか? (CONFIG_HIGHMEMが設定されました。)

この問題を解決するためのクリーンで正しい方法は何ですか? U-Bootが低い場所を使用するようにするか(どのように?)、高メモリにアクセスできるようにLinux構成を変更しますか?

注:Linuxは再配置が抑制されているため、fdt_high = 0xffffffff(およびinitrd_high = 0xffffffff)を使用して正常に起動できます。

デバッグ情報を含むU-Boot:

DRAM:  Monitor len: 00044358
Ram size: 40000000
Ram top: 40000000
Reserving 131072k for protected RAM at 38000000
TLB table from 37ff0000 to 37ff4000
Reserving 272k for U-Boot at: 37fab000
Reserving 4352k for malloc() at: 37b6b000
Reserving 80 Bytes for Board Info at: 37b6afb0
Reserving 160 Bytes for Global Data at: 37b6af10

RAM Configuration:
Bank #0: 00000000 1 GiB

DRAM:  1 GiB
New Stack Pointer is: 37b6aef0
Relocation Offset is: 33fab000
Relocating to 37fab000, new gd at 37b6af10, sp at 37b6aef0

[…]

*  fdt: cmdline image address = 0x02400000
## Checking for 'FDT'/'FDT Image' at 02400000
*  fdt: raw FDT blob
## Flattened Device Tree blob at 02400000
   Booting using the fdt blob at 0x2400000
   of_flat_tree at 0x02400000 size 0x0000493c
   Loading Multi-File Image ... OK
## device tree at 02400000 ... 0240493b (len=31036 [0x793C])
   Loading Device Tree to 37b60000, end 37b6793b ... OK

ベストアンサー1

したがって、この問題を解決する1つの方法は、いくつかの追加の環境変数を使用することです。 include/configs/ti_armv7_common.hを見ると、次のようなものがあります。

/*
 * We setup defaults based on constraints from the Linux kernel, which should
 * also be safe elsewhere.  We have the default load at 32MB into DDR (for
 * the kernel), FDT above 128MB (the maximum location for the end of the
 * kernel), and the ramdisk 512KB above that (allowing for hopefully never
 * seen large trees).  We say all of this must be within the first 256MB
 * as that will normally be within the kernel lowmem and thus visible via
 * bootm_size and we only run on platforms with 256MB or more of memory.
 */
#define DEFAULT_LINUX_BOOT_ENV \
        "loadaddr=0x82000000\0" \
        "kernel_addr_r=0x82000000\0" \
        "fdtaddr=0x88000000\0" \
        "fdt_addr_r=0x88000000\0" \
        "rdaddr=0x88080000\0" \
        "ramdisk_addr_r=0x88080000\0" \
        "scriptaddr=0x80000000\0" \
        "pxefile_addr_r=0x80100000\0" \
        "bootm_size=0x10000000\0"

したがって、説明されている問題の場合は、bootm_size = 0x10000000を再使用してカーネルの表示lowmemになる最初の256 MB内にデバイスツリーを維持する必要があります(少なくとも現在のデフォルトのカーネル設定ではカーネルlowmemのサイズが構成されています)。 )。

同様に有用な別の解決策は、単にデバイスツリーとRAMディスクをメモリに入れることです。知るそれらは安全で、fdt_high=0xffffffff と initrd_high=0xffffffff を使用して再配置を無効にします。再配置の主な用途は、一般的な状況ですべてが安全であることを確認することです(U-Bootが任意のカーネル、デバイスツリー、およびRAMディスクを提供でき、すべてがどれだけ大きいかわからない場合)。このような生産状況では、常に安全で正しい値を特定して、再度移動することなくここにロードできます。

おすすめ記事