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

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점, 고작 부활동
"만약 그 순간이 온다면 그때가 네가 배구에 빠지는 순간이야"

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.