추가적으로 만든 소스코드가(빌드후) 커널 이미지 설치가 안되는 것 같습니다.

I LY@Google의 이미지

일단 아직 리눅스를 빙산의 일각 만큼만 아는 초심자라 답답해도 이점은 양해를 부탁합니다.

먼저 소스코드부터 보여드리면

rpi_kernel_src/linux(커널소스 디렉토리)/drivers/soc/bcm/rpi_debugfs.c

/* (C) 2019 Austin Kim <austindh.kim@gmail>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Author:
 * Austin Kim <austindh.kim@gmail>
 */ 
 
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/init.h>
#include <linux/memblock.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/cpu.h>
#include <linux/delay.h>
#include <asm/setup.h>
#include <linux/input.h>
#include <linux/debugfs.h>
 
uint32_t raspbian_debug_state = 0x1000;
static struct dentry *raspbian_kernel_debug_debugfs_iface_root;
 
static int raspbian_kernel_debug_iface_debugfs_get(void *data, u64 *val)
{
    printk("===[%s][L:%d][val:%d]===\n", __func__, __LINE__, raspbian_debug_state);
    *val = raspbian_debug_state;
 
    printk("[KERNEL]===[%s][L:%d]==\n", __func__, __LINE__);
 
    return 0;
}
 
static int raspbian_kernel_debug_iface_debugfs_set(void *data, u64 val)
{
	raspbian_debug_state = (uint32_t)val;
 
	printk("[raspbian] [%s][L:%d], raspbian_debug_state[%lu],value[%lu]===\n", 
								__func__, __LINE__, (long unsigned int)raspbian_debug_state, (long unsigned int)val);
    	return 0;
}
 
 
DEFINE_SIMPLE_ATTRIBUTE(raspbian_kernel_debug_iface_debugfs_fops, raspbian_kernel_debug_iface_debugfs_get, raspbian_kernel_debug_iface_debugfs_set, "%llu\n");
 
static struct platform_driver kernel_bsp_debug_driver = {
    .driver     = {
        .owner  = THIS_MODULE,
        .name   = "raspbian_debug_iface",
    },
};
 
static int __init raspbian_kernel_debug_init(void)
{
    printk("===[%s][L:%d]===\n", __func__, __LINE__);
 
    raspbian_kernel_debug_debugfs_iface_root = debugfs_create_dir("raspbian_debug_iface", NULL);
    debugfs_create_file("val", S_IRUGO, raspbian_kernel_debug_debugfs_iface_root, NULL, &raspbian_kernel_debug_iface_debugfs_fops);
 
    return platform_driver_register(&kernel_bsp_debug_driver);
}
 
late_initcall(raspbian_kernel_debug_init);
 
MODULE_DESCRIPTION("raspberrypi debug interface driver");
MODULE_AUTHOR("Austin Kim <austindh.kim@gmail.com>");
MODULE_LICENSE("GPL");

저작권은 디버깅을 통해 배우는 리눅스커널의 구조와 원리 1권 중 121페이지에 있습니다.

다음으로 커널 빌드를 하고나면

rpi_kernel_src/out(컴파일된 디렉토리)/drivers/soc/bcm/rpi_debugfs.o
파일이 생기는것 까지는 확인 했습니다.

다음으로
rpi_kernel_src/linux/drivers/soc/bcm/Makefile를 패치해주고

# SPDX-Lincense-Identifier: GPL-2.0-only
obj-$(CONFIG_BCM2835POWER) +=bcm2835-power.o
obj-$(CONFIG_RASPBERRYPI_POWER) +=raspberrypi-power.o
obj-$(CONFIG_RASPBERRYPI_POWER) +=rpi_debugfs.o (추가)
obj-$(CONFIG_SOC_BCM63XX) +=bcm63XX/
obj-$(CONFIG_SOC_BRCMSTB) +=brcmstb/

커널 이미지를 설치 하고 리부팅을 했습니다.

만약 정상적으로 됬다면
/sys/kernel/debug/raspbian_debug_iface/ 디렉토리가 생기고

./val 파일이 생겨야 되지만

현재 아무것도 생기지는 않았습니다.
오류도 안 나오고 컴파일이나 이미지 설치는 잘되는데 결과가 안 좋습니다.

이 글을 작성하면서 생각해본 건데 아마 Makefile에서 주석 문구가 힌트가 아닐까 추측중입니다.

Fe.head의 이미지

obj-y +=rpi_debugfs.o
이렇게 하는것이 맞을겁니다.

책 복습하다가 소스 헤더파일이 필요해서 검색하다고 이글을 봤습니다.
감사합니다.

고작 블로킹 하나, 고작 25점 중에 1점, 고작 부활동
"만약 그 순간이 온다면 그때가 네가 배구에 빠지는 순간이야"