Bug 9601 - fdisk applet wrong CHS display
Summary: fdisk applet wrong CHS display
Status: RESOLVED INVALID
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-18 21:46 UTC by Béla Márkus
Modified: 2017-01-19 13:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Béla Márkus 2017-01-18 21:46:30 UTC
BusyBox 1.26.2 fdisk applet displays wrong starting CHS values, see example below (RPi3 SD card):


Command (m for help): p
Disk /dev/mmcblk0: 15 GB, 15636365312 bytes, 30539776 sectors
1272490 cylinders, 3 heads, 8 sectors/track
Units: cylinders of 24 * 512 = 12288 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk0p1    27,7,9      232,2,8           8192      69631      61440 30.0M  c Win95 FAT32 (LBA)
/dev/mmcblk0p2    1023,2,8    1023,2,8         69648      89179      19532 9766K 83 Linux

Command (m for help):


Looks like StartCHS for second partition is the same as EndCHS
Comment 1 Denys Vlasenko 2017-01-18 23:24:15 UTC
Show your raw partition table (for example, in hexdump form)
Comment 2 Béla Márkus 2017-01-19 06:50:45 UTC
See SD card image in the zip

http://tinycorelinux.net/8.x/armv6/releases/RPi/piCore-8.1.4.zip
Comment 3 Denys Vlasenko 2017-01-19 13:14:37 UTC
The partition table in piCore-8.1.4.img is as follows

struct partition {
        unsigned char boot_ind;         /* 0x80 - active */
        unsigned char head;             /* starting head */
        unsigned char sector;           /* starting sector */
        unsigned char cyl;              /* starting cylinder */
        unsigned char sys_ind;          /* what partition type */
        unsigned char end_head;         /* end head */
        unsigned char end_sector;       /* end sector */
        unsigned char end_cyl;          /* end cylinder */
        unsigned char start4[4];        /* starting sector counting from 0 */
        unsigned char size4[4];         /* nr of sectors in partition */
} PACKED;

000001b0: 00 00 00 00 00 00 00 00 4f bf 09 00 00 00 00 07  ........O.......
                                                       ^^head:7
000001c0: 09 1b 0c 02 08 e8 00 20 00 00 00 f0 00 00 00 02  ....... ........
          ^^^^^cyl/sect:0x1b/9=27/9                    ^^head:2
                   ^^head:2
                      ^^^^^ cyl/sect:0xe8/8=232/8
000001d0: c8 ff 83 02 c8 ff 10 10 01 00 4c 4c 00 00 00 00  ..........LL....
          ^^^^^cyl/sect:0x3ff/8=1023/8
                   ^^head:2
                      ^^^^^ cyl/sect:1023/8
000001e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
000001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa  ..............U.

That's exactly the CHS values fdisk shows.