Jak dodać niestandardową zmienną ATAG w jądrze U-Boot i Linux?
Chcę dodać dostosowaną zmienną atag
w jądrze U-Boot i Linux.
Jak mogę to osiągnąć?
Czy istnieje jakakolwiek procedura dodawania zmiennej ATAG
w U-Boot
i Linux
?
3 answers
Postępuj zgodnie z tą procedurą,
Aby osiągnąć ten cel, należy zmodyfikować 2 części. Jednym z nich jest U-Boot, a drugim jądro Linuksa.
1. U-Boot changes required :
A. Make sure the CONFIG_CMDLINE_TAG/CONFIG_SETUP_MEMORY_TAGS/CONFIG_INITRD_TAG are defined in you project definition header file ( u-boot/include/configs/am335x_evm.h ), and we can add our own tag here, eg. CONFIG_CUSTOM_TAG.
B. Add the structure definition you wanna append w/ ATAG in u-boot/include/asm-arm/setup.h, eg.
#define ATAG_CUSTOM 0x5441000a
struct tag_custom{
unsigned char mac_addr[6];
};
C. Add the struct at the tail of "u"...
struct tag {
struct tag_header hdr;
union {
struct tag_core core;
struct tag_mem32 mem;
struct tag_videotext videotext;
struct tag_ramdisk ramdisk;
struct tag_initrd initrd;
struct tag_serialnr serialnr;
struct tag_revision revision;
struct tag_videolfb videolfb;
struct tag_cmdline cmdline;
/*
* Acorn specific
*/
struct tag_acorn acorn;
/*
* DC21285 specific
*/
struct tag_memclk memclk;
/****** INFOTECH Custom TAG ********/
struct tag_custom custom;
} u;
};
D. Add implementation code in lib_arm/bootm.c:
static void setup_custom_tag(bd_t *bd);
static void setup_custom_tag(bd_t *bd) {
params->hdr.tag = ATAG_CUSTOM;
params->hdr.size = tag_size (tag_macaddr);
params->u.custom.cmd =0;
params = tag_next (params);
}
E. Add "#ifdef CONFIG_CUSTOM_TAG / #endif" at every place you change the code.
F. Done of U-Boot modification.
2. Linux Changes required:
A. Add parse tag code in linux/arch/arm/kernel/setup.c:
int cmd;
static int __init parse_tag_custom(const struct tag *tag){
printk("u.custom.cmd=%d\n",tag->u.custom.cmd);
return 0;
}
__tagtable(ATAG_MACADDR, parse_tag_custom);
B. Add the structure declaration as U-Boot did in linux/include/asm-arm/setup.h:
#define ATAG_MACADDR 0x5441000a
struct tag_custom {
int cmd;
};
C. Add the struct at the tail of "u"...
struct tag {
struct tag_header hdr;
union {
struct tag_core core;
struct tag_mem32 mem;
struct tag_videotext videotext;
struct tag_ramdisk ramdisk;
struct tag_initrd initrd;
struct tag_serialnr serialnr;
struct tag_revision revision;
struct tag_videolfb videolfb;
struct tag_cmdline cmdline;
/*
* Acorn specific
*/
struct tag_acorn acorn;
/*
* DC21285 specific
*/
struct tag_memclk memclk;
/* Add Infotech custom tag */
struct tag_custom custom;
} u;
};
D. Done w/ Kernel parts.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-07-16 07:27:43
-
Wymagane zmiany U-Boota:
A. Make sure the CONFIG_CMDLINE_TAG/CONFIG_SETUP_MEMORY_TAGS/CONFIG_INITRD_TAG are defined in you project definition header file ( u-boot/include/configs/am335x_evm.h ), and we can add our own tag here, eg. CONFIG_CUSTOM_TAG. B. Add the structure definition you wanna append w/ ATAG in u-boot/include/asm-arm/setup.h, eg. #define ATAG_CUSTOM 0x5441000a struct tag_custom{ unsigned char mac_addr[6]; }; C. Add the struct at the tail of "u"... struct tag { struct tag_header hdr; union { struct tag_core core; struct tag_mem32 mem; struct tag_videotext videotext; struct tag_ramdisk ramdisk; struct tag_initrd initrd; struct tag_serialnr serialnr; struct tag_revision revision; struct tag_videolfb videolfb; struct tag_cmdline cmdline; /* * Acorn specific */ struct tag_acorn acorn; /* * DC21285 specific */ struct tag_memclk memclk; /****** INFOTECH Custom TAG ********/ struct tag_custom custom; } u; }; D. Add implementation code in lib_arm/bootm.c: static void setup_custom_tag(bd_t *bd); static void setup_custom_tag(bd_t *bd) { params->hdr.tag = ATAG_CUSTOM; params->hdr.size = tag_size (tag_macaddr); params->u.custom.cmd =0; params = tag_next (params); } E. Add "#ifdef CONFIG_CUSTOM_TAG / #endif" at every place you change the code. F. Done of U-Boot modification.
-
Wymagane zmiany w Linuksie:
A. Dodaj kod znacznika parse w Linuksie/arch/arm/kernel/setup.c:
int cmd; static int __init parse_tag_custom(const struct tag *tag){ printk("u.custom.cmd=%d\n",tag->u.custom.cmd); return 0; } __tagtable(ATAG_MACADDR, parse_tag_custom);
B. Dodaj deklarację struktury tak jak U-Boot w Linuksie / include / asm-arm / setup.h:
#define ATAG_MACADDR 0x5441000a struct tag_custom { int cmd; };
C. Dodaj strukturę na ogonie "u"...
struct tag { struct tag_header hdr; union { struct tag_core core; struct tag_mem32 mem; struct tag_videotext videotext; struct tag_ramdisk ramdisk; struct tag_initrd initrd; struct tag_serialnr serialnr; struct tag_revision revision; struct tag_videolfb videolfb; struct tag_cmdline cmdline; /* * Acorn specific */ struct tag_acorn acorn; /* * DC21285 specific */ struct tag_memclk memclk; /* Add Infotech custom tag */ struct tag_custom custom; } u; };
D. zrobione w / części jądra.
-
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-10-25 18:34:54
Najnowsze jądro Linuksa próbuje zdezaktualizować ATAGS z drzewami urządzeń . Jednak konfiguracja .plik h definiuje różne wartości i struktury ATAG. Aby je przeanalizować, musisz dodać je za pomocą czegoś w rodzaju:
static int __init parse_tag_custom(const struct tag *tag)
{
if (tag->hdr.size > CUSTOM_SIZE) {
/* Use, storing or acting on passed values */
tag->u.custom;
}
return 0;
}
__tagtable(ATAG_CUSTOM, parse_tag_custom);
Jak w atags_parse.c . Oczywiście musisz dodać je do wartości w konfiguracji .h .
U-boot jest prawdopodobnie mniej zdefiniowany, ponieważ w większości przypadków przekazuje argumenty przez jądro wiersz poleceń, ponieważ nie jest to specyficzne dla ARM. Preferowaną metodą jest prawdopodobnie argument command argument lub device trees . Jeśli podałeś przykład jakiego typu konfiguracji potrzebujesz, ktoś mógłby prawdopodobnie dać lepsze wskazówki.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-07-16 00:54:44