warning: the following paths have collided (e.g. case-sensitive paths on a case-insensitive filesystem) and only one from the same colliding group is in the working tree:
This
warning occurs on a case-insensitive filesystem (like macOS's APFS or
Windows' NTFS) when a Git repository contains files whose names differ
only in case. Git detects these as potential conflicts because the
filesystem treats them as identical.
1 2 3
git clone --depth=1 https://github.com/raspberrypi/linux.git cd linux apt install bc
1 2 3 4
mkdir build make O=build bcm2711_defconfig bear -- make O=build -j10 Image.gz modules dtbs make O=build modules_install INSTALL_MOD_PATH=.
# 在config.txt中启用新内核 if grep -q "kernel=Image.gz" /boot/firmware/config.txt; then echo"新内核已配置" else # 注释原内核,启用新内核 sudo sed -i 's/^kernel=/#kernel=/' /boot/firmware/config.txt echo"kernel=Image.gz" | sudo tee -a /boot/firmware/config.txt fi
% ssh pi@pi yuanqi@MacBook-Pro-2 Linux pi 6.12.57-v8+ #1 SMP PREEMPT Fri Nov 14 20:56:44 CST 2025 aarch64
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sun Dec 7 14:02:19 2025 from 192.168.1.100 pi@pi:~ $ uname -r 6.12.57-v8+
# 3. 设置已验证的函数名(根据 available_filter_functions) echo"__arm64_sys_mmap" | sudo tee -a set_graph_function > /dev/null echo"ksys_mmap_pgoff" | sudo tee -a set_graph_function > /dev/null echo"vm_mmap_pgoff" | sudo tee -a set_graph_function > /dev/null echo"do_mmap" | sudo tee -a set_graph_function > /dev/null echo"mmap_region" | sudo tee -a set_graph_function > /dev/null echo"__mmap_region" | sudo tee -a set_graph_function > /dev/null echo"rpi_gpiomem_mmap" | sudo tee -a set_graph_function > /dev/null echo"rpi_gpiomem_open" | sudo tee -a set_graph_function > /dev/null
# 4. 添加 VMA 相关函数 echo"vm_area_alloc" | sudo tee -a set_graph_function > /dev/null echo"vma_merge_new_range" | sudo tee -a set_graph_function > /dev/null echo"vma_link_file" | sudo tee -a set_graph_function > /dev/null echo"vma_set_page_prot" | sudo tee -a set_graph_function > /dev/null
# 5. 添加内存映射核心函数 echo"remap_pfn_range" | sudo tee -a set_graph_function > /dev/null echo"remap_pfn_range_internal" | sudo tee -a set_graph_function > /dev/null echo"__pte_offset_map_lock" | sudo tee -a set_graph_function > /dev/null
# 6. 配置跟踪选项 echo 1 | sudo tee options/func_stack_trace > /dev/null echo 1 | sudo tee options/sleep-time > /dev/null echo 1 | sudo tee options/graph-time > /dev/null
# 系统调用入口 echo"__arm64_sys_mmap" | sudo tee -a set_graph_function > /dev/null echo"ksys_mmap_pgoff" | sudo tee -a set_graph_function > /dev/null
# 内存管理核心函数 echo"vm_mmap_pgoff" | sudo tee -a set_graph_function > /dev/null echo"do_mmap" | sudo tee -a set_graph_function > /dev/null echo"mmap_region" | sudo tee -a set_graph_function > /dev/null echo"__mmap_region" | sudo tee -a set_graph_function > /dev/null
# VMA 操作函数 echo"vm_area_alloc" | sudo tee -a set_graph_function > /dev/null echo"vma_merge_new_range" | sudo tee -a set_graph_function > /dev/null echo"vma_link_file" | sudo tee -a set_graph_function > /dev/null echo"vma_set_page_prot" | sudo tee -a set_graph_function > /dev/null
# 文件操作相关 echo"fget" | sudo tee -a set_graph_function > /dev/null echo"fput" | sudo tee -a set_graph_function > /dev/null
# 驱动特定函数 echo"rpi_gpiomem_mmap" | sudo tee -a set_graph_function > /dev/null echo"rpi_gpiomem_open" | sudo tee -a set_graph_function > /dev/null
# 页表操作函数 echo"remap_pfn_range" | sudo tee -a set_graph_function > /dev/null echo"remap_pfn_range_internal" | sudo tee -a set_graph_function > /dev/null echo"__pte_offset_map_lock" | sudo tee -a set_graph_function > /dev/null
# 安全相关函数 echo"security_mmap_file" | sudo tee -a set_graph_function > /dev/null echo"security_mmap_addr" | sudo tee -a set_graph_function > /dev/null echo"cap_mmap_file" | sudo tee -a set_graph_function > /dev/null echo"cap_mmap_addr" | sudo tee -a set_graph_function > /dev/null
# 设置跟踪选项 echo 1 | sudo tee options/func_stack_trace > /dev/null echo 1 | sudo tee options/graph-time > /dev/null
wget https://busybox.net/downloads/busybox-1.36.1.tar.bz2 tar xf busybox-1.36.1.tar.bz2 cd busybox-1.36.1 make defconfig make menuconfig # 可选:静态编译 Settings → Build static binary (no shared libs) make -j$(nproc) make install
1 2 3 4 5 6 7 8 9
# 1. 先拿一份默认配置 make defconfig
# 2. 用 sed 三行命令完成上述三项修改 sed -i 's/^# CONFIG_STATIC is not set/CONFIG_STATIC=y/' .config sed -i 's|CONFIG_PREFIX=.*|CONFIG_PREFIX="./rootfs"|' .config
# 3. 让 Kbuild 自动补齐依赖(重要!) make oldconfig >/dev/null </dev/null
这里回到mac宿主机。
创建必要的目录结构
1 2
cd rootfs mkdir -p {etc,dev,proc,sys,tmp,var,usr/bin,usr/sbin,lib,root}
创建基础设备节点
1 2 3 4 5 6 7 8
cd rootfs/dev
# 创建设备文件 sudo mknod console c 5 1 sudo mknod null c 1 3 sudo mknod zero c 1 5 sudo mknod ttyAMA0 c 204 64 sudo chmod 666 console null zero ttyAMA0