added tree generation code.
Signed-off-by: timothy <timothy@timothy-linux.(none)>