 Hongwu made an immediate effort to rebuild state infrastructure . He built a 48 km ( 30 mi ) long wall around Nanjing , as well as new palaces and government halls . The History of Ming states that as early as 1364 Zhu Yuanzhang had begun drafting a new Confucian law code , the Da Ming Lü , which was completed by 1397 and repeated certain clauses found in the old Tang Code of 653 . Hongwu organized a military system known as the <unk> , which was similar to the fubing system of the Tang dynasty ( 618 – 907 ) . 
