founded the Tokugawa shogunate, were loyal followers of Nobunaga. Hideyoshi began as a peasant and became one of Nobunaga's top generals, and Ieyasu had shared his childhood with Nobunaga. Hideyoshi defeated Mitsuhide within a month and was regarded as the rightful successor of Nobunaga by avenging the treachery of Mitsuhide. These two were able to use Nobunaga's previous achievements on which build a unified Japan and there was a saying: "The reunification is a rice cake; Oda made it. Hashiba shaped it. In the end, only Ieyasu tastes it." (Hashiba is the family name that Toyotomi Hideyoshi used while he was a follower of Nobunaga.) Toyotomi Hideyoshi, who became a grand minister in 1586, created a law that non-samurai were not allowed to carry weapons, which the samurai caste codified as permanent and hereditary, thereby ending the social mobility of Japan, which lasted until the dissolution of the Edo shogunate by the Meiji revolutionaries. The distinction between samurai and non-samurai was so obscure that during the 16th century, most male adults in any social class (even small farmers) belonged to at least one military organization of their own and served in wars before and during Hideyoshi's rule. It can be said that an "all against all" situation continued for a century. The authorized samurai families after the 17th century were those that chose to follow Nobunaga, Hideyoshi and Ieyasu. Large battles occurred during the change between regimes, and a number of defeated samurai were destroyed, went rōnin or were absorbed into the general populace. Invasions of Korea In 1592 and again in 1597, Toyotomi Hideyoshi, aiming to invade China through Korea, mobilized an army of 160,000 peasants and samurai and deployed them to Korea. Taking advantage of arquebus mastery and extensive wartime experience from the Sengoku period, Japanese samurai armies made major gains in most of Korea. A few of the famous samurai generals of this war were Katō Kiyomasa, Konishi Yukinaga, and Shimazu Yoshihiro. Katō Kiyomasa advanced to Orangkai territory (present-day Manchuria) bordering Korea to the northeast and crossed the border into Manchuria. He withdrew after retaliatory attacks from the Jurchens there, as it was clear he had outpaced the rest of the Japanese invasion force. Shimazu Yoshihiro led some 7,000 samurai and, despite being heavily outnumbered, defeated a host of allied Ming and Korean forces at the Battle of Sacheon in 1598, near the conclusion of the campaigns.