Setup remote control and u-boot tools on mainline linux

Hi,

I have made a boot menu for amlogic devices so it can boot multiple OS and the user can choose the OS to boot after powering on the device.


The project works flawlessly, but, I want to ditch the amlogic kernel 3.14.29 and use the mainline kernel instead. But I have two problems
1- u-boot tools (fw_printenv and fw_setenv) don’t work since the the /dev/env no longer exist in mainline Linux.
2- Can’t set Ir remote since the /dev/amremote no longer exist in mainline linux
Have anyone tried to setup ir remote control and u-boot tools(fw_printenv and fw_setenv) using mainline Linux ?

PS: I don’t have khadas vim but since the project works on any amlogic board I thought I’d ask here

Thanks

2 Likes

Hi moham96,

Yes, the mainline linux doesn’t have env partition any more, I ever tried to add Amlogic eMMC partition table, but need many patches and it’s not a good idea to add driver/amlogic folder to mainline linux.

By the way, the boot menu is on uart or HDMI screen?

Thanks.

Can we use the /dev/mmcblk block device directly in the fw_env.config ? The default config has an example of that but I don’t know how to calculated the addresses

# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
# Futhermore, if the Flash sector size is ommitted, this value is assumed to
# be the same as the Environment size, which is valid for NOR and SPI-dataflash

# NOR example
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
#/dev/mtd1		0x0000		0x4000		0x4000
#/dev/mtd2		0x0000		0x4000		0x4000

# MTD SPI-dataflash example
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
#/dev/mtd5		0x4200		0x4200
#/dev/mtd6		0x4200		0x4200

# NAND example
#/dev/mtd0		0x4000		0x4000		0x20000			2

# Block device example
#/dev/mmcblk0		0xc0000		0x20000

# VFAT example
#/boot/uboot.env	0x0000          0x4000

# Amlogic NAND
/dev/nand_env		0x000000	0x10000 	0x10000

# Amlogic eMMC
/dev/env		0x000000	0x10000 	0x10000

The boot menu is on the framebuffer (HDMI) and the user select the OS to boot using the keyboard or the IR remote

Thanks

Real great job, will you share the code to the open source community?

Good day!

Well, I’ve already shared them on armbian forums


But that image doesn’t support ir remote so you have to use the keyboard to choose the os.
Give me a few hours and I can post here a new image with ir remote support
Thanks

1 Like

You can use the following offsets to access the persistent u-boot environment on emmc:

For the Khadas Vim:

ubuntu@kvim:~$ cat /etc/fw_env.config
/dev/mmcblk1 0x7400000 0x10000

For the Khadas Vim2:

ubuntu@kvim2:~$ cat /etc/fw_env.config
/dev/mmcblk1 0x27400000 0x00010000

I’m interested to know how you have implement the menue. AfaIk u-boot does not support reading from keyboard. Have you published the source code?

1 Like

Unfortunately, as I said I don’t have any of khadas boards, so Do You mind telling me how you calculated those offsets so I can do the same for my board ?

for the menu part, I boot a tiny Linux kernel with a script that shows the menu. That’s why I need to use mainline kernel instead of the heavily patched amlogic one (I want to reduce the boot time and mainline kernel boot faster)

1 Like

There are two ways to find out the right offset and size of the u-boot environment.

If you have access to the u-boot sources, look into …/include/configs and pick the relevant settings for your board, like CONFIG_ENV_SECT_SIZE, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET.

If you don’t have access to the source files, you can still find the area which is used by the environment. During boot you can define an additional u-boot environment variable of your choice and store the environment via `saveenv´. When booting has finished you can copy the relevant area (usually the sectors from 0 to the start of the first (usable) partition) with

sudo dd if=/dev/... bs=512 count=... | hd | less

and use `/´ within less to search for your previously defined variable. The environment starts at a sector boundary, the first bytes are used for checksumming, the environment size is 4k multiplied by a power of two. Thera are not that many possible choices.

1 Like

Have you tried petitboot so far?

1 Like

Petitboot is a bootloader, I didn’t want to replace the bootloader because this will probably come with a lot of difficulties and disadvantages, Instead, I kept the u-boot untouched and made only a boot menu that will instruct u-boot to boot to a specific system.
anyway If you have any questions or comments regarding the boot menu we can move the discussion here Bootmenu for amlogic devices

Well, I found the offset through UART during the boot up of u-boot:

mmc read lba=0x14000, blocks=0x400
start dts,buffer=0000000073ec8ff0,dt_addr=0000000073ec8ff0
parts: 11
00:      logo    0000000002000000 1
01:  recovery    0000000002000000 1
02:       rsv    0000000000800000 1
03:       tee    0000000000800000 1
04:     crypt    0000000002000000 1
05:      misc    0000000002000000 1
06: instaboot    0000000020000000 1
07:      boot    0000000002000000 1
08:    system    0000000040000000 1
09:     cache    0000000020000000 2
10:      data    ffffffffffffffff 4
get_dtb_struct: Get emmc dtb OK!
overide_emmc_partition_table: overide cache
[mmc_get_partition_table] skip partition cache.
Partition table get from SPL is :
        name                        offset size              flag
===================================================================================
   0: bootloader                         0 400000                  0
   1: reserved                     2400000 4000000                  0
   2: cache                        6c00000 20000000                  2
   3: env                         27400000 800000                  0
   4: logo                        28400000 2000000                  1
   5: recovery                    2ac00000 2000000                  1
   6: rsv                         2d400000 800000                  1
   7: tee                         2e400000 800000                  1
   8: crypt                       2f400000 2000000                  1
   9: misc                        31c00000 2000000                  1
  10: instaboot                   34400000 20000000                  1
  11: boot                        54c00000 2000000                  1
  12: system                      57400000 40000000                  1
  13: data                        97c00000 30c200000                  4
mmc read lba=0x12000, blocks=0x2
mmc read lba=0x12002, blocks=0x2
mmc_read_partition_tbl: mmc read partition OK!
eMMC/TSD partition table have been checked OK!
mmc env offset: 0x27400000

I used offset 0x27400000 and size 800000 in hexdump and I can see the whole environment variables as such :

root@amlogic:~# dd if=/dev/mmcblk0 |hd -s 0x27400000 -n 800000
27400000 b3 f9 3b c8 62 61 75 64 72 61 74 65 3d 31 31 35 |…;.baudrate=115|
27400010 32 30 30 00 62 6f 6f 74 5f 73 74 61 72 74 3d 62 |200.boot_start=b|
27400020 6f 6f 74 6d 20 30 78 31 31 30 30 30 30 30 30 20 |ootm 0x11000000 |
27400030 30 78 31 33 30 30 30 30 30 30 20 30 78 31 30 30 |0x13000000 0x100|
27400040 30 30 30 30 00 62 6f 6f 74 61 72 67 73 3d 72 6f |0000.bootargs=ro|
27400050 6f 74 66 73 74 79 70 65 3d 72 61 6d 66 73 20 69 |otfstype=ramfs i|
27400060 6e 69 74 3d 2f 69 6e 69 74 20 63 6f 6e 73 6f 6c |nit=/init consol|
27400070 65 3d 74 74 79 53 30 2c 31 31 35 32 30 30 20 6e |e=ttyS0,115200 n|
27400080 6f 5f 63 6f 6e 73 6f 6c 65 5f 73 75 73 70 65 6e |o_console_suspen|
27400090 64 20 65 61 72 6c 79 70 72 69 6e 74 6b 3d 61 6d |d earlyprintk=am|
274000a0 6c 2d 75 61 72 74 2c 30 78 63 38 31 30 30 34 63 |l-uart,0xc81004c|
274000b0 30 20 72 61 6d 6f 6f 70 73 2e 6d 65 6d 5f 61 64 |0 ramoops.mem_ad|
274000c0 64 72 65 73 73 3d 30 78 32 30 30 30 30 30 30 30 |dress=0x20000000|
274000d0 20 72 61 6d 6f 6f 70 73 2e 6d 65 6d 5f 73 69 7a | ramoops.mem_siz|
274000e0 65 3d 30 78 31 30 30 30 30 30 20 72 61 6d 6f 6f |e=0x100000 ramoo|
274000f0 70 73 2e 72 65 63 6f 72 64 5f 73 69 7a 65 3d 30 |ps.record_size=0|
27400100 78 38 30 30 30 20 72 61 6d 6f 6f 70 73 2e 63 6f |x8000 ramoops.co|
27400110 6e 73 6f 6c 65 5f 73 69 7a 65 3d 30 78 34 30 30 |nsole_size=0x400|
27400120 30 20 61 6e 64 72 6f 69 64 62 6f 6f 74 2e 73 65 |0 androidboot.se|
27400130 6c 69 6e 75 78 3d 70 65 72 6d 69 73 73 69 76 65 |linux=permissive|
27400140 20 6c 6f 67 6f 3d 6f 73 64 31 2c 6c 6f 61 64 65 | logo=osd1,loade|
27400150 64 2c 30 78 33 66 38 30 30 30 30 30 2c 31 30 38 |d,0x3f800000,108|
27400160 30 70 35 30 68 7a 20 68 64 6d 69 6d 6f 64 65 3d |0p50hz hdmimode=|
27400170 31 30 38 30 70 35 30 68 7a 20 63 76 62 73 6d 6f |1080p50hz cvbsmo|
27400180 64 65 3d 35 37 36 63 76 62 73 20 68 64 6d 69 74 |de=576cvbs hdmit|
27400190 78 3d 20 61 6e 64 72 6f 69 64 62 6f 6f 74 2e 66 |x= androidboot.f|
274001a0 69 72 73 74 62 6f 6f 74 3d 30 20 6d 61 63 3d 44 |irstboot=0 mac=D|
274001b0 30 3a 37 36 3a 35 38 3a 30 37 3a 41 45 3a 35 44 |0:76:58:07:AE:5D|
274001c0 20 61 6e 64 72 6f 69 64 62 6f 6f 74 2e 6d 61 63 | androidboot.mac|
274001d0 3d 44 30 3a 37 36 3a 35 38 3a 30 37 3a 41 45 3a |=D0:76:58:07:AE:|
274001e0 35 44 00 62 6f 6f 74 63 6d 64 3d 69 66 20 66 61 |5D.bootcmd=if fa|
274001f0 74 6c 6f 61 64 20 6d 6d 63 20 30 3a 31 20 24 7b |tload mmc 0:1 ${|
27400200 6c 6f 61 64 61 64 64 72 7d 20 6d 75 6c 74 69 62 |loadaddr} multib|
27400210 6f 6f 74 2e 73 63 72 69 70 74 3b 74 68 65 6e 20 |oot.script;then |
27400220 72 75 6e 20 73 74 61 72 74 5f 6d 75 6c 74 69 62 |run start_multib|
27400230 6f 6f 74 3b 20 65 6c 73 65 20 72 75 6e 20 73 74 |oot; else run st|
27400240 6f 72 65 62 6f 6f 74 3b 66 69 3b 00 62 6f 6f 74 |oreboot;fi;.boot|
27400250 64 65 6c 61 79 3d 31 00 62 6f 6f 74 6d 6f 64 65 |delay=1.bootmode|
27400260 5f 63 68 65 63 6b 3d 67 65 74 5f 72 65 62 6f 6f |check=get_reboo|
27400270 74 6d 6f 64 65 3b 20 65 63 68 6f 20 72 65 62 6f |tmode; echo rebo|
27400280 6f 74 5f 6d 6f 64 65 3d 24 7b 72 65 62 6f 6f 74 |ot_mode=${reboot|
27400290 5f 6d 6f 64 65 7d 3b 69 66 20 74 65 73 74 20 24 |mode};if test $|
274002a0 7b 72 65 62 6f 6f 74 5f 6d 6f 64 65 7d 20 3d 20 |{reboot_mode} = |
274002b0 66 61 63 74 6f 72 79 5f 72 65 73 65 74 3b 20 74 |factory_reset; t|
274002c0 68 65 6e 20 64 65 66 65 6e 76 5f 72 65 73 65 72 |hen defenv_reser|
274002d0 76 20 61 6d 6c 5f 64 74 3b 73 65 74 65 6e 76 20 |v aml_dt;setenv |
274002e0 75 70 67 72 61 64 65 5f 73 74 65 70 20 32 3b 20 |upgrade_step 2; |
274002f0 73 61 76 65 3b 66 69 3b 00 62 6f 6f 74 75 70 5f |save;fi;.bootup
|
27400300 6f 66 66 73 65 74 3d 30 78 31 31 35 63 30 66 30 |offset=0x115c0f0|
27400310 00 62 6f 6f 74 75 70 5f 73 69 7a 65 3d 30 78 33 |.bootup_size=0x3|
27400320 66 34 63 38 00 63 6d 64 6c 69 6e 65 5f 6b 65 79 |f4c8.cmdline_key|
27400330 73 3d 69 66 20 6b 65 79 6d 61 6e 20 69 6e 69 74 |s=if keyman init|
27400340 20 30 78 31 32 33 34 3b 20 74 68 65 6e 20 69 66 | 0x1234; then if|
27400350 20 6b 65 79 6d 61 6e 20 72 65 61 64 20 75 73 69 | keyman read usi|
27400360 64 20 24 7b 6c 6f 61 64 61 64 64 72 7d 20 73 74 |d ${loadaddr} st|
27400370 72 3b 20 74 68 65 6e 20 73 65 74 65 6e 76 20 62 |r; then setenv b|
27400380 6f 6f 74 61 72 67 73 20 24 7b 62 6f 6f 74 61 72 |ootargs ${bootar|
27400390 67 73 7d 20 61 6e 64 72 6f 69 64 62 6f 6f 74 2e |gs} androidboot.|
274003a0 73 65 72 69 61 6c 6e 6f 3d 24 7b 75 73 69 64 7d |serialno=${usid}|
274003b0 3b 66 69 3b 69 66 20 6b 65 79 6d 61 6e 20 72 65 |;fi;if keyman re|
274003c0 61 64 20 6d 61 63 20 24 7b 6c 6f 61 64 61 64 64 |ad mac ${loadadd|
274003d0 72 7d 20 73 74 72 3b 20 74 68 65 6e 20 73 65 74 |r} str; then set|
274003e0 65 6e 76 20 62 6f 6f 74 61 72 67 73 20 24 7b 62 |env bootargs ${b|
274003f0 6f 6f 74 61 72 67 73 7d 20 6d 61 63 3d 24 7b 6d |ootargs} mac=${m|
27400400 61 63 7d 20 61 6e 64 72 6f 69 64 62 6f 6f 74 2e |ac} androidboot.|
27400410 6d 61 63 3d 24 7b 6d 61 63 7d 3b 66 69 3b 69 66 |mac=${mac};fi;if|
27400420 20 6b 65 79 6d 61 6e 20 72 65 61 64 20 64 65 76 | keyman read dev|
27400430 69 63 65 69 64 20 24 7b 6c 6f 61 64 61 64 64 72 |iceid ${loadaddr|
27400440 7d 20 73 74 72 3b 20 74 68 65 6e 20 73 65 74 65 |} str; then sete|
27400450 6e 76 20 62 6f 6f 74 61 72 67 73 20 24 7b 62 6f |nv bootargs ${bo|
27400460 6f 74 61 72 67 73 7d 20 61 6e 64 72 6f 69 64 62 |otargs} androidb|
27400470 6f 6f 74 2e 64 65 76 69 63 65 69 64 3d 24 7b 64 |oot.deviceid=${d|
27400480 65 76 69 63 65 69 64 7d 3b 66 69 3b 66 69 3b 00 |eviceid};fi;fi;.|
27400490 63 6f 6d 6d 61 6e 64 3d 30 00 63 76 62 73 6d 6f |command=0.cvbsmo|
274004a0 64 65 3d 35 37 36 63 76 62 73 00 64 69 73 70 6c |de=576cvbs.displ|
274004b0 61 79 5f 62 70 70 3d 31 36 00 64 69 73 70 6c 61 |ay_bpp=16.displa|
274004c0 79 5f 63 6f 6c 6f 72 5f 62 67 3d 30 00 64 69 73 |y_color_bg=0.dis|
274004d0 70 6c 61 79 5f 63 6f 6c 6f 72 5f 66 67 3d 30 78 |play_color_fg=0x|
274004e0 66 66 66 66 00 64 69 73 70 6c 61 79 5f 63 6f 6c |ffff.display_col|
274004f0 6f 72 5f 69 6e 64 65 78 3d 31 36 00 64 69 73 70 |or_index=16.disp|
27400500 6c 61 79 5f 68 65 69 67 68 74 3d 31 30 38 30 00 |lay_height=1080.|
27400510 64 69 73 70 6c 61 79 5f 6c 61 79 65 72 3d 6f 73 |display_layer=os|
27400520 64 31 00 64 69 73 70 6c 61 79 5f 77 69 64 74 68 |d1.display_width|
27400530 3d 31 39 32 30 00 64 74 62 5f 6d 65 6d 5f 61 64 |=1920.dtb_mem_ad|
27400540 64 72 3d 30 78 31 30 30 30 30 30 30 00 65 64 69 |dr=0x1000000.edi|
27400550 64 2e 63 72 63 76 61 6c 75 65 3d 30 78 34 32 39 |d.crcvalue=0x429|
27400560 37 30 30 30 30 00 65 74 68 61 63 74 3d 4d 65 73 |70000.ethact=Mes|
27400570 6f 6e 5f 45 74 68 65 72 6e 65 74 00 65 74 68 61 |on_Ethernet.etha|
27400580 64 64 72 3d 30 30 3a 31 35 3a 31 38 3a 30 31 3a |ddr=00:15:18:01:|
27400590 38 31 3a 33 31 00 66 61 63 74 6f 72 79 5f 72 65 |81:31.factory_re|
274005a0 73 65 74 5f 70 6f 77 65 72 6f 66 66 5f 70 72 6f |set_poweroff_pro|
274005b0 74 65 63 74 3d 65 63 68 6f 20 77 69 70 65 5f 64 |tect=echo wipe_d|
274005c0 61 74 61 3d 24 7b 77 69 70 65 5f 64 61 74 61 7d |ata=${wipe_data}|
274005d0 3b 20 65 63 68 6f 20 77 69 70 65 5f 63 61 63 68 |; echo wipe_cach|
274005e0 65 3d 24 7b 77 69 70 65 5f 63 61 63 68 65 7d 3b |e=${wipe_cache};|
274005f0 69 66 20 74 65 73 74 20 24 7b 77 69 70 65 5f 64 |if test ${wipe_d|
27400600 61 74 61 7d 20 3d 20 66 61 69 6c 65 64 3b 20 74 |ata} = failed; t|
27400610 68 65 6e 20 72 75 6e 20 69 6e 69 74 5f 64 69 73 |hen run init_dis|
27400620 70 6c 61 79 3b 20 72 75 6e 20 73 74 6f 72 65 61 |play; run storea|
27400630 72 67 73 3b 69 66 20 6d 6d 63 69 6e 66 6f 3b 20 |rgs;if mmcinfo; |
27400640 74 68 65 6e 20 72 75 6e 20 72 65 63 6f 76 65 72 |then run recover|
27400650 79 5f 66 72 6f 6d 5f 73 64 63 61 72 64 3b 66 69 |y_from_sdcard;fi|
27400660 3b 69 66 20 75 73 62 20 73 74 61 72 74 20 30 3b |;if usb start 0;|
27400670 20 74 68 65 6e 20 72 75 6e 20 72 65 63 6f 76 65 | then run recove|
27400680 72 79 5f 66 72 6f 6d 5f 75 64 69 73 6b 3b 66 69 |ry_from_udisk;fi|
27400690 3b 72 75 6e 20 72 65 63 6f 76 65 72 79 5f 66 72 |;run recovery_fr|
274006a0 6f 6d 5f 66 6c 61 73 68 3b 66 69 3b 20 69 66 20 |om_flash;fi; if |
274006b0 74 65 73 74 20 24 7b 77 69 70 65 5f 63 61 63 68 |test ${wipe_cach|
274006c0 65 7d 20 3d 20 66 61 69 6c 65 64 3b 20 74 68 65 |e} = failed; the|
274006d0 6e 20 72 75 6e 20 69 6e 69 74 5f 64 69 73 70 6c |n run init_displ|
274006e0 61 79 3b 20 72 75 6e 20 73 74 6f 72 65 61 72 67 |ay; run storearg|
274006f0 73 3b 69 66 20 6d 6d 63 69 6e 66 6f 3b 20 74 68 |s;if mmcinfo; th|
27400700 65 6e 20 72 75 6e 20 72 65 63 6f 76 65 72 79 5f |en run recovery
|
27400710 66 72 6f 6d 5f 73 64 63 61 72 64 3b 66 69 3b 69 |from_sdcard;fi;i|
27400720 66 20 75 73 62 20 73 74 61 72 74 20 30 3b 20 74 |f usb start 0; t|
27400730 68 65 6e 20 72 75 6e 20 72 65 63 6f 76 65 72 79 |hen run recovery|
27400740 5f 66 72 6f 6d 5f 75 64 69 73 6b 3b 66 69 3b 72 |_from_udisk;fi;r|
27400750 75 6e 20 72 65 63 6f 76 65 72 79 5f 66 72 6f 6d |un recovery_from|
27400760 5f 66 6c 61 73 68 3b 66 69 3b 20 00 66 62 5f 61 |flash;fi; .fb_a|
27400770 64 64 72 3d 30 78 33 66 38 30 30 30 30 30 00 66 |ddr=0x3f800000.f|
27400780 62 5f 68 65 69 67 68 74 3d 31 30 38 30 00 66 62 |b_height=1080.fb|
27400790 5f 77 69 64 74 68 3d 31 39 32 30 00 66 64 74 5f |width=1920.fdt|
274007a0 68 69 67 68 3d 30 78 32 30 30 30 30 30 30 30 00 |high=0x20000000.|
274007b0 66 69 6c 65 73 69 7a 65 3d 32 32 30 00 66 69 72 |filesize=220.fir|
274007c0 73 74 62 6f 6f 74 3d 30 00 67 61 74 65 77 61 79 |stboot=0.gateway|
274007d0 69 70 3d 31 30 2e 31 38 2e 39 2e 31 00 68 64 6d |ip=10.18.9.1.hdm|
274007e0 69 6d 6f 64 65 3d 31 30 38 30 70 35 30 68 7a 00 |imode=1080p50hz.|
274007f0 68 6f 73 74 6e 61 6d 65 3d 61 72 6d 5f 67 78 62 |hostname=arm_gxb|
27400800 62 00 69 64 65 6e 74 69 66 79 57 61 69 74 54 69 |b.identifyWaitTi|
27400810 6d 65 3d 37 35 30 00 69 6e 69 74 5f 64 69 73 70 |me=750.init_disp|
27400820 6c 61 79 3d 68 64 6d 69 74 78 20 68 70 64 3b 6f |lay=hdmitx hpd;o|
27400830 73 64 20 6f 70 65 6e 3b 6f 73 64 20 63 6c 65 61 |sd open;osd clea|
27400840 72 3b 76 6f 75 74 20 6f 75 74 70 75 74 20 24 7b |r;vout output ${|
27400850 6f 75 74 70 75 74 6d 6f 64 65 7d 3b 69 6d 67 72 |outputmode};imgr|
27400860 65 61 64 20 70 69 63 20 6c 6f 67 6f 20 62 6f 6f |ead pic logo boo|
27400870 74 75 70 20 24 6c 6f 61 64 61 64 64 72 3b 62 6d |tup $loadaddr;bm|
27400880 70 20 64 69 73 70 6c 61 79 20 24 62 6f 6f 74 75 |p display $bootu|
27400890 70 5f 6f 66 66 73 65 74 3b 62 6d 70 20 73 63 61 |p_offset;bmp sca|
274008a0 6c 65 00 69 6e 69 74 61 72 67 73 3d 72 6f 6f 74 |le.initargs=root|
274008b0 66 73 74 79 70 65 3d 72 61 6d 66 73 20 69 6e 69 |fstype=ramfs ini|
274008c0 74 3d 2f 69 6e 69 74 20 63 6f 6e 73 6f 6c 65 3d |t=/init console=|
274008d0 74 74 79 53 30 2c 31 31 35 32 30 30 20 6e 6f 5f |ttyS0,115200 no
|
274008e0 63 6f 6e 73 6f 6c 65 5f 73 75 73 70 65 6e 64 20 |console_suspend |
274008f0 65 61 72 6c 79 70 72 69 6e 74 6b 3d 61 6d 6c 2d |earlyprintk=aml-|
27400900 75 61 72 74 2c 30 78 63 38 31 30 30 34 63 30 20 |uart,0xc81004c0 |
27400910 72 61 6d 6f 6f 70 73 2e 6d 65 6d 5f 61 64 64 72 |ramoops.mem_addr|
27400920 65 73 73 3d 30 78 32 30 30 30 30 30 30 30 20 72 |ess=0x20000000 r|
27400930 61 6d 6f 6f 70 73 2e 6d 65 6d 5f 73 69 7a 65 3d |amoops.mem_size=|
27400940 30 78 31 30 30 30 30 30 20 72 61 6d 6f 6f 70 73 |0x100000 ramoops|
27400950 2e 72 65 63 6f 72 64 5f 73 69 7a 65 3d 30 78 38 |.record_size=0x8|
27400960 30 30 30 20 72 61 6d 6f 6f 70 73 2e 63 6f 6e 73 |000 ramoops.cons|
27400970 6f 6c 65 5f 73 69 7a 65 3d 30 78 34 30 30 30 20 |ole_size=0x4000 |
27400980 61 6e 64 72 6f 69 64 62 6f 6f 74 2e 73 65 6c 69 |androidboot.seli|
27400990 6e 75 78 3d 70 65 72 6d 69 73 73 69 76 65 00 69 |nux=permissive.i|
274009a0 6e 69 74 72 64 5f 61 64 64 72 3d 30 78 31 33 30 |nitrd_addr=0x130|
274009b0 30 30 30 30 30 00 69 6e 69 74 72 64 5f 6c 6f 61 |00000.initrd_loa|
274009c0 64 61 64 64 72 3d 30 78 31 33 30 30 30 30 30 30 |daddr=0x13000000|
274009d0 00 69 70 61 64 64 72 3d 31 30 2e 31 38 2e 39 2e |.ipaddr=10.18.9.|
274009e0 39 37 00 69 72 72 65 6d 6f 74 65 5f 75 70 64 61 |97.irremote_upda|
274009f0 74 65 3d 69 72 6b 65 79 20 30 78 62 61 34 35 66 |te=irkey 0xba45f|
27400a00 66 30 30 20 30 78 62 61 34 35 39 34 63 61 20 31 |f00 0xba4594ca 1|
27400a10 30 30 32 30 30 30 3b 69 66 20 74 65 73 74 20 24 |002000;if test $|
27400a20 7b 69 72 6b 65 79 5f 76 61 6c 75 65 7d 20 3d 20 |{irkey_value} = |
27400a30 75 70 64 61 74 65 3b 20 74 68 65 6e 20 72 75 6e |update; then run|
27400a40 20 75 70 64 61 74 65 3b 65 6c 73 65 20 69 66 20 | update;else if |
27400a50 74 65 73 74 20 24 7b 69 72 6b 65 79 5f 76 61 6c |test ${irkey_val|
27400a60 75 65 7d 20 3d 20 75 70 64 61 74 65 5f 73 64 63 |ue} = update_sdc|
27400a70 61 72 64 3b 20 74 68 65 6e 20 72 75 6e 20 75 70 |ard; then run up|
27400a80 64 61 74 65 5f 73 64 63 61 72 64 3b 65 6c 73 65 |date_sdcard;else|
27400a90 20 69 66 20 74 65 73 74 20 24 7b 69 72 6b 65 79 | if test ${irkey|
27400aa0 5f 76 61 6c 75 65 7d 20 3d 20 75 73 62 5f 62 75 |_value} = usb_bu|
27400ab0 72 6e 69 6e 67 3b 20 74 68 65 6e 20 72 75 6e 20 |rning; then run |
27400ac0 75 73 62 5f 62 75 72 6e 69 6e 67 3b 65 6c 73 65 |usb_burning;else|
27400ad0 20 69 66 20 74 65 73 74 20 24 7b 69 72 6b 65 79 | if test ${irkey|
27400ae0 5f 76 61 6c 75 65 7d 20 3d 20 75 70 64 61 74 65 |_value} = update|
27400af0 5f 75 64 69 73 6b 3b 20 74 68 65 6e 20 72 75 6e |udisk; then run|
27400b00 20 75 70 64 61 74 65 5f 75 64 69 73 6b 3b 66 69 | update_udisk;fi|
27400b10 3b 66 69 3b 66 69 3b 66 69 3b 00 6b 65 72 6e 65 |;fi;fi;fi;.kerne|
27400b20 6c 5f 61 64 64 72 3d 30 78 31 31 30 30 30 30 30 |l_addr=0x1100000|
27400b30 30 00 6b 65 72 6e 65 6c 5f 6c 6f 61 64 61 64 64 |0.kernel_loadadd|
27400b40 72 3d 30 78 31 31 30 30 30 30 30 30 00 6c 6f 61 |r=0x11000000.loa|
27400b50 64 61 64 64 72 3d 31 30 38 30 30 30 30 00 6d 61 |daddr=1080000.ma|
27400b60 63 3d 44 30 3a 37 36 3a 35 38 3a 30 37 3a 41 45 |c=D0:76:58:07:AE|
27400b70 3a 35 44 00 6d 62 70 61 74 68 3d 2f 6d 75 6c 74 |:5D.mbpath=/mult|
27400b80 69 62 6f 6f 74 2f 6b 65 72 6e 65 6c 2d 34 00 6e |iboot/kernel-4.n|
27400b90 65 74 6d 61 73 6b 3d 32 35 35 2e 32 35 35 2e 32 |etmask=255.255.2|
27400ba0 35 35 2e 30 00 6f 6c 64 63 6f 6d 6d 61 6e 64 3d |55.0.oldcommand=|
27400bb0 66 61 74 6c 6f 61 64 20 6d 6d 63 20 30 3a 32 20 |fatload mmc 0:2 |
27400bc0 24 7b 6c 6f 61 64 61 64 64 72 7d 20 2f 6d 75 6c |${loadaddr} /mul|
27400bd0 74 69 62 6f 6f 74 2f 55 62 75 6e 74 75 2d 34 2f |tiboot/Ubuntu-4/|
27400be0 75 2d 62 6f 6f 74 2e 73 63 72 69 70 74 3b 61 75 |u-boot.script;au|
27400bf0 74 6f 73 63 72 20 24 7b 6c 6f 61 64 61 64 64 72 |toscr ${loadaddr|
27400c00 7d 00 6f 75 74 70 75 74 6d 6f 64 65 3d 35 37 36 |}.outputmode=576|
27400c10 63 76 62 73 00 70 61 74 68 3d 2f 6d 75 6c 74 69 |cvbs.path=/multi|
27400c20 62 6f 6f 74 2f 56 49 54 4d 4f 44 00 70 72 65 62 |boot/VITMOD.preb|
27400c30 6f 6f 74 3d 72 75 6e 20 66 61 63 74 6f 72 79 5f |oot=run factory
|
27400c40 72 65 73 65 74 5f 70 6f 77 65 72 6f 66 66 5f 70 |reset_poweroff_p|
27400c50 72 6f 74 65 63 74 3b 72 75 6e 20 75 70 67 72 61 |rotect;run upgra|
27400c60 64 65 5f 63 68 65 63 6b 3b 72 75 6e 20 62 6f 6f |de_check;run boo|
27400c70 74 6d 6f 64 65 5f 63 68 65 63 6b 3b 72 75 6e 20 |tmode_check;run |
27400c80 69 6e 69 74 5f 64 69 73 70 6c 61 79 3b 72 75 6e |init_display;run|
27400c90 20 73 74 6f 72 65 61 72 67 73 3b 72 75 6e 20 75 | storeargs;run u|
27400ca0 70 64 61 74 65 5f 6b 65 79 3b 72 75 6e 20 69 72 |pdate_key;run ir|
27400cb0 72 65 6d 6f 74 65 5f 75 70 64 61 74 65 3b 72 75 |remote_update;ru|
27400cc0 6e 20 73 77 69 74 63 68 5f 62 6f 6f 74 6d 6f 64 |n switch_bootmod|
27400cd0 65 3b 00 72 65 62 6f 6f 74 5f 6d 6f 64 65 3d 6e |e;.reboot_mode=n|
27400ce0 6f 72 6d 61 6c 00 72 65 63 6f 76 65 72 79 5f 66 |ormal.recovery_f|
27400cf0 72 6f 6d 5f 66 6c 61 73 68 3d 69 66 20 69 6d 67 |rom_flash=if img|
27400d00 72 65 61 64 20 6b 65 72 6e 65 6c 20 72 65 63 6f |read kernel reco|
27400d10 76 65 72 79 20 24 7b 6c 6f 61 64 61 64 64 72 7d |very ${loadaddr}|
27400d20 3b 20 74 68 65 6e 20 62 6f 6f 74 6d 20 24 7b 6c |; then bootm ${l|
27400d30 6f 61 64 61 64 64 72 7d 3b 20 66 69 00 72 65 63 |oadaddr}; fi.rec|
27400d40 6f 76 65 72 79 5f 66 72 6f 6d 5f 73 64 63 61 72 |overy_from_sdcar|
27400d50 64 3d 69 66 20 66 61 74 6c 6f 61 64 20 6d 6d 63 |d=if fatload mmc|
27400d60 20 30 20 24 7b 6c 6f 61 64 61 64 64 72 7d 20 61 | 0 ${loadaddr} a|
27400d70 6d 6c 5f 61 75 74 6f 73 63 72 69 70 74 3b 20 74 |ml_autoscript; t|
27400d80 68 65 6e 20 61 75 74 6f 73 63 72 20 24 7b 6c 6f |hen autoscr ${lo|
27400d90 61 64 61 64 64 72 7d 3b 20 66 69 3b 69 66 20 66 |adaddr}; fi;if f|
27400da0 61 74 6c 6f 61 64 20 6d 6d 63 20 30 20 24 7b 6c |atload mmc 0 ${l|
27400db0 6f 61 64 61 64 64 72 7d 20 72 65 63 6f 76 65 72 |oadaddr} recover|
27400dc0 79 2e 69 6d 67 3b 20 74 68 65 6e 20 69 66 20 66 |y.img; then if f|
27400dd0 61 74 6c 6f 61 64 20 6d 6d 63 20 30 20 24 7b 64 |atload mmc 0 ${d|
27400de0 74 62 5f 6d 65 6d 5f 61 64 64 72 7d 20 64 74 62 |tb_mem_addr} dtb|
27400df0 2e 69 6d 67 3b 20 74 68 65 6e 20 65 63 68 6f 20 |.img; then echo |
27400e00 73 64 20 64 74 62 2e 69 6d 67 20 6c 6f 61 64 65 |sd dtb.img loade|
27400e10 64 3b 20 66 69 3b 62 6f 6f 74 6d 20 24 7b 6c 6f |d; fi;bootm ${lo|
27400e20 61 64 61 64 64 72 7d 3b 66 69 3b 00 72 65 63 6f |adaddr};fi;.reco|
27400e30 76 65 72 79 5f 66 72 6f 6d 5f 75 64 69 73 6b 3d |very_from_udisk=|
27400e40 69 66 20 66 61 74 6c 6f 61 64 20 75 73 62 20 30 |if fatload usb 0|
27400e50 20 24 7b 6c 6f 61 64 61 64 64 72 7d 20 61 6d 6c | ${loadaddr} aml|
27400e60 5f 61 75 74 6f 73 63 72 69 70 74 3b 20 74 68 65 |_autoscript; the|
27400e70 6e 20 61 75 74 6f 73 63 72 20 24 7b 6c 6f 61 64 |n autoscr ${load|
27400e80 61 64 64 72 7d 3b 20 66 69 3b 69 66 20 66 61 74 |addr}; fi;if fat|
27400e90 6c 6f 61 64 20 75 73 62 20 30 20 24 7b 6c 6f 61 |load usb 0 ${loa|
27400ea0 64 61 64 64 72 7d 20 72 65 63 6f 76 65 72 79 2e |daddr} recovery.|
27400eb0 69 6d 67 3b 20 74 68 65 6e 20 69 66 20 66 61 74 |img; then if fat|
27400ec0 6c 6f 61 64 20 75 73 62 20 30 20 24 7b 64 74 62 |load usb 0 ${dtb|
27400ed0 5f 6d 65 6d 5f 61 64 64 72 7d 20 64 74 62 2e 69 |_mem_addr} dtb.i|
27400ee0 6d 67 3b 20 74 68 65 6e 20 65 63 68 6f 20 75 64 |mg; then echo ud|
27400ef0 69 73 6b 20 64 74 62 2e 69 6d 67 20 6c 6f 61 64 |isk dtb.img load|
27400f00 65 64 3b 20 66 69 3b 62 6f 6f 74 6d 20 24 7b 6c |ed; fi;bootm ${l|
27400f10 6f 61 64 61 64 64 72 7d 3b 66 69 3b 00 73 64 63 |oadaddr};fi;.sdc|
27400f20 5f 62 75 72 6e 69 6e 67 3d 73 64 63 5f 62 75 72 |_burning=sdc_bur|
27400f30 6e 20 24 7b 73 64 63 62 75 72 6e 63 66 67 7d 00 |n ${sdcburncfg}.|
27400f40 73 64 63 62 75 72 6e 63 66 67 3d 61 6d 6c 5f 73 |sdcburncfg=aml_s|
27400f50 64 63 5f 62 75 72 6e 2e 69 6e 69 00 73 65 72 76 |dc_burn.ini.serv|
27400f60 65 72 69 70 3d 31 30 2e 31 38 2e 39 2e 31 31 33 |erip=10.18.9.113|
27400f70 00 73 74 61 72 74 5f 6d 75 6c 74 69 62 6f 6f 74 |.start_multiboot|
27400f80 3d 73 65 74 65 6e 76 20 6f 6c 64 63 6f 6d 6d 61 |=setenv oldcomma|
27400f90 6e 64 20 24 7b 63 6f 6d 6d 61 6e 64 7d 3b 73 65 |nd ${command};se|
27400fa0 74 65 6e 76 20 63 6f 6d 6d 61 6e 64 20 30 3b 73 |tenv command 0;s|
27400fb0 61 76 65 65 6e 76 3b 73 6c 65 65 70 20 31 3b 69 |aveenv;sleep 1;i|
27400fc0 66 20 74 65 73 74 20 22 24 7b 6f 6c 64 63 6f 6d |f test “${oldcom|
27400fd0 6d 61 6e 64 7d 22 20 3d 20 30 3b 74 68 65 6e 20 |mand}” = 0;then |
27400fe0 65 63 68 6f 20 73 74 61 72 74 20 62 6f 6f 74 73 |echo start boots|
27400ff0 65 6c 65 63 74 6f 72 3b 61 75 74 6f 73 63 72 20 |elector;autoscr |
27401000 24 7b 6c 6f 61 64 61 64 64 72 7d 3b 65 6c 73 65 |${loadaddr};else|
27401010 20 65 63 68 6f 20 72 75 6e 6e 69 6e 67 20 6d 75 | echo running mu|
27401020 6c 74 69 62 6f 6f 74 20 63 6f 6d 6d 61 6e 64 3b |ltiboot command;|
27401030 72 75 6e 20 6f 6c 64 63 6f 6d 6d 61 6e 64 3b 66 |run oldcommand;f|
27401040 69 3b 00 73 74 64 65 72 72 3d 73 65 72 69 61 6c |i;.stderr=serial|
27401050 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 00 73 74 |.stdin=serial.st|
27401060 64 6f 75 74 3d 73 65 72 69 61 6c 00 73 74 6f 72 |dout=serial.stor|
27401070 65 61 72 67 73 3d 73 65 74 65 6e 76 20 62 6f 6f |eargs=setenv boo|
27401080 74 61 72 67 73 20 24 7b 69 6e 69 74 61 72 67 73 |targs ${initargs|
27401090 7d 20 6c 6f 67 6f 3d 24 7b 64 69 73 70 6c 61 79 |} logo=${display|
274010a0 5f 6c 61 79 65 72 7d 2c 6c 6f 61 64 65 64 2c 24 |_layer},loaded,$|
274010b0 7b 66 62 5f 61 64 64 72 7d 2c 24 7b 6f 75 74 70 |{fb_addr},${outp|
274010c0 75 74 6d 6f 64 65 7d 20 68 64 6d 69 6d 6f 64 65 |utmode} hdmimode|
274010d0 3d 24 7b 68 64 6d 69 6d 6f 64 65 7d 20 63 76 62 |=${hdmimode} cvb|
274010e0 73 6d 6f 64 65 3d 24 7b 63 76 62 73 6d 6f 64 65 |smode=${cvbsmode|
274010f0 7d 20 68 64 6d 69 74 78 3d 24 7b 63 65 63 63 6f |} hdmitx=${cecco|
27401100 6e 66 69 67 7d 20 61 6e 64 72 6f 69 64 62 6f 6f |nfig} androidboo|
27401110 74 2e 66 69 72 73 74 62 6f 6f 74 3d 24 7b 66 69 |t.firstboot=${fi|
27401120 72 73 74 62 6f 6f 74 7d 3b 20 72 75 6e 20 63 6d |rstboot}; run cm|
27401130 64 6c 69 6e 65 5f 6b 65 79 73 3b 00 73 74 6f 72 |dline_keys;.stor|
27401140 65 62 6f 6f 74 3d 69 66 20 69 6d 67 72 65 61 64 |eboot=if imgread|
27401150 20 6b 65 72 6e 65 6c 20 62 6f 6f 74 20 24 7b 6c | kernel boot ${l|
27401160 6f 61 64 61 64 64 72 7d 3b 20 74 68 65 6e 20 73 |oadaddr}; then s|
27401170 74 6f 72 65 20 64 74 62 20 72 65 61 64 20 24 64 |tore dtb read $d|
27401180 74 62 5f 6d 65 6d 5f 61 64 64 72 3b 20 62 6f 6f |tb_mem_addr; boo|
27401190 74 6d 20 24 7b 6c 6f 61 64 61 64 64 72 7d 3b 20 |tm ${loadaddr}; |
274011a0 66 69 3b 72 75 6e 20 75 70 64 61 74 65 3b 00 73 |fi;run update;.s|
274011b0 77 69 74 63 68 5f 62 6f 6f 74 6d 6f 64 65 3d 67 |witch_bootmode=g|
274011c0 65 74 5f 72 65 62 6f 6f 74 6d 6f 64 65 3b 69 66 |et_rebootmode;if|
274011d0 20 74 65 73 74 20 24 7b 72 65 62 6f 6f 74 5f 6d | test ${reboot_m|
274011e0 6f 64 65 7d 20 3d 20 66 61 63 74 6f 72 79 5f 72 |ode} = factory_r|
274011f0 65 73 65 74 3b 20 74 68 65 6e 20 72 75 6e 20 72 |eset; then run r|
27401200 65 63 6f 76 65 72 79 5f 66 72 6f 6d 5f 66 6c 61 |ecovery_from_fla|
27401210 73 68 3b 65 6c 73 65 20 69 66 20 74 65 73 74 20 |sh;else if test |
27401220 24 7b 72 65 62 6f 6f 74 5f 6d 6f 64 65 7d 20 3d |${reboot_mode} =|
27401230 20 75 70 64 61 74 65 3b 20 74 68 65 6e 20 72 75 | update; then ru|
27401240 6e 20 75 70 64 61 74 65 3b 65 6c 73 65 20 69 66 |n update;else if|
27401250 20 74 65 73 74 20 24 7b 72 65 62 6f 6f 74 5f 6d | test ${reboot_m|
27401260 6f 64 65 7d 20 3d 20 63 6f 6c 64 5f 62 6f 6f 74 |ode} = cold_boot|
27401270 3b 20 74 68 65 6e 20 72 75 6e 20 74 72 79 5f 61 |; then run try_a|
27401280 75 74 6f 5f 62 75 72 6e 3b 20 66 69 3b 66 69 3b |uto_burn; fi;fi;|
27401290 66 69 3b 00 74 72 79 5f 61 75 74 6f 5f 62 75 72 |fi;.try_auto_bur|
274012a0 6e 3d 75 70 64 61 74 65 20 37 30 30 20 37 35 30 |n=update 700 750|
274012b0 3b 00 75 70 64 61 74 65 3d 72 75 6e 20 75 73 62 |;.update=run usb|
274012c0 5f 62 75 72 6e 69 6e 67 3b 20 72 75 6e 20 73 64 |_burning; run sd|
274012d0 63 5f 62 75 72 6e 69 6e 67 3b 20 69 66 20 6d 6d |c_burning; if mm|
274012e0 63 69 6e 66 6f 3b 20 74 68 65 6e 20 72 75 6e 20 |cinfo; then run |
274012f0 72 65 63 6f 76 65 72 79 5f 66 72 6f 6d 5f 73 64 |recovery_from_sd|
27401300 63 61 72 64 3b 66 69 3b 69 66 20 75 73 62 20 73 |card;fi;if usb s|
27401310 74 61 72 74 20 30 3b 20 74 68 65 6e 20 72 75 6e |tart 0; then run|
27401320 20 72 65 63 6f 76 65 72 79 5f 66 72 6f 6d 5f 75 | recovery_from_u|
27401330 64 69 73 6b 3b 66 69 3b 72 75 6e 20 72 65 63 6f |disk;fi;run reco|
27401340 76 65 72 79 5f 66 72 6f 6d 5f 66 6c 61 73 68 3b |very_from_flash;|
27401350 00 75 70 64 61 74 65 5f 6b 65 79 3d 73 61 72 61 |.update_key=sara|
27401360 64 63 20 6f 70 65 6e 20 30 3b 20 69 66 20 73 61 |dc open 0; if sa|
27401370 72 61 64 63 20 67 65 74 5f 69 6e 5f 72 61 6e 67 |radc get_in_rang|
27401380 65 20 30 20 30 78 35 30 3b 20 74 68 65 6e 20 6d |e 0 0x50; then m|
27401390 73 6c 65 65 70 20 35 30 3b 20 69 66 20 73 61 72 |sleep 50; if sar|
274013a0 61 64 63 20 67 65 74 5f 69 6e 5f 72 61 6e 67 65 |adc get_in_range|
274013b0 20 30 20 30 78 35 30 3b 20 74 68 65 6e 20 65 63 | 0 0x50; then ec|
274013c0 68 6f 20 75 70 64 61 74 65 20 62 79 20 6b 65 79 |ho update by key|
274013d0 2e 2e 2e 3b 20 72 75 6e 20 75 70 64 61 74 65 3b |…; run update;|
274013e0 20 66 69 3b 66 69 00 75 70 64 61 74 65 5f 73 64 | fi;fi.update_sd|
274013f0 63 61 72 64 3d 69 66 20 6d 6d 63 69 6e 66 6f 3b |card=if mmcinfo;|
27401400 20 74 68 65 6e 20 72 75 6e 20 72 65 63 6f 76 65 | then run recove|
27401410 72 79 5f 66 72 6f 6d 5f 73 64 63 61 72 64 3b 66 |ry_from_sdcard;f|
27401420 69 3b 00 75 70 64 61 74 65 5f 75 64 69 73 6b 3d |i;.update_udisk=|
27401430 69 66 20 75 73 62 20 73 74 61 72 74 20 30 3b 20 |if usb start 0; |
27401440 74 68 65 6e 20 72 75 6e 20 72 65 63 6f 76 65 72 |then run recover|
27401450 79 5f 66 72 6f 6d 5f 75 64 69 73 6b 3b 66 69 3b |y_from_udisk;fi;|
27401460 00 75 70 67 72 61 64 65 5f 63 68 65 63 6b 3d 65 |.upgrade_check=e|
27401470 63 68 6f 20 75 70 67 72 61 64 65 5f 73 74 65 70 |cho upgrade_step|
27401480 3d 24 7b 75 70 67 72 61 64 65 5f 73 74 65 70 7d |=${upgrade_step}|
27401490 3b 20 69 66 20 69 74 65 73 74 20 24 7b 75 70 67 |; if itest ${upg|
274014a0 72 61 64 65 5f 73 74 65 70 7d 20 3d 3d 20 33 3b |rade_step} == 3;|
274014b0 20 74 68 65 6e 20 72 75 6e 20 69 6e 69 74 5f 64 | then run init_d|
274014c0 69 73 70 6c 61 79 3b 20 72 75 6e 20 73 74 6f 72 |isplay; run stor|
274014d0 65 61 72 67 73 3b 20 72 75 6e 20 75 70 64 61 74 |eargs; run updat|
274014e0 65 3b 65 6c 73 65 20 69 66 20 69 74 65 73 74 20 |e;else if itest |
274014f0 24 7b 75 70 67 72 61 64 65 5f 73 74 65 70 7d 20 |${upgrade_step} |
27401500 3d 3d 20 31 3b 20 74 68 65 6e 20 64 65 66 65 6e |== 1; then defen|
27401510 76 5f 72 65 73 65 72 76 3b 20 73 65 74 65 6e 76 |v_reserv; setenv|
27401520 20 75 70 67 72 61 64 65 5f 73 74 65 70 20 32 3b | upgrade_step 2;|
27401530 20 73 61 76 65 65 6e 76 3b 66 69 3b 66 69 3b 00 | saveenv;fi;fi;.|
27401540 75 70 67 72 61 64 65 5f 6b 65 79 3d 69 66 20 67 |upgrade_key=if g|
27401550 70 69 6f 20 69 6e 70 75 74 20 47 50 49 4f 41 4f |pio input GPIOAO|
27401560 5f 33 3b 20 74 68 65 6e 20 65 63 68 6f 20 64 65 |_3; then echo de|
27401570 74 65 63 74 20 75 70 67 72 61 64 65 20 6b 65 79 |tect upgrade key|
27401580 3b 20 72 75 6e 20 75 70 64 61 74 65 3b 66 69 3b |; run update;fi;|
27401590 00 75 70 67 72 61 64 65 5f 73 74 65 70 3d 30 00 |.upgrade_step=0.|
274015a0 75 73 62 5f 62 75 72 6e 69 6e 67 3d 75 70 64 61 |usb_burning=upda|
274015b0 74 65 20 31 30 30 30 00 77 69 70 65 5f 63 61 63 |te 1000.wipe_cac|
274015c0 68 65 3d 73 75 63 63 65 73 73 66 75 6c 00 77 69 |he=successful.wi|
274015d0 70 65 5f 64 61 74 61 3d 73 75 63 63 65 73 73 66 |pe_data=successf|
274015e0 75 6c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |ul…|
274015f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |…|

But when I use the same addresses in the fw_env.config I can’t get it to work
I used the following
/dev/mmcblk0 0x27400000 0x800000
and I still get bad crc when executing fw_printenv

Looking at the u-boot source found this in the board config
#define CONFIG_ENV_SIZE (64*1024)
So, I used this size with the offset from the Uart log like so
/dev/mmcblk0 0x27400000 0x10000
Now the fw_printenv works and I don’t get bad CRC, but I can’t use the fw_setenv tool(I can’t set variable). What is causing this behavior?

Petitboot isn’t a replacement for u-boot. Petitboot provides a Linux based boot menue and starts the target operating system via the kexec system call. It’s useful if you want to boot from devices which aren’t accessible via u-boot but via Linux (e.g. SATA ports).

Do you get any kind of error message? You might need to add the sector size, e.g.

/dev/mmcblk0	0x27400000	0x10000   0x100

Well, This is the first time I hear about petitboot, if I understand correctly kexec system call load the kernel into memory and execute it directly so in a sense it is a bootloader. Anyway I thought my approach is more reliable to work since all it does is inform u-boot which system to boot into and everything else is done in u-boot(kinda like other multiboot solutions on arm devices like raspberry pi noobs, except this is more flexible since we have u-boot which is not present on raspberry pi).
also for if you want to boot a system from SATA you can place your rootfs on the SATA device and only have the kernel,dtb and initramfs on an accessible device(mmc, emmc, usb) and edit the u-boot script of that system to use the SATA device as a rootfs.

No, I don’t get any error, fw_setenv execute without any output and when I check through printenv I see that the variable value was not changed.
I tried 0x100 as a sector size and it didn’t help, Is this value correct for every device

This is strange, what happens if you define a new variable or delete an existing one?

For mmc backed devices, this value is more or less irrelevant, since these devices offer full random access. If fw_setenv/fw_printenv needs access to devices with paged access only (e.g. spi flash), this value is important.

I know. Sometimes it’s easier to have everything you need to boot an operating system in one partition only.

Your approach needs write access to the u-boot environment, which is OK for mmc backed devices. Some flash memory based storage devices support a limited number of write cycles only. In this case you might want to avoid unnecessary write access.

deleting existing variable or defining a new one doesn’t work either

Hi moham96,

The following config works on VIM1 linux 4.17.3.

root@Khadas:~# cat /etc/fw_env.config
# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
# Futhermore, if the Flash sector size is ommitted, this value is assumed to
# be the same as the Environment size, which is valid for NOR and SPI-dataflash

# Block device example
/dev/mmcblk1    0x27400000      0x10000

Linux 4.17.3:

root@Khadas:~# uname -r
4.17.3

Thanks.