Skip to contentSkip to conversation

tools: mxsboot: Use more portable cpu_to_le32()

PATCH New Bin Meng 3 participants 3 messages Jan 25, 2016 – Feb 2, 2016 Arm i.MX and Layerscape

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 tools: mxsboot: Use more portable cpu_to_le32()

Currently when building mxsboot on certain machines it reports:

HOSTCC tools/mxsboot
tools/mxsboot.c: In function 'mx28_create_sd_image':
tools/mxsboot.c:560: warning: implicit declaration of function 'htole32' /tmp/cchLIV6q.o: In function 'main':
mxsboot.c:(.text+0x6d8): undefined reference to 'htole32' mxsboot.c:(.text+0x6e7): undefined reference to 'htole32' mxsboot.c:(.text+0x6f6): undefined reference to 'htole32' mxsboot.c:(.text+0x705): undefined reference to 'htole32' mxsboot.c:(.text+0x711): undefined reference to 'htole32' /tmp/cchLIV6q.o:mxsboot.c:(.text+0x71d): more undefined references to 'htole32' follow
collect2: ld returned 1 exit status
make[1]: *** [tools/mxsboot] Error 1
make: *** [tools] Error 2

The solution is to use cpu_to_le32() instead which is more portable, just like other U-Boot tools [1] do.

[1] http://lists.denx.de/pipermail/u-boot/2014-October/192919.html

---

 tools/mxsboot.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
tools/mxsboot.c +9 -9
index 3434c81..457f435 100644
@@ -557,15 +557,15 @@ static int mx28_create_sd_image(int infd, int outfd)
 
 	cb = (struct mx28_sd_config_block *)buf;
 
-	cb->signature = htole32(0x00112233);
-	cb->primary_boot_tag = htole32(0x1);
-	cb->secondary_boot_tag = htole32(0x1);
-	cb->num_copies = htole32(1);
-	cb->drv_info[0].chip_num = htole32(0x0);
-	cb->drv_info[0].drive_type = htole32(0x0);
-	cb->drv_info[0].tag = htole32(0x1);
-	cb->drv_info[0].first_sector_number = htole32(sd_sector + 4);
-	cb->drv_info[0].sector_count = htole32((size - 4) / 512);
+	cb->signature = cpu_to_le32(0x00112233);
+	cb->primary_boot_tag = cpu_to_le32(0x1);
+	cb->secondary_boot_tag = cpu_to_le32(0x1);
+	cb->num_copies = cpu_to_le32(1);
+	cb->drv_info[0].chip_num = cpu_to_le32(0x0);
+	cb->drv_info[0].drive_type = cpu_to_le32(0x0);
+	cb->drv_info[0].tag = cpu_to_le32(0x1);
+	cb->drv_info[0].first_sector_number = cpu_to_le32(sd_sector + 4);
+	cb->drv_info[0].sector_count = cpu_to_le32((size - 4) / 512);
 
 	wr_size = write(outfd, buf, size);
 	if (wr_size != size) {
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH 1/1 tools: mxsboot: Use more portable cpu_to_le32()

Quoted 17 lines · Bin Meng

Currently when building mxsboot on certain machines it reports:

HOSTCC tools/mxsboot
tools/mxsboot.c: In function 'mx28_create_sd_image':
tools/mxsboot.c:560: warning: implicit declaration of function 'htole32' /tmp/cchLIV6q.o: In function 'main':
mxsboot.c:(.text+0x6d8): undefined reference to 'htole32' mxsboot.c:(.text+0x6e7): undefined reference to 'htole32' mxsboot.c:(.text+0x6f6): undefined reference to 'htole32' mxsboot.c:(.text+0x705): undefined reference to 'htole32' mxsboot.c:(.text+0x711): undefined reference to 'htole32' /tmp/cchLIV6q.o:mxsboot.c:(.text+0x71d): more undefined references to 'htole32' follow
collect2: ld returned 1 exit status
make[1]: *** [tools/mxsboot] Error 1
make: *** [tools] Error 2

Quoted 7 lines

The solution is to use cpu_to_le32() instead which is more portable, just like other U-Boot tools [1] do.

[1] http://lists.denx.de/pipermail/u-boot/2014-October/192919.html

Thanks!

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 tools: mxsboot: Use more portable cpu_to_le32()

In reply to Bin Meng
Quoted 17 lines · Bin Meng

Currently when building mxsboot on certain machines it reports:

HOSTCC tools/mxsboot
tools/mxsboot.c: In function 'mx28_create_sd_image':
tools/mxsboot.c:560: warning: implicit declaration of function 'htole32' /tmp/cchLIV6q.o: In function 'main':
mxsboot.c:(.text+0x6d8): undefined reference to 'htole32' mxsboot.c:(.text+0x6e7): undefined reference to 'htole32' mxsboot.c:(.text+0x6f6): undefined reference to 'htole32' mxsboot.c:(.text+0x705): undefined reference to 'htole32' mxsboot.c:(.text+0x711): undefined reference to 'htole32' /tmp/cchLIV6q.o:mxsboot.c:(.text+0x71d): more undefined references to 'htole32' follow
collect2: ld returned 1 exit status
make[1]: *** [tools/mxsboot] Error 1
make: *** [tools] Error 2

Quoted 8 lines

The solution is to use cpu_to_le32() instead which is more portable, just like other U-Boot tools [1] do.

[1] http://lists.denx.de/pipermail/u-boot/2014-October/192919.html

---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================