proper steps for rooting, deodex, etc
So I am trying to build a stock ROM, and it has been a while since I've done this, but was curious of what are the proper steps to take a working ODEX rom, add root, busybox, init.d, and deodexing. Meaning do I deodex first, then add root, then busybox, then init.d, or is that not the right order. Secondly, I remember with deodexing some files require a different api level, how will I know which is the proper api level for them? Thanks!
P.S. I am doing this for the HTC One (M7)
Device: Google Nexus 7 2013 2nd Gen FHD
Device: HTC One M8