Posted in Xiaomi&MIUI

How to deal with Error 7 when you try to flash the Lineage OS for Xiaomi devices


本文分析了小米手机刷Lineage OS遇到error7的问题,并提供了解决方案。本文将只有英文版本。如果你看不懂英语,请借助网页翻页等工具。希望本文能对你有所帮助。

Error 7 or “xiaomi.verify_trustzone(“TZ.BF.4.0.6-00124″,”TZ.BF.4.0.6-00130″) == ‘1’” is very annoying. How can we fix it? Reflash TWRP? Wipe System and Data?

No, you shouldn’t do that. 

First of all, this error is not about any problems for TWRP, so don’t waste your time seeking for other versions of TWRP.

And then, we should learn about one thing: firmware.

Firmware is a low-level code to drive your phone, you can think them as drivers. When you power off your phone, the style of charging is controlled by the firmware.

Usually, firmware files are only included in the official ROMS. That’s why we always hearing people telling us to all-newly flash an official ROM. It can help us make the phone all new like just out of the factory, but also, it can help us get the right firmware.


From now on, just all new flash an official ROM when you want to get an all new device, or you want to unbrick the phone. Only this two reasons are recommended.

Now we know what is a firmware. Let’s see how does error 7 make sense.

In the ROM of Lineage OS, there is a file named updater-script. (How to find it: ROM =>META-INF => com => google => android => updater-script ) In this file, you can see some code to check if current firmware matches the phone. If matched, flash the ROM, or will assert the error 7.

So the right way to fix it is to change the firmware. But remember one thing: don’t always try to find a newer version, maybe the ROM just needs an older one.

For Xiaomi devices, we can easily get all the firmware from this website: It’s very convenient. (Please make sure what you download is matching your device)

Flashing firmware is very easy. Boot into TWRP => Flash firmware zip. You don’t need do any wiping. So awesome.

But just as I said before, don’t always try to use the latest firmware, for ROM may just want an older one. Because Xiaomi updates their code very frequent, third-party cannot follow them that fast.


Some people try to edit the updater-script to skip the check of firmware. Or some people choose to flash the older firmware to cheat the check and then flash back a newer one to boot the system. These ways are totally wrong.

Why? You should think about why the developer want to check the firmware. They are only responsible for the matched firmware, not others. If you change the firmware outside the range which is defined by the developer, you will meet many strange problems. For example, the fingerprint sensor cannot work properly.

So here is the method to deal with the error 7. Enjoy it.

Posted in Impression

What does Ruel 2 mean in Ray Dalio’s video “How The Economic Machine Works”?

First of all, if you haven’t seen this video before, I strongly recommend you to watch it. You will get thoroughly new ideas for your life.

Here is the video:

And in the end of the video, Ray Dalio suggests you three rules:

1. “Don’t have debt rise faster than income …

… because your debt burdens will eventually crush you.”

2. “Don’t have income rise faster than productivity …

… because you’ll eventually become uncompetitive.”

3. “Do all that you can to raise your productivity …

… because in the long run, that’s what matters most.”

These three rules are very simple but very important. But I get confused by Rule 2. Why he says that I will lose my competitivity if my income grows faster than productivity?

This is stange and nonsense. Nowadays people all over the world are chasing the chance to rise their wages or salaries, and most of they think it is the most important thing in their lives. They change jobs and locations to get the higher payments.

I searched online for some time but can’t get an ideal answer. However, I find something later and know the meaning of it.

Just as what simple knowledges showed in the video, let’s see Rule 2 in the aspect of demand and supply.

If your income grows faster than your productivity, that means the supply is more than demand. Productivity should match your income at the same level. You just should gain what you pay. Too much incomes will lead you lazy and don’t want to improve your productivity.

Meanwhile, higher income will get you in a trap: you think of yourself is strong and have the enough power to earn money. Think about what said in the video: in the fake and foam periods of economy, most people think they have power, money and status etc., but they suddenly find they lost everything in one night.

The last thing is that too much incomes will make you willing to spend your money and extend your loans or debts, and you will find you can’t offset these.

So to sum up, “you’ll eventually become uncompetitive.”

This reminds me of a meme in Chinese:

There are three big unfortunate in the life:

1. Achieve ultimate goal of life or get ultimate reputations and status in the early life
2. Get the windfall
3. Born in the emperor family

In fact, all these three things in China is thought as fortunate or luck that common people can’t get in their whole lives. But if you research some cases in the history, you will find it’s not true.

Many people want to be an emperor, but nearly all the emperors in the history don’t have happy endings. Even those emperors who have happy endings, also pay too much effort to keep their chairs and avoid being killed while they are eating or sleeping. I think the principle behind this meme is the same as Ray Dalio’s Rule 2.

Life is long enough to grow, but few chance to regret. Cherish your life and your family. Don’t be blinded by money.

Posted in Comment





































Posted in Python

Some interesting things about Tuple in Python


The contents in Tuple cannot be changed. But if there is something changeable in Tuple, it can be changed.


t = (“a”, “b”, 1, False, [1, 2, 3])

t[4][0] = 6

print(t)   ### (“a”, “b”, 1, False, [6, 2, 3])


If there is only an element in  tuple, like (1), you should plus a “,” after it, like (1, ). Why?

Because in python, (1) will be recognized as the whole number 1 in maths, so be careful.