It has taken a long time but I am able to build and run a SWUpdate kernel. Now I am attempting to communicate between Linux and the Bootloader using fw_setenv.
To configure this I have
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://uboot.diff file://fw_env.config"
do_install_append () {
install -d ${D}${sysconfdir}
install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
}
With all of this when I boot into my application and run fw_setenv I always get
root@imx6ull14x14evk:~# fw_setenv SOME_SETTING 1
Configuration file wrong or corrupted
已解决! 转到解答。
Looking at some PDFs I found from NXP I ran fdisk -l on my device and I see
fdisk -l
Disk /dev/mmcblk1: 29 GB, 31292129280 bytes, 61117440 sectors
954960 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk1p1 * 64,0,1 418,3,24 8192 53623 45432 22.1M c Win95 FAT32 (LBA)
/dev/mmcblk1p2 448,0,1 1023,3,32 57344 575249 517906 252M 83 Linux
So I updated /etc/fw_env.config to be
/dev/mmcblk1p1 0xE0000 0x2000
This now gives me the error
fw_printenv
Cannot read environment, using default
Cannot read default environment from file
To be clear
fdisk -l
Disk /dev/mmcblk1: 29 GB, 31292129280 bytes, 61117440 sectors
954960 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk1p1 * 64,0,1 418,3,24 8192 53623 45432 22.1M c Win95 FAT32 (LBA)
/dev/mmcblk1p2 448,0,1 1023,3,32 57344 575249 517906 252M 83 Linux
In the uboot config
#define CONFIG_ENV_OFFSET 0xE0000
#define CONFIG_ENV_SIZE 0x2000
#define CONFIG_ENV_IS_IN_MMC 1
So my /etc/fw_env.config contains
/dev/mmcblk1p1 0xE0000 0x2000
So it seems everything is set correct. But when I try to print from linux I get
fw_printenv
Cannot read environment, using default
Cannot read default environment from file
What setting am I missing?
Hello @Sanket_Parekh The setting
#define CONFIG_SYS_MMC_ENV_PART 0
Was already set in my u-boot.cfg.
In my Yocto build I am in the folder
/mnt/YoctoDrive/Documents/MAIN_Application/build-fb/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/u-boot-imx/2021.04-r0/build/mx6ull_14x14_evk_config
Hello @Sanket_Parekh here is the output of my setenv, saveenv, printenv
=> setenv MY_VAR = 12345
=> saveenv
Saving Environment to MMC... Writing to MMC(1)... OK
=> printenv
MY_VAR== 12345
I tried the dd command in u-boot and realised this is for linux. Here is the result of that command.
dd if=/dev/mmcblk1p1 of=env.bin bs=1024 skip=896 count=1 | hexdump -C env.bin
1+0 records in
1+0 records out
If I run the command a second time. I get more output
root@imx6ull14x14evk:~# dd if=/dev/mmcblk1p1 of=env.bin bs=1024 skip=896 count=1 | hexdump -C env.bin
00000000 22 28 a0 e1 0f 20 02 e2 04 10 a0 e3 11 12 a0 e1 |"(... ..........|
00000010 01 20 41 e2 02 00 c0 e1 01 b0 4b e2 02 b0 cb e1 |. A.......K.....|
00000020 0b 00 50 e1 02 00 00 ca 3e 0f 07 ee 01 00 80 e0 |..P.....>.......|
00000030 fa ff ff ea 9a af 07 ee 15 af 07 ee 9a af 07 ee |................|
00000040 95 af 07 ee 0e f0 a0 e1 01 00 14 e3 0e f0 a0 11 |................|
00000050 7e ff 17 ee fd ff ff 1a 15 0f 07 ee 9a 0f 07 ee |~...............|
00000060 0e f0 a0 e1 01 00 14 e3 0e f0 a0 11 01 28 a0 e3 |.............(..|
00000070 20 b0 a0 e3 30 3f 10 ee 09 00 33 e1 09 00 00 0a | ...0?....3.....|
00000080 23 19 a0 e1 07 10 01 e2 01 2b a0 e3 12 21 a0 e1 |#........+...!..|
00000090 01 09 13 e3 a2 20 82 10 23 36 a0 e1 03 30 03 e2 |..... ..#6...0..|
000000a0 08 b0 a0 e3 1b b3 a0 e1 0f 10 a0 e1 3f 10 c1 e3 |............?...|
000000b0 02 20 81 e0 0b 30 91 e6 02 00 31 e1 fc ff ff 1a |. ...0....1.....|
000000c0 15 1f 07 ee 16 1f 07 ee 9a 1f 07 ee 0e f0 a0 e1 |................|
000000d0 01 00 14 e3 0e f0 a0 11 00 10 a0 e3 10 1f 07 ee |................|
000000e0 0e f0 a0 e1 00 f0 20 e3 00 f0 20 e3 00 f0 20 e3 |...... ... ... .|
000000f0 00 f0 20 e3 00 f0 20 e3 00 f0 20 e3 00 f0 20 e3 |.. ... ... ... .|
00000100 fe ff ff ea fe ff ff ea fe ff ff ea fe ff ff ea |................|
00000110 fe ff ff ea 01 00 00 ea fe ff ff ea fe ff ff ea |................|
00000120 00 00 a0 e3 07 10 a0 e1 08 20 a0 e1 04 f0 a0 e1 |......... ......|
00000130 30 30 9f e5 03 30 8f e0 01 20 f3 e5 00 00 52 e3 |00...0... ....R.|
00000140 fc ff ff 1a 01 30 d0 e4 00 00 53 e3 fc ff ff 1a |.....0....S.....|
00000150 14 30 9f e5 03 30 8f e0 01 20 f3 e5 00 00 52 e3 |.0...0... ....R.|
00000160 fc ff ff 1a fe ff ff ea 50 10 00 00 34 10 00 00 |........P...4...|
00000170 08 00 9f e5 10 40 2d e9 00 00 8f e0 eb ff ff eb |.....@-.........|
00000180 24 10 00 00 08 00 9f e5 10 40 2d e9 00 00 8f e0 |$........@-.....|
00000190 e6 ff ff eb 2c 10 00 00 98 c0 9f e5 10 40 2d e9 |....,........@-.|
000001a0 94 e0 9f e5 0c c0 8f e0 0e e0 9c e7 00 00 8e e5 |................|
000001b0 88 e0 9f e5 0e e0 9c e7 00 10 8e e5 80 10 9f e5 |................|
000001c0 01 10 9c e7 00 20 81 e5 78 20 9f e5 78 10 9f e5 |..... ..x ..x...|
000001d0 01 10 8f e0 02 20 9c e7 00 30 82 e5 01 30 f1 e5 |..... ...0...0..|
000001e0 00 00 53 e3 fc ff ff 1a 60 e0 9f e5 00 20 a0 e1 |..S.....`.... ..|
000001f0 5c 10 9f e5 5c 30 9f e5 0e 00 9c e7 01 10 9c e7 |\...\0..........|
00000200 03 30 9c e7 00 10 41 e0 92 01 00 eb 00 00 50 e3 |.0....A.......P.|
00000210 05 00 00 1a 40 30 9f e5 03 30 8f e0 01 20 f3 e5 |....@0...0... ..|
00000220 00 00 52 e3 fc ff ff 1a 10 80 bd e8 2c 00 9f e5 |..R.........,...|
00000230 00 00 8f e0 bd ff ff eb a4 0d 64 00 14 00 00 00 |..........d.....|
00000240 1c 00 00 00 0c 00 00 00 18 00 00 00 14 10 00 00 |................|
00000250 08 00 00 00 04 00 00 00 10 00 00 00 e4 0f 00 00 |................|
00000260 e8 0f 00 00 08 00 9f e5 10 40 2d e9 00 00 8f e0 |.........@-.....|
00000270 ae ff ff eb cc 0f 00 00 f0 4f 2d e9 02 00 51 e3 |.........O-...Q.|
00000280 01 80 80 e0 00 70 93 e5 0c d0 4d e2 07 70 82 e0 |.....p....M..p..|
00000290 a0 00 00 9a 00 a0 d0 e5 02 60 a0 e1 04 00 51 e3 |.........`....Q.|
000002a0 82 00 00 9a 11 00 5a e3 80 00 00 1a 01 20 d0 e5 |......Z...... ..|
000002b0 02 50 80 e2 02 a0 d0 e5 02 b0 a0 e1 11 00 5a e3 |.P............Z.|
000002c0 27 00 00 8a 06 40 a0 e1 00 20 a0 e3 ff e0 a0 e3 |'....@... ......|
000002d0 01 e1 40 e3 fc 9f 0f e3 00 e0 8d e5 0f 00 5a e3 |..@...........Z.|
000002e0 01 10 85 e2 0a 00 a0 e1 2e 00 00 8a 00 00 52 e3 |..............R.|
000002f0 b3 00 00 1a 00 00 5a e3 c0 00 00 0a 03 20 80 e2 |......Z...... ..|
00000300 01 c0 48 e0 04 00 a0 e1 0f e0 82 e2 00 40 47 e0 |..H..........@G.|
00000310 0c 00 5e e1 6f 00 00 8a 04 00 5e e1 6d 00 00 8a |..^.o.....^.m...|
00000320 02 50 81 e0 02 40 80 e0 00 20 91 e5 10 10 81 e2 |.P...@... ......|
00000330 00 20 80 e5 10 00 80 e2 05 00 51 e1 0c 20 11 e5 |. ........Q.. ..|
1+0 records in
1+0 records out
00000340 0c 20 00 e5 08 20 11 e5 08 20 00 e5 04 20 11 e5 |. ... ... ... ..|
00000350 04 20 00 e5 f3 ff ff 3a 00 a0 d5 e5 04 20 a0 e3 |. .....:..... ..|
00000360 d9 ff ff ea 01 10 85 e2 11 20 4a e2 06 00 a0 e1 |......... J.....|
00000370 03 00 52 e3 01 c0 48 e0 e2 ff ff ca 05 00 5c e3 |..R...H.......\.|
00000380 2d 00 00 9a 00 c0 47 e0 03 00 5c e3 2e 00 00 9a |-.....G...\.....|
00000390 00 40 a0 e1 00 00 91 e5 02 50 81 e0 02 00 84 e6 |.@.......P......|
000003a0 02 a0 d1 e7 c8 ff ff ea 3f 00 5a e3 35 00 00 8a |........?.Z.5...|
000003b0 1f 00 5a e3 5c 00 00 9a 1f 50 0a e2 00 00 55 e3 |..Z.\....P....U.|
000003c0 02 50 85 e2 ba 00 00 0a b2 c0 d1 e0 03 20 0c e2 |.P........... ..|
000003d0 2c c1 e0 e1 0c c0 84 e0 0c 00 56 e1 d8 00 00 8a |,.........V.....|
000003e0 0c 00 44 e0 04 a0 47 e0 07 00 50 e3 05 00 84 e0 |..D...G...P.....|
000003f0 d7 00 00 da 0f e0 85 e2 0a 00 5e e1 63 00 00 8a |..........^.c...|
Doing some more reading it seems I need to set
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_LOADENV=y
I added these to a defconfig and patch file. The file is patching mx6ull_14x14_evk_defconfig. I get the same error.
I am performing the following
I now get out that seems to show my variables boot variables. I am still getting the same error above. I did make a few more changes. My fw_env.config now contains
/dev/mmcblk1p2 0xE0000 0x2000
/dev/mmcblk1p2 0xE2000 0x2000