i want add customized atag
variable in u-boot , linux kernel.
how can achieve this?
there procedure add atag
variable in u-boot
, linux
?
follow procedure ,
to achieve goal, there're 2 parts need modified. 1 u-boot, , other 1 linux kernel.
1. u-boot changes required : a. make sure config_cmdline_tag/config_setup_memory_tags/config_initrd_tag defined in project definition header file ( u-boot/include/configs/am335x_evm.h ), , can add our own tag here, eg. config_custom_tag. b. add structure definition 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 struct @ 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" @ every place change 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 structure declaration u-boot did in linux/include/asm-arm/setup.h: #define atag_macaddr 0x5441000a struct tag_custom { int cmd; }; c. add struct @ 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.
Comments
Post a Comment