This paper studies the high-pressure common-rail diesel engine fuel supply compensation based on crankshaft fragment signals in order to improve the uneven phenomenon of diesel engine fuel supply and realize high efficiency and low pollution combustion. The experiments were conducted on a diesel engine with the model of YN30CR. Based on the characteristics of crankshaft fragment signals, the proportional integral (PI) control algorithm was used to quantify the engine working nonuniformity and extract the missing degree of fuel injection. The quantization method of each cylinder working uniformity and algorithm of fuel compensation control (FOC) based on crankshaft fragment signal were established, and the control strategy of working uniformity at different operating conditions was put forward. According to the principle of FOC control, a FOC control software module for ECU was designed. The FOC software module was simulated on ASCET platform. The results show that: Compared with the traditional quantization method, the oil compensation information extracted from crankshaft fragment signal has stronger anti-interference and more accurate parameters. FOC algorithm can accurately reflect the engine's working nonuniformity, and the control of the nonuniformity is reasonable. The compensation fuel amount calculated by FOC is high consistency with the fuel supply state of each cylinder set by experiment, which meets the requirement of accurate fuel injection control of common-rail diesel engine.