[OpenWrt-Devel] [PATCHv5] ramips: add support for SamKnows SK-WB8
Andrew Yong
me at ndoo.sg
Mon Apr 25 21:24:35 EDT 2016
"alternatively call uboot-env directly without the fw_* abstraction layer"
Pardon the obtuse question but how would I go about doing this? It
sounds like the cleanest way to do things.
I'd like to avoid calling uci-default earlier than it needs to be, and
potentially messing up other things in the init process.
If there really isn't an OpenWrt-approved way to do this, I may just
advocate replacing SamKnows' u-boot entirely (writing to the same
partition every boot seems bad for flash memory anyway).
On Tue, Apr 26, 2016 at 12:32 AM, John Crispin <john at phrozen.org> wrote:
>
>
> On 25/04/2016 18:01, Andrew Yong wrote:
>> diff --git a/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount
>> new file mode 100644
>> index 0000000..570fe16
>> --- /dev/null
>> +++ b/target/linux/ramips/base-files/lib/preinit/04_handle_bootcount
>> @@ -0,0 +1,22 @@
>> +#!/bin/sh
>> +
>> +# SamKnows Whitebox 8 increments a bootcount variable every boot and attempts
>> +# to boot a recovery partition when bootcount > 3. We need to ensure this is
>> +# reset to 0 every boot
>> +
>> +do_bootcount_reset() {
>> + . /lib/ramips.sh
>> +
>> + local board=$(ramips_board_name)
>> +
>> + case "$board" in
>> + sk-wb8)
>> + echo "Board is SamKnows Whitebox 8, resetting bootcount environment variable..."
>> + fw_setenv bootcount 0
>> + ;;
>> + esac
>> +
>> + return 0
>> +}
>> +
>> +boot_hook_add preinit_main do_bootcount_reset
>
>
> does this actually work ? thinking about it, you might need to have
> uci-default run for it to work properly or alternatively call uboot-env
> directly without the fw_* abstraction layer
>
> John
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list