off &= ~(nand->oobblock - 1);
        i = nand_read_raw(nand, buf, off, nand->oobblock, nand->oobsize);
        if (i < 0) {
-               printf("Error (%d) reading page %08x\n", i, off);
+               printf("Error (%d) reading page %08lx\n", i, off);
                free(buf);
                return 1;
        }
-       printf("Page %08x dump:\n", off);
+       printf("Page %08lx dump:\n", off);
        i = nand->oobblock >> 4; p = buf;
        while (i--) {
                printf( "\t%02x %02x %02x %02x %02x %02x %02x %02x"
        if (*size == nand->size)
                puts("whole chip\n");
        else
-               printf("offset 0x%x, size 0x%x\n", *off, *size);
+               printf("offset 0x%lx, size 0x%x\n", *off, *size);
        return 0;
 }
 
                putc('\n');
                for (i = 0; i < CFG_MAX_NAND_DEVICE; i++) {
                        if (nand_info[i].name)
-                               printf("Device %d: %s, sector size %lu KiB\n",
+                               printf("Device %d: %s, sector size %u KiB\n",
                                        i, nand_info[i].name,
                                        nand_info[i].erasesize >> 10);
                }
                printf("\nDevice %d bad blocks:\n", nand_curr_device);
                for (off = 0; off < nand->size; off += nand->erasesize)
                        if (nand_block_isbad(nand, off))
-                               printf("  %08x\n", off);
+                               printf("  %08lx\n", off);
                return 0;
        }
 
                                if (off == nand->size - nand->oobblock
                                    || (s != last_status && off != 0))  {
 
-                                       printf("%08x - %08x: %8d pages %s%s%s\n",
+                                       printf("%08lx - %08lx: %8lu pages %s%s%s\n",
                                               block_start,
                                               off-1,
                                               (off-block_start)/nand->oobblock,
 
        }
 
        if (erase_length < meminfo->erasesize) {
-               printf("Warning: Erase size 0x%08x smaller than one "   \
+               printf("Warning: Erase size 0x%08lx smaller than one "  \
                       "erase block 0x%08x\n",erase_length, meminfo->erasesize);
                printf("         Erasing 0x%08x instead\n", meminfo->erasesize);
                erase_length = meminfo->erasesize;
                         * on (slow) serial consoles
                         */
                        if (percent != percent_complete) {
-                               printf("\rWriting data at 0x%x "
+                               printf("\rWriting data at 0x%lx "
                                       "-- %3d%% complete.",
                                       mtdoffset, percent);
                                percent_complete = percent;
                         */
                        if (percent != percent_complete) {
                        if (!opts->quiet)
-                               printf("\rReading data from 0x%x "
+                               printf("\rReading data from 0x%lx "
                                       "-- %3d%% complete.",
                                       mtdoffset, percent);
                                percent_complete = percent;