完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
Platform: Rockchip OS: Android 6.0 Kernel: 3.10.92 需求: 硬件版本不一样,通过几个gpio的高低电平来表示不同版本, u-boot/kernel/hal/framework/app层都需要用到,那么 可以使用系统自身的参数传递机制以及property API来实现. 以一个gpio为例. 改动: u-boot diff --git a/board/rockchip/rk32xx/rk32xx.c b/board/rockchip/rk32xx/rk32xx.c index f043f77..e9a7466 100644 --- a/board/rockchip/rk32xx/rk32xx.c +++ b/board/rockchip/rk32xx/rk32xx.c @@ -164,6 +164,12 @@ static void board_init_adjust_env(void) } } //宏定义包起来 +/*Kris,161219, hw version verify. {*/ +#ifdef CONFIG_ECO_HW_REV +u8 eco_hw_rev = 0; +#endif +/*Kris,161219, hw version verify. }*/ + #ifdef CONFIG_BOARD_LATE_INIT extern char bootloader_ver[24]; int board_late_init(void) @@ -182,6 +188,15 @@ int board_late_init(void) key_init(); #endif +/*Kris,161219, hw version verify. {*/ +#ifdef CONFIG_ECO_HW_REV +#define GPIO_ECO_HW_REV (GPIO_BANK8 | GPIO_A7) //获取gpio状态 + gpio_direction_input(GPIO_ECO_HW_REV); + eco_hw_rev = gpio_get_value(GPIO_ECO_HW_REV); + printf("HW board check version:%dn", gpio_get_value(GPIO_ECO_HW_REV)); +#endif +/*Kris,161219, hw version verify. }*/ + #ifdef CONFIG_RK_POWER debug("pmic_initn"); pmic_init(0); diff --git a/common/cmd_bootrk.c b/common/cmd_bootrk.c index 17ad496..9f101c6 100755 --- a/common/cmd_bootrk.c +++ b/common/cmd_bootrk.c @@ -42,6 +42,14 @@ extern int do_bootm_linux(int flag, int argc, char *argv[], #if defined(CONFIG_POWER_RK818) extern bool is_rk81x_fg_init(void); #endif + +/*Kris,161219, hw version verify. {*/ +#ifdef CONFIG_ECO_HW_REV +extern u8 eco_hw_rev; +#endif +/*Kris,161219, hw version verify. }*/ + + extern int rkimage_load_image(rk_boot_img_hdr *hdr, const disk_partition_t *boot_ptn, const disk_partition_t *kernel_ptn); @@ -486,6 +494,13 @@ static void rk_commandline_setenv(const char *boot_name, rk_boot_img_hdr *hdr, b "%s adc.incre=%d", command_line, g_increment); #endif +/*Kris,161219, hw version verify. {*/ +#ifdef CONFIG_ECO_HW_REV //利用u-boot到kernel的cmdline参数传递机制,传到kernel中. +snprintf(command_line, sizeof(command_line), + "%s androidboot.eco_hw_rev=%s", command_line, eco_hw_rev?"Primary":"Secondary"); +#endif +/*Kris,161219, hw version verify. }*/ + char *sn = getenv("fbt_sn#"); if (sn != NULL) { /* append serial number if it wasn't in device_info already */ diff --git a/include/configs/rk32plat.h b/include/configs/rk32plat.h index f80799f..ec5e41d 100755 --- a/include/configs/rk32plat.h +++ b/include/configs/rk32plat.h @@ -224,4 +224,8 @@ #endif /* CONFIG_RK_POWER */ + +/*Kris,161219, hw version verify.*/ +#define CONFIG_ECO_HW_REV + #endif /* __RK32PLAT_CONFIG_H */ kernel: diff --git a/arch/arm/mach-rockchip/common.c b/arch/arm/mach-rockchip/common.c index e80880e..107b58c 100755 --- a/arch/arm/mach-rockchip/common.c +++ b/arch/arm/mach-rockchip/common.c @@ -340,6 +340,21 @@ static int __init rockchip_uboot_logo_setup(char *p) } early_param("uboot_logo", rockchip_uboot_logo_setup); +/*Kris, 20161219, add check hw rev interface. {*/ //kernel中可以使用eco_hw_rev来判断了. +int eco_hw_rev; +static int __init early_eco_hw_rev(char *p) +{ + get_option(&p, &eco_hw_rev); + if (!strncmp(p, "Primary", 7)) + eco_hw_rev = 1; + else if (!strncmp(p, "Secondary", 9)) + eco_hw_rev = 0; + printk("androidboot.eco_hw_rev:%sn", p); + return 0; +} +early_param("androidboot.eco_hw_rev", early_eco_hw_rev); +/*Kris, 20161219, add check hw rev interface. }*/ + userspace: 注意到cmdline的参数是androidboot.eco_hw_rev, ,在init进程中会解析以androidboot打头的cmdline参数, 最终生成ro.boot.xxx格式的property. 而在HAL, Natvie, APP层都有对应的api去解析property,这样整个系统都可以使用了. |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1988 浏览 1 评论
synopsys 的design ware:DW_fpv_div,浮点数除法器,默认32位下,想提升覆盖率(TMAX),如果用功能case去提升覆盖率呢?
2490 浏览 1 评论
RK3588 GStreamer调试四路鱼眼摄像头四宫格显示报错
5272 浏览 1 评论
【飞凌嵌入式OK3576-C开发板体验】RKNN神经网络-YOLO图像识别
254 浏览 0 评论
【飞凌嵌入式OK3576-C开发板体验】SSH远程登录网络配置及CAN通讯
1336 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 20:27 , Processed in 0.711595 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号