Say you are hill tribe lord(Got level technology). You live in a mountainous, thickly forested region, live on shit food, have shit gear and a horrid organisational structure.
For more then a century hill tribes lived near the Grassy Plains, a place full of nice, ripe farming settlements just waiting to be taken. Only problem is, there is a rather large Town there, walled and all and most important, Town has several thousand horse riders. Not full plated knights, but rapidly deployable, experienced and disciplined speared force that has managed to spot and completely obliterate any tribesfolk that would try to pillage and loot within a day after they have left the hills.
Being an avid browser on /k/ and Tyrion-level smart guy you got all the tribes together. You have a few thousand savage yet undisciplined men under your command and a few years to turn this mob into cavalry-smashing force.
How do you do it? Spears? Bows? Longbows? Digging of small holes with spikes in them?
How do you reshape poor, trampable hordes into obliterators of such cavalry?