In Yalqut Shim`oni on Bereshith 50, it states about the burial of Ya`aqov:
בתחלה עד שלא ראו כבודן של ישראל לא נהגו בהן כבוד, ולבסוף שראו כבודן של ישראל נהגו בהן כבוד, שנאמר: ויבואו עד גרן האטד.
וכי יש גורן לאטד?
אמר רבי אבהו:
מלמד שהקיפו כתרים לארונו של יעקב, כגורן זה שמוקף לו אטד. שבאו בני ישמעאל ובני עשו ובני קטורה למלחמה, וכיון שראו כתרו של יוסף תלוי בארונו של יעקב, נטלו כולן כתריהם ותלאום בארונו של יעקב.
The important information above is that the sons of `Esaw, Yishma`el and Qettura (descendants of Yishma`el's brothers) came to wage war among each other and they saw Yosef's crown placed at the head of Ya`aqov's sarcophagus. Instead of fighting they came and placed their crowns upon Ya`aqov also.
What does this mean?
In the books of Kabbalah and Breslov:
- Ya`aqov signifies the idea of da`ath (and tifereth), which is knowledge of HaShem and Torah.
- Yosef signifies the sadiq who is called such because of the purity of sexuality he attained, which is considered as keeping the whole Torah. Only one who guards the brith, keeps pure sexuality, can truly attain da`ath. One who damages it throws his da`ath out the window, because semen is derived from "drops of the mind/brain".
- Crown refers to the maqifin, attainments of knowledge, awareness, and information in Torah. It is Ruah HaQodesh, "divine inspiration" as commonly translated. Torah 21 of Liqutei Moharan explains this and how to attain it.
So, what we see in this story is Yosef, the sadiq, leading all Israel at the passing of their father Ya`aqov, who signifies da`ath. The crown is placed upon Ya`aqov/da`ath, meaning that the people of Israel, under the Sadiq, achieve tiqun habrith (pure/corrected sexuality) and thus achieve divine knowledge, then the nations see this and react. Annulling their warfare against each other because they attain a higher perception of da`ath of HaShem - symbolized by placing their crowns on Ya`aqov. Greater da`ath leads to the annulment of idolatry and greater mercy. This is what the prophets speak about that in the future the wolf will dwell with the lamb, and that the nations won't wage war anymore.
Filter this through the fact that the war of Gog uMagog must happen as it is a great mercy to Israel and a vengeance upon the 70 prototype nations who are divided 35-35 under the dominions of `Esaw and Yishma`el (Hayyei Moharan 6) - this short passage in Yalqut Shim`oni means this:
After or during the war of Gog uMagog, when the Messiah will come and bring Israel into an elevated state of purity through tiqun haklali/tiqun habrith and wage war against them to throw their control off of the people of Israel, the nations will eventually cease their fighting and attain a higher state of da`ath - perhaps initially through revelation of an inexplicable miracle from Heaven - through which they will cast away their idols, their false religions, and they will submit to Torah and to King David's restored kingdom. All war will cease and we will enter into the days of Messiah, which should come soon and speedily in our days.